FEAT: varcharmax streaming support in execute #206
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 focuses on improving type safety and error handling for parameter binding and execution in the MSSQL Python driver, especially for string and binary types. The changes ensure that only supported Python types are bound to SQL parameters and that errors are raised for unsupported types, preventing silent failures. Additionally, the data-at-execution (DAE) streaming path for strings is now more robust and explicit.
Parameter type safety and error handling:
_map_sql_type
incursor.py
to raise aTypeError
for unsupported parameter types instead of defaulting toSQL_VARCHAR
, preventing silent type mismatches.ddbc_bindings.cpp
, added explicit type checks forSQL_C_CHAR
andSQL_C_BINARY
bindings, raising an error if the Python object is not a string or bytes-like object.DAE (Data At Execution) streaming improvements:
SQL_C_CHAR
inddbc_bindings.cpp
to handle string parameters more robustly, including chunked streaming viaSQLPutData
.str
objects mapped toSQL_C_CHAR
, ensuring large strings are sent in manageable pieces.Platform-specific encoding for wide strings:
SQL_C_WCHAR
) parameters are correctly converted to the platform-specific encoding before streaming.