| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
This PR fixes microsecond loss when round-tripping SQL Server TIME/TIME2 values by switching Python datetime.time binding to a text C-type with microsecond precision and updating the C++ fetch/batch-fetch paths to parse TIME2 from text back into datetime.time.
Changes:
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/test_004_cursor.py | Adds a regression test for TIME microsecond round-trip; minor formatting updates to SQL strings. |
| mssql_python/pybind/ddbc_bindings.cpp | Adds a TIME text parser and changes SQL_SS_TIME2 retrieval/binding to use SQL_C_CHAR buffers. |
| mssql_python/cursor.py | Changes TIME parameter mapping and normalizes TIME values to microsecond ISO text in execute/executemany binding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changes
Summary
mssql_python/pybind/ddbc_bindings.cppLines 3496-3507 3496 row.append(PythonObjectCache::get_time_class()(
3497 t2.hour, t2.minute, t2.second, t2.fraction / 1000)); // ns to µs
3498 } else {
3499 if (!SQL_SUCCEEDED(ret)) {
! 3500 LOG("SQLGetData: Error retrieving SQL_SS_TIME2 for column "
! 3501 "%d - SQLRETURN=%d",
! 3502 i, ret);
! 3503 }
3504 row.append(py::none());
3505 }
3506 break;
3507 }Lines 3674-3682 3674 #endif
3675 default:
3676 std::ostringstream errorString;
3677 errorString << "Unsupported data type for column - " << columnName << ", Type - "
! 3678 << effectiveDataType << ", column ID - " << i;
3679 LOG("SQLGetData: %s", errorString.str().c_str());
3680 ThrowStdException(errorString.str());
3681 break;
3682 }📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.pybind.ddbc_bindings.h: 67.8%
mssql_python.row.py: 70.5%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.connection.connection.cpp: 75.3%
mssql_python.__init__.py: 77.3%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection_pool.cpp: 79.6%
mssql_python.connection.py: 85.2%
mssql_python.cursor.py: 86.1%🔗 Quick Links
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Work Item / Issue Reference
Summary
This pull request introduces significant improvements to how SQL TIME/TIME2 values are handled in the MSSQL Python driver, transitioning from native C-type bindings to text-based representations. The changes ensure correct parsing, binding, and conversion between SQL TIME values and Python datetime.time objects, addressing edge cases and improving compatibility.
SQL TIME/TIME2 Handling Improvements
Testing and Utilities
Miscellaneous