Commit a12d5de
FEAT: Linux Support - Build and C++ (#113)
### ADO Work Item Reference
<!-- Insert your ADO Work Item ID below (e.g. AB#37452) -->
>
[AB#34987](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/34987)
-------------------------------------------------------------------
### Summary
<!-- Insert your Copilot Generated Summary below -->
This pull request introduces cross-platform compatibility improvements
for macOS and Linux in the MSSQL Python bindings, updates build scripts
to support multiple operating systems, and refines driver handling
logic. The most significant changes include adding Linux-specific
handling alongside macOS, enhancing build scripts for OS detection, and
integrating Python for dynamic driver path resolution.
### Cross-Platform Compatibility Enhancements:
*
[`mssql_python/pybind/ddbc_bindings.cpp`](diffhunk://#diff-dde2297345718ec449a14e7dff91b7bb2342b008ecc071f562233646d71144a1L261-R262):
Updated numerous code sections to include Linux-specific handling,
ensuring proper encoding and buffer management for SQLWCHAR data. This
includes changes in functions like `BindParameters`,
`SQLExecDirect_wrap`, and `FetchBatchData`.
[[1]](diffhunk://#diff-dde2297345718ec449a14e7dff91b7bb2342b008ecc071f562233646d71144a1L261-R262)
[[2]](diffhunk://#diff-dde2297345718ec449a14e7dff91b7bb2342b008ecc071f562233646d71144a1L828-R831)
[[3]](diffhunk://#diff-dde2297345718ec449a14e7dff91b7bb2342b008ecc071f562233646d71144a1L1609-R1613)
*
[`mssql_python/pybind/ddbc_bindings.h`](diffhunk://#diff-85167a2d59779df18704284ab7ce46220c3619408fbf22c631ffdf29f794d635L35-R35):
Replaced macOS-specific headers with Unix-specific headers to
accommodate both macOS and Linux environments.
[[1]](diffhunk://#diff-85167a2d59779df18704284ab7ce46220c3619408fbf22c631ffdf29f794d635L35-R35)
[[2]](diffhunk://#diff-85167a2d59779df18704284ab7ce46220c3619408fbf22c631ffdf29f794d635L65-R67)
### Build Script Updates:
*
[`mssql_python/pybind/build.sh`](diffhunk://#diff-7cfcd9b5499a176c28ca4d028e9b2b060238ec79c4bea5b062d4b39929f9fb04L2-R22):
Enhanced the script to detect the operating system dynamically and
configure builds accordingly for macOS and Linux. Added OS-specific
diagnostic messages and build configurations.
[[1]](diffhunk://#diff-7cfcd9b5499a176c28ca4d028e9b2b060238ec79c4bea5b062d4b39929f9fb04L2-R22)
[[2]](diffhunk://#diff-7cfcd9b5499a176c28ca4d028e9b2b060238ec79c4bea5b062d4b39929f9fb04L30-R50)
[[3]](diffhunk://#diff-7cfcd9b5499a176c28ca4d028e9b2b060238ec79c4bea5b062d4b39929f9fb04L48-R81)
*
[`mssql_python/pybind/build.bat`](diffhunk://#diff-a08055320153458138a68ccff086b540cb080819b76f921664caa782603a4c2eL166-R166):
Updated VCREDIST path to reflect platform-specific directory structures.
### Driver Handling Improvements:
*
[`mssql_python/pybind/ddbc_bindings.cpp`](diffhunk://#diff-dde2297345718ec449a14e7dff91b7bb2342b008ecc071f562233646d71144a1L621-R659):
Integrated Python to dynamically determine the driver path based on the
module directory and system architecture. Added a new function
`GetDriverPathFromPython` for this purpose.
[[1]](diffhunk://#diff-dde2297345718ec449a14e7dff91b7bb2342b008ecc071f562233646d71144a1L621-R659)
[[2]](diffhunk://#diff-dde2297345718ec449a14e7dff91b7bb2342b008ecc071f562233646d71144a1L650-R673)
*
[`mssql_python/pybind/ddbc_bindings.cpp`](diffhunk://#diff-dde2297345718ec449a14e7dff91b7bb2342b008ecc071f562233646d71144a1R2069):
Exposed the `get_driver_path` function to Python for external usage.
### Documentation Updates:
*
[`mssql_python/pybind/README.md`](diffhunk://#diff-1429930017ef4a5b84d9331206c1ac47e546427b914986e531e3f04e45f4bb31L62-R62):
Corrected the file name for compilation instructions, replacing
`ddbc_bindings_mac.cpp` with `ddbc_bindings.cpp`.
### Miscellaneous Improvements:
*
[`mssql_python/pybind/CMakeLists.txt`](diffhunk://#diff-dbb5892fbbb28149d1639664797cf3adb48ced28ec11aba95f2e2b338ca46badR15-R16):
Added a TODO comment suggesting a unified module for platform detection
across Python and C++.
<!--
### PR Title Guide
> For feature requests
FEAT: (short-description)
> For non-feature requests like test case updates, config updates ,
dependency updates etc
CHORE: (short-description)
> For Fix requests
FIX: (short-description)
> For doc update requests
DOC: (short-description)
> For Formatting, indentation, or styling update
STYLE: (short-description)
> For Refactor, without any feature changes
REFACTOR: (short-description)
> For release related changes, without any feature changes
RELEASE: #<RELEASE_VERSION> (short-description)
-->
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 71a9777 commit a12d5de
File tree
30 files changed
+266
-103
lines changed- mssql_python
- libs/windows
- arm64
- 1033
- vcredist
- x64
- 1033
- vcredist
- x86
- 1033
- vcredist
- pybind
- connection
30 files changed
+266
-103
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
6 | 54 | | |
7 | 55 | | |
8 | 56 | | |
9 | | - | |
10 | | - | |
| 57 | + | |
| 58 | + | |
11 | 59 | | |
12 | | - | |
| 60 | + | |
13 | 61 | | |
14 | 62 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 63 | | |
23 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
24 | 74 | | |
25 | 75 | | |
26 | | - | |
| 76 | + | |
27 | 77 | | |
28 | 78 | | |
29 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
109 | 112 | | |
110 | 113 | | |
111 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
0 commit comments