Skip to content

Commit 93721b1

Browse files
committed
code review comment
1 parent daf1e96 commit 93721b1

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

mssql_python/pybind/ddbc_bindings.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,16 +2437,10 @@ SQLRETURN BindParameterArray(SQLHANDLE hStmt, const py::list& columnwise_params,
24372437
}
24382438
case SQL_C_DEFAULT: {
24392439
// Handle NULL parameters - all values in this column should be NULL
2440+
// The upstream Python type detection (via _compute_column_type) ensures
2441+
// SQL_C_DEFAULT is only used when all values are None
24402442
LOG("BindParameterArray: Binding SQL_C_DEFAULT (NULL) array - param_index=%d, count=%zu", paramIndex, paramSetSize);
24412443

2442-
// Verify all values are indeed NULL
2443-
for (size_t i = 0; i < paramSetSize; ++i) {
2444-
if (!columnValues[i].is_none()) {
2445-
LOG("BindParameterArray: SQL_C_DEFAULT non-NULL value detected - param_index=%d, row=%zu", paramIndex, i);
2446-
ThrowStdException("SQL_C_DEFAULT (99) should only be used for NULL parameters at index " + std::to_string(paramIndex));
2447-
}
2448-
}
2449-
24502444
// For NULL parameters, we need to allocate a minimal buffer and set all indicators to SQL_NULL_DATA
24512445
// Use SQL_C_CHAR as a safe default C type for NULL values
24522446
char* nullBuffer = AllocateParamBufferArray<char>(tempBuffers, paramSetSize);
@@ -2459,7 +2453,7 @@ SQLRETURN BindParameterArray(SQLHANDLE hStmt, const py::list& columnwise_params,
24592453

24602454
dataPtr = nullBuffer;
24612455
bufferLength = 1;
2462-
LOG("BindParameterArray: SQL_C_DEFAULT bound - param_index=%d, all_null=true", paramIndex);
2456+
LOG("BindParameterArray: SQL_C_DEFAULT bound - param_index=%d", paramIndex);
24632457
break;
24642458
}
24652459
default: {

0 commit comments

Comments
 (0)