Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes empty data handling in the DDBC bindings by properly handling cases where SQL data has zero length. The change ensures that empty strings are correctly processed instead of being incorrectly handled by existing assertion logic.
- Added explicit handling for zero-length data in
SQLGetData_wrapfunction - Updated assertion to allow zero-length data in
FetchBatchDatafunction
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
gargsaumya
previously approved these changes
Sep 4, 2025
sumitmsft
reviewed
Sep 4, 2025
sumitmsft
reviewed
Sep 4, 2025
sumitmsft
reviewed
Sep 4, 2025
sumitmsft
requested changes
Sep 4, 2025
Contributor
sumitmsft
left a comment
There was a problem hiding this comment.
@bewithgaurav Left a few comments. Please see if we can fix them
… bewithgaurav/fix_blank_columns
gargsaumya
approved these changes
Sep 5, 2025
sumitmsft
approved these changes
Sep 5, 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 improves the handling of empty string and binary values in the MSSQL Python bindings, ensuring that empty data is correctly distinguished from NULL values and does not cause assertion failures. It also adds comprehensive tests to verify correct behavior for these edge cases.
Improvements to empty value handling:
SQLGetData_wrapinddbc_bindings.cppto append an empty string ("") or empty bytes (b"") when the returned data length is zero, instead of causing assertion failures or misinterpreting the value as NULL. This change applies to both string and binary column types. [1] [2] [3]FetchBatchDatato allow zero-length data, ensuring that empty values are handled gracefully instead of triggering errors.Testing improvements:
tests/test_004_cursor.pyto verify correct handling of empty strings and binary data, including distinguishing empty values from NULLs, batch fetching, and various edge cases for empty strings. These tests ensure that the fixes work as intended and prevent regressions.Minor code cleanup:
ddbc_bindings.cppfor better code clarity.