FEAT: Support correct type handling of None parameters in parameter binding by gargsaumya · Pull Request #208 · microsoft/mssql-python
Work Item / Issue Reference
GitHub Issue: #<ISSUE_NUMBER>
Summary
This pull request adds support for using the SQLDescribeParam ODBC API to determine the correct SQL type for parameters with unknown types (such as None values), 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 call SQLDescribeParam when needed.
ODBC API Integration:
- Added the
SQLDescribeParamFunctypedef and declared/defined theSQLDescribeParam_ptrfunction pointer to enable callingSQLDescribeParamfrom the driver. [1] [2] [3] [4] [5]
Parameter Binding Improvements:
- Updated the logic in
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:
- Removed a TODO comment in
_map_sql_typeas type detection is now handled more robustly.