Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8e3a39e
FIX: Handle empty data
bewithgaurav Aug 29, 2025
08f9a4c
undo some stuff
bewithgaurav Aug 29, 2025
38381fe
0 length fix and tests
bewithgaurav Aug 29, 2025
229c957
restore condition and cleanup
bewithgaurav Aug 29, 2025
7dc1135
fixed assert
bewithgaurav Aug 29, 2025
2255e50
Merge branch 'main' into bewithgaurav/fix_blank_columns
bewithgaurav Aug 29, 2025
40a008b
Merge branch 'main' of https://github.com/microsoft/mssql-python into…
bewithgaurav Sep 1, 2025
42785d9
Merge branch 'main' into bewithgaurav/fix_blank_columns
bewithgaurav Sep 3, 2025
96e59cc
FIX: Unix handling in Executemany
bewithgaurav Sep 3, 2025
1a0275d
Merge branch 'main' of https://github.com/microsoft/mssql-python into…
bewithgaurav Sep 3, 2025
7a4ded9
Merge branch 'bewithgaurav/fix_blank_columns' of https://github.com/m…
bewithgaurav Sep 3, 2025
18c9226
tests
bewithgaurav Sep 3, 2025
28d8441
Undo binary fixes since its in another branch now
bewithgaurav Sep 3, 2025
7969a93
add edgecase test
bewithgaurav Sep 3, 2025
283a999
test cleanup
bewithgaurav Sep 3, 2025
4b708b3
test cleanup
bewithgaurav Sep 3, 2025
ecbea82
Merge branch 'main' of https://github.com/microsoft/mssql-python into…
bewithgaurav Sep 5, 2025
9ce15d0
added tests and refactored the flow
bewithgaurav Sep 5, 2025
5274291
Merge branch 'bewithgaurav/fix_blank_columns' of https://github.com/m…
bewithgaurav Sep 5, 2025
b5d7df8
IP instead of localhost inside build-whl-pipeline as well
bewithgaurav Sep 5, 2025
2c2e2b3
restored localhost commit, unrelated branch
bewithgaurav Sep 5, 2025
edeb4f6
Merge branch 'bewithgaurav/fix_blank_columns' of https://github.com/m…
bewithgaurav Sep 5, 2025
5b3805d
review changes, added a test as well
bewithgaurav Sep 5, 2025
e297276
fix problematic chars
bewithgaurav Sep 5, 2025
f434b4c
merge conflicts
bewithgaurav Sep 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions mssql_python/pybind/ddbc_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1352,11 +1352,25 @@
std::memset(wcharArray + i * (info.columnSize + 1), 0, (info.columnSize + 1) * sizeof(SQLWCHAR));
} else {
std::wstring wstr = columnValues[i].cast<std::wstring>();
#if defined(__APPLE__) || defined(__linux__)
// Convert to UTF-16 first, then check the actual UTF-16 length
auto utf16Buf = WStringToSQLWCHAR(wstr);
// Check UTF-16 length (excluding null terminator) against column size
if (utf16Buf.size() > 0 && (utf16Buf.size() - 1) > info.columnSize) {
std::string offending = WideToUTF8(wstr);
ThrowStdException("Input string UTF-16 length exceeds allowed column size at parameter index " + std::to_string(paramIndex) +
". UTF-16 length: " + std::to_string(utf16Buf.size() - 1) + ", Column size: " + std::to_string(info.columnSize));
}
// If we reach here, the UTF-16 string fits - copy it completely
std::memcpy(wcharArray + i * (info.columnSize + 1), utf16Buf.data(), utf16Buf.size() * sizeof(SQLWCHAR));
#else
// On Windows, wchar_t is already UTF-16, so the original check is sufficient
if (wstr.length() > info.columnSize) {
std::string offending = WideToUTF8(wstr);
ThrowStdException("Input string exceeds allowed column size at parameter index " + std::to_string(paramIndex));
}
std::memcpy(wcharArray + i * (info.columnSize + 1), wstr.c_str(), (wstr.length() + 1) * sizeof(SQLWCHAR));
#endif
strLenOrIndArray[i] = SQL_NTS;
}
}
Expand Down
Loading