Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion mssql_python/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import atexit
from typing import Optional


# Single DEBUG level - all or nothing philosophy
# If you need logging, you need to see everything
DEBUG = logging.DEBUG # 10
Expand Down
4 changes: 2 additions & 2 deletions mssql_python/pybind/ddbc_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2892,7 +2892,7 @@ SQLRETURN SQLGetData_wrap(SqlHandlePtr StatementHandle, SQLUSMALLINT colCount, p
SQLHSTMT hStmt = StatementHandle->get();

// Cache decimal separator to avoid repeated system calls
std::string decimalSeparator = GetDecimalSeparator();


for (SQLSMALLINT i = 1; i <= colCount; ++i) {
SQLWCHAR columnName[256];
Expand Down Expand Up @@ -3615,7 +3615,7 @@ SQLRETURN FetchBatchData(SQLHSTMT hStmt, ColumnBuffers& buffers, py::list& colum
columnInfos[col].processedColumnSize + 1; // +1 for null terminator
}

std::string decimalSeparator = GetDecimalSeparator(); // Cache decimal separator


// Performance: Build function pointer dispatch table (once per batch)
// This eliminates the switch statement from the hot loop - 10,000 rows × 10
Expand Down
12 changes: 4 additions & 8 deletions tests/test_001_globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,7 @@ def test_decimal_separator_with_db_operations(db_connection):
try:
# Create a test table with decimal values
cursor = db_connection.cursor()
cursor.execute(
"""
cursor.execute("""
DROP TABLE IF EXISTS #decimal_separator_test;
CREATE TABLE #decimal_separator_test (
id INT,
Expand All @@ -400,8 +399,7 @@ def test_decimal_separator_with_db_operations(db_connection):
(2, 678.90),
(3, 0.01),
(4, 999.99);
"""
)
""")
cursor.close()

# Test 1: Fetch with default separator
Expand Down Expand Up @@ -469,8 +467,7 @@ def test_decimal_separator_batch_operations(db_connection):
try:
# Create test data
cursor = db_connection.cursor()
cursor.execute(
"""
cursor.execute("""
DROP TABLE IF EXISTS #decimal_batch_test;
CREATE TABLE #decimal_batch_test (
id INT,
Expand All @@ -481,8 +478,7 @@ def test_decimal_separator_batch_operations(db_connection):
(1, 123.456, 12345.67890),
(2, 0.001, 0.00001),
(3, 999.999, 9999.99999);
"""
)
""")
cursor.close()

# Test 1: Fetch results with default separator
Expand Down
12 changes: 4 additions & 8 deletions tests/test_003_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,16 +992,14 @@ def test_execute_with_large_parameters(db_connection, conn_str):
pytest.skip("Skipping for Azure SQL - large parameter tests may cause timeouts")

# Test with a temporary table for large data
cursor = db_connection.execute(
"""
cursor = db_connection.execute("""
DROP TABLE IF EXISTS #large_params_test;
CREATE TABLE #large_params_test (
id INT,
large_text NVARCHAR(MAX),
large_binary VARBINARY(MAX)
)
"""
)
""")
cursor.close()

try:
Expand Down Expand Up @@ -2126,12 +2124,10 @@ def test_timeout_long_query(db_connection):
while retry_count < max_retries:
start_time = time.perf_counter()
try:
cursor.execute(
"""
cursor.execute("""
SELECT COUNT(*) FROM sys.objects a, sys.objects b, sys.objects c
WHERE a.object_id = b.object_id * c.object_id
"""
)
""")
cursor.fetchall()
elapsed_time = time.perf_counter() - start_time
break # Success, exit retry loop
Expand Down
Loading
Loading