-
Notifications
You must be signed in to change notification settings - Fork 28
FEAT: Implementation of C++ Connection Class API #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new ODBC Connection class and underlying support for dynamic driver loading and handle management in the mssql_python project.
- Implements the
Connectionclass for connect/disconnect, transactions, autocommit, and statement allocation - Adds ODBC API function-pointer typedefs, a
DriverLoadersingleton, and an RAIISqlHandlewrapper - Centralizes driver loading and pointer resolution in
ddbc_bindings.h
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| mssql_python/pybind/ddbc_bindings.h | Added ODBC API typedefs, logging/exception helpers, DriverLoader, SqlHandle |
| mssql_python/pybind/connection/connection.h | Declared the Connection class and its public interface |
| mssql_python/pybind/connection/connection.cpp | Implemented Connection methods (connect/close, transactions, autocommit) |
Comments suppressed due to low confidence (1)
mssql_python/pybind/ddbc_bindings.h:4
- [nitpick] Fix the grammar in this comment: replace "that is file" with "this file".
// INFO|TODO - Note that is file is Windows specific right now. Making it arch agnostic will be
05231ba to
cd20ea2
Compare
7727ace to
eb7161e
Compare
cd20ea2 to
37f6dcb
Compare
daf84f8 to
eca18a0
Compare
56cf353 to
c89cfbe
Compare
f979de7 to
896f34d
Compare
5ecc8fd to
6a077c6
Compare
6a077c6 to
c8dfd0e
Compare
sumitmsft
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All comments have been resolved. Relevant changes made.
* refactor native layer and create reusable components * add newline * Delete copy/assign for DriverLoader singleton * resolve review comments * initial edit * working flow with c++ connection class * working interation with access token * cleanup free() in sqlhandle * removed unnecessary prints * removing comment * resolving conflict * working * final working-fix test * minor updates * updating file * added a TODO comment to address review comments --------- Co-authored-by: Saumya Garg <gargsaumya@microsoft.com>
bewithgaurav
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a task for the memory issue https://sqlclientdrivers.visualstudio.com/mssql-python/_workitems/edit/37606
ADO Task ID [AB#37539]
This pull request introduces a new
Connectionclass and supporting infrastructure for managing ODBC database connections in themssql_pythonproject. Key changes include the implementation of theConnectionclass, the addition of function pointer typedefs for ODBC APIs, and the creation of utility classes for driver management and handle lifecycle management.New
ConnectionClass Implementation:mssql_python/pybind/connection/connection.cpp: Implements theConnectionclass, which provides methods for connecting to a database, managing transactions, and configuring autocommit. It uses RAII for resource management viaSqlHandle.mssql_python/pybind/connection/connection.h: Declares theConnectionclass, including methods for connection management, transaction handling, and autocommit configuration.ODBC Function Pointer Typedefs and Utilities:
mssql_python/pybind/ddbc_bindings.h: Adds typedefs for ODBC API function pointers, logging utilities, and exception helpers. Introduces theDriverLoadersingleton for centralized driver loading and theSqlHandleclass for RAII-based handle management.Checklist