Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request fixes an issue with the data type mapping for NULL parameters in the _map_sql_type function. The change updates the C type for NULL parameters from SQL_C_DEFAULT (99) to SQL_C_CHAR (-8), which aligns with the SQL type SQL_VARCHAR that's also returned for NULL parameters.
Key changes:
- Updated the C type for NULL parameters in
_map_sql_typefromSQL_C_DEFAULTtoSQL_C_CHARto match theSQL_VARCHARSQL type being used
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changes
Summary
mssql_python/pybind/ddbc_bindings.cppLines 2461-2469 2461 dataPtr = nullBuffer;
2462 bufferLength = 1;
2463 LOG("BindParameterArray: SQL_C_DEFAULT bound - param_index=%d", paramIndex);
2464 break;
! 2465 }
2466 default: {
2467 LOG("BindParameterArray: Unsupported C type - "
2468 "param_index=%d, C_type=%d",
2469 paramIndex, info.paramCType);📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.logger_bridge.hpp: 58.8%
mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.row.py: 66.2%
mssql_python.helpers.py: 67.5%
mssql_python.pybind.ddbc_bindings.cpp: 69.3%
mssql_python.pybind.connection.connection.cpp: 73.6%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.connection.py: 83.9%
mssql_python.cursor.py: 84.4%
mssql_python.__init__.py: 84.9%🔗 Quick Links
|
gargsaumya
previously approved these changes
Nov 26, 2025
sumitmsft
reviewed
Nov 27, 2025
sumitmsft
reviewed
Nov 27, 2025
sumitmsft
reviewed
Nov 27, 2025
sumitmsft
reviewed
Nov 27, 2025
sumitmsft
requested changes
Nov 27, 2025
Contributor
sumitmsft
left a comment
There was a problem hiding this comment.
Left a few comments to address
gargsaumya
previously approved these changes
Dec 16, 2025
sumitmsft
previously approved these changes
Dec 16, 2025
1c37a67
sumitmsft
approved these changes
Dec 17, 2025
gargsaumya
reviewed
Dec 17, 2025
Contributor
gargsaumya
left a comment
There was a problem hiding this comment.
Approved, with a comment added that needs to be addressed.
gargsaumya
approved these changes
Dec 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request adds support for binding arrays of NULL parameters in SQL statements and introduces a corresponding test to ensure correct behavior when executing multiple inserts with only NULL values. The main focus is on handling the
SQL_C_DEFAULTtype for parameter arrays, ensuring all values are NULL, and verifying this functionality through unit testing.Parameter binding improvements:
BindParameterArrayinddbc_bindings.cppto handle theSQL_C_DEFAULTtype, ensuring that arrays of NULL values are properly bound and validated. If any non-NULL value is detected, an exception is thrown.Testing enhancements:
test_executemany_NONE_parameter_listintest_004_cursor.pyto verify thatexecutemanycorrectly inserts rows with all NULL values and that the count matches the expected number of inserts.