-
Notifications
You must be signed in to change notification settings - Fork 8
FEAT: complete macOS-support with main ddbc_bindings and connection pooling #102
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 unifies and refactors ODBC connection handling for both macOS and Windows by removing the old macOS-only implementation, consolidating platform-specific logic into shared modules, and enhancing debugging through detailed logging of parameter binding.
- Consolidated connection logic: removed
connection_mac.py
and related CMake logic, updatedConnectionHandle
to use UTF-8 strings everywhere - Added wide-char/UTF-8 conversion utilities and detailed parameter-binding logs in
ddbc_bindings.*
- Swapped Windows‐only headers for
std::filesystem
and introduced platform‐agnostic driver‐loading helpers
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
pybind/mac_utils.h | Added license, header comments for macOS wide-char utilities |
pybind/ddbc_bindings.h | Unified platform includes and added inline UTF-8/wstring helpers |
pybind/ddbc_bindings.cpp | Swapped to std::filesystem , added detailed logging, driver helpers |
pybind/connection/connection.* | Updated ConnectionHandle to accept std::string and convert to wide |
pybind/CMakeLists.txt | Removed macOS-specific blocks, always build unified source |
db_connection.py | Dropped conditional import of macOS connection implementation |
connection_pool.cpp | Removed unused <iostream> include |
Comments suppressed due to low confidence (2)
mssql_python/pybind/ddbc_bindings.h:49
- The header uses std::vector but does not include . Add "#include " near the top to ensure this compiles.
inline std::vector<SQLWCHAR> WStringToSQLWCHAR(const std::wstring& str) {
mssql_python/pybind/ddbc_bindings.h:20
- [nitpick] The IS_WINDOWS macro is defined but never referenced elsewhere; consider removing it or using it consistently to reduce unused code.
#define IS_WINDOWS 1
Ensure that every SQL call (e.g., SQLAllocHandle_ptr, SQLDriverConnect_ptr) is followed by proper error handling using checkError(ret); or equivalent logic. |
I can't see test.py for DDBC covering connect_pool changes, consider adding those. |
Yes, those have been added in another PR. #103 |
The base branch was changed.
f6f1af8
to
1dbd1fb
Compare
c35629f
to
231c4b0
Compare
231c4b0
to
a41f35d
Compare
This pull request refactors the
mssql_python
module to remove macOS-specific implementations and unify the codebase for better maintainability. Key changes include removing theconnection_mac.py
file, updating connection handling to use UTF-8 strings, and modifying build configurations to eliminate platform-specific blocks.Removal of macOS-specific implementations:
mssql_python/connection_mac.py
: Deleted the entire file, which contained macOS-specific implementations of theConnection
class. This eliminates platform-specific handling in favor of a unified approach.mssql_python/db_connection.py
: Removed conditional imports for macOS and updated theConnection
import to use the unified implementation.mssql_python/pybind/CMakeLists.txt
: Removed the conditional block for macOS-specific source files (ddbc_bindings_mac.cpp
) and standardized the build process to useddbc_bindings.cpp
.Transition to UTF-8 string handling:
mssql_python/pybind/connection/connection.cpp
: UpdatedConnectionHandle
to convert connection strings from UTF-8 to wide strings (std::wstring
) internally, ensuring compatibility across platforms.mssql_python/pybind/connection/connection.h
: Changed the constructor ofConnectionHandle
to accept UTF-8 strings (std::string
) instead of wide strings (std::wstring
).mssql_python/pybind/ddbc_bindings.cpp
: Updated the Python bindings forConnectionHandle
to accept UTF-8 strings for the connection string parameter.Minor adjustments:
mssql_python/pybind/connection/connection_pool.cpp
: Removed an unused#include <iostream>
statement to clean up the code.Issue Reference
AB#37666
AB#37610