FEAT: Support correct type handling of None parameters in parameter binding#208
Merged
gargsaumya merged 5 commits intomainfrom Sep 1, 2025
Merged
FEAT: Support correct type handling of None parameters in parameter binding#208gargsaumya merged 5 commits intomainfrom
gargsaumya merged 5 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for using the ODBC SQLDescribeParam API to properly handle parameter binding for None values, particularly improving type detection for binary columns. Previously, None parameters used a default SQL type which could cause issues with binary columns.
- Added ODBC
SQLDescribeParamfunction pointer integration to query parameter metadata - Updated parameter binding logic to call
SQLDescribeParamwhen parameter type is unknown - Removed TODO comment related to binary column handling since the issue is now resolved
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| mssql_python/pybind/ddbc_bindings.h | Added SQLDescribeParam function typedef and pointer declaration |
| mssql_python/pybind/ddbc_bindings.cpp | Implemented SQLDescribeParam loading and parameter binding logic using the API |
| mssql_python/cursor.py | Removed TODO comment about adding SQLDescribeParam support |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
c3185ed to
0b7e699
Compare
bewithgaurav
approved these changes
Aug 29, 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.
Work Item / Issue Reference
Summary
This pull request adds support for using the
SQLDescribeParamODBC API to determine the correct SQL type for parameters with unknown types (such asNonevalues), improving parameter binding accuracy—especially for binary columns. The changes include adding the necessary function pointer, loading it from the driver, and updating the parameter binding logic to callSQLDescribeParamwhen needed.ODBC API Integration:
SQLDescribeParamFunctypedef and declared/defined theSQLDescribeParam_ptrfunction pointer to enable callingSQLDescribeParamfrom the driver. [1] [2] [3] [4] [5]Parameter Binding Improvements:
BindParametersto callSQLDescribeParamfor parameters with unknown types, ensuring correct SQL type, column size, and decimal digits are used forNonevalues and improving support for binary columns.Minor Cleanups:
_map_sql_typeas type detection is now handled more robustly.