@@ -629,10 +629,6 @@ void DriverLoader::loadDriver() {
629629SqlHandle::SqlHandle (SQLSMALLINT type, SQLHANDLE rawHandle)
630630 : _type(type), _handle(rawHandle) {}
631631
632- // Note: Destructor is intentionally a no-op. Python owns the lifecycle.
633- // Native ODBC handles must be explicitly released by calling `free()` directly from Python.
634- // This avoids nondeterministic crashes during GC or shutdown during pytest.
635- // Read the documentation for more details (https://aka.ms/CPPvsPythonGC)
636632SqlHandle::~SqlHandle () {
637633 if (_handle && SQLFreeHandle_ptr) {
638634 const char * type_str = nullptr ;
@@ -659,46 +655,6 @@ SQLSMALLINT SqlHandle::type() const {
659655 return _type;
660656}
661657
662- // Wrap SQLSetConnectAttr
663- // SQLRETURN SQLSetConnectAttr_wrap(SqlHandlePtr ConnectionHandle, SQLINTEGER Attribute,
664- // py::object ValuePtr) {
665- // LOG("Set SQL Connection Attribute");
666- // if (!SQLSetConnectAttr_ptr) {
667- // LOG("Function pointer not initialized. Loading the driver.");
668- // DriverLoader::getInstance().loadDriver(); // Load the driver
669- // }
670-
671- // // Print the type of ValuePtr and attribute value - helpful for debugging
672- // LOG("Type of ValuePtr: {}, Attribute: {}", py::type::of(ValuePtr).attr("__name__").cast<std::string>(), Attribute);
673-
674- // SQLPOINTER value = 0;
675- // SQLINTEGER length = 0;
676-
677- // if (py::isinstance<py::int_>(ValuePtr)) {
678- // // Handle integer values
679- // int intValue = ValuePtr.cast<int>();
680- // value = reinterpret_cast<SQLPOINTER>(intValue);
681- // length = SQL_IS_INTEGER; // Integer values don't require a length
682- // } else if (py::isinstance<py::bytes>(ValuePtr) || py::isinstance<py::bytearray>(ValuePtr)) {
683- // // Handle byte or bytearray values (like access tokens)
684- // // Store in static buffer to ensure memory remains valid during connection
685- // static std::vector<std::string> bytesBuffers;
686- // bytesBuffers.push_back(ValuePtr.cast<std::string>());
687- // value = const_cast<char*>(bytesBuffers.back().c_str());
688- // length = SQL_IS_POINTER; // Indicates we're passing a pointer (required for token)
689- // } else {
690- // LOG("Unsupported ValuePtr type");
691- // return SQL_ERROR;
692- // }
693-
694- // SQLRETURN ret = SQLSetConnectAttr_ptr(ConnectionHandle->get(), Attribute, value, length);
695- // if (!SQL_SUCCEEDED(ret)) {
696- // LOG("Failed to set Connection attribute");
697- // }
698- // LOG("Set Connection attribute successfully");
699- // return ret;
700- // }
701-
702658// Helper function to check for driver errors
703659ErrorInfo SQLCheckError_Wrap (SQLSMALLINT handleType, SqlHandlePtr handle, SQLRETURN retcode) {
704660 LOG (" Checking errors for retcode - {}" , retcode);
0 commit comments