FEAT: Adding rowID and rowvVer functions #197
Merged
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 retrieving special columns from a database table using the ODBC
SQLSpecialColumnsfunction. The main changes include new methods in the Python cursor for accessing row identifier and version columns, as well as the necessary C++ and Python bindings to expose this ODBC functionality. Additionally, relevant constants have been added to support these features.New Python cursor methods:
rowIdColumnsandrowVerColumnsmethods to theCursorclass inmssql_python/cursor.py, allowing users to retrieve columns that uniquely identify a row (SQL_BEST_ROWID) and columns that are automatically updated when any value in the row is updated (SQL_ROWVER). These methods handle ODBC parameter preparation, call the new binding, and return results as row objects.ODBC and pybind11 binding support:
SQLSpecialColumnsFuncfunction pointer type and added the corresponding global pointer inmssql_python/pybind/ddbc_bindings.handmssql_python/pybind/ddbc_bindings.cpp.SQLSpecialColumnsWsymbol from the ODBC driver in the driver loader, and included it in the function pointer validation check.SQLSpecialColumns_wrapfunction to call the ODBC API, handling both Unix and Windows string conversions, and exposed it to Python asDDBCSQLSpecialColumnsin the module definition.Constants:
SQL_SCOPE_CURROW,SQL_BEST_ROWID,SQL_ROWVER,SQL_NO_NULLS, andSQL_NULLABLE_UNKNOWNto theConstantsDDBCenum inmssql_python/constants.pyto support the new functionality.