@@ -633,17 +633,7 @@ SqlHandle::SqlHandle(SQLSMALLINT type, SQLHANDLE rawHandle)
633633// Native ODBC handles must be explicitly released by calling `free()` directly from Python.
634634// This avoids nondeterministic crashes during GC or shutdown during pytest.
635635// Read the documentation for more details (https://aka.ms/CPPvsPythonGC)
636- SqlHandle::~SqlHandle () {}
637-
638- SQLHANDLE SqlHandle::get () const {
639- return _handle;
640- }
641-
642- SQLSMALLINT SqlHandle::type () const {
643- return _type;
644- }
645-
646- void SqlHandle::free () {
636+ SqlHandle::~SqlHandle () {
647637 if (_handle && SQLFreeHandle_ptr) {
648638 const char * type_str = nullptr ;
649639 switch (_type) {
@@ -661,6 +651,14 @@ void SqlHandle::free() {
661651 }
662652}
663653
654+ SQLHANDLE SqlHandle::get () const {
655+ return _handle;
656+ }
657+
658+ SQLSMALLINT SqlHandle::type () const {
659+ return _type;
660+ }
661+
664662// Wrap SQLSetConnectAttr
665663// SQLRETURN SQLSetConnectAttr_wrap(SqlHandlePtr ConnectionHandle, SQLINTEGER Attribute,
666664// py::object ValuePtr) {
@@ -1963,8 +1961,7 @@ PYBIND11_MODULE(ddbc_bindings, m) {
19631961 .def_readwrite (" sqlState" , &ErrorInfo::sqlState)
19641962 .def_readwrite (" ddbcErrorMsg" , &ErrorInfo::ddbcErrorMsg);
19651963
1966- py::class_<SqlHandle, SqlHandlePtr>(m, " SqlHandle" )
1967- .def (" free" , &SqlHandle::free);
1964+ py::class_<SqlHandle, SqlHandlePtr>(m, " SqlHandle" );
19681965 py::class_<Connection>(m, " Connection" )
19691966 .def (py::init<const std::wstring&, bool >(), py::arg (" conn_str" ), py::arg (" autocommit" ) = false )
19701967 .def (" connect" , &Connection::connect, py::arg (" attrs_before" ) = py::dict (), " Establish a connection to the database" )
0 commit comments