| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Fixes false positives in qmark (?) placeholder detection by making detect_and_convert_parameters() context-aware (skipping ? inside identifiers, string literals, and comments), addressing Issue #464 / AB#42937.
Changes:
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| mssql_python/parameter_helper.py | Introduces context-aware scanning helpers and updates mismatch detection to avoid false positives from ? inside quoted contexts. |
| tests/test_015_pyformat_parameters.py | Adds unit/integration tests validating the new scanning behavior and the original reported bracketed-identifier scenario. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
…, string literals, and comments
The parameter style detection used a naive '?' in sql check which falsely
flagged ? characters inside T-SQL bracketed identifiers ([q?marks]),
string literals ('is this ok?'), double-quoted identifiers, and SQL comments
as positional parameter placeholders.
Changes:
- Add _skip_quoted_context() helper to skip over SQL quoted contexts
(brackets, single/double quotes, single-line and multi-line comments)
- Add _has_unquoted_question_marks() that uses context-aware scanning
to only detect ? characters that are actual qmark placeholders
- Update detect_and_convert_parameters() to use the new context-aware check
- Add 40 new unit tests covering the helper functions and integration scenarios
Fixes: question mark in bracketed column name causes false positive
'Parameter style mismatch' error when using dict parameters.
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changes
Summary
📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.logger_bridge.hpp: 58.8%
mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.row.py: 66.2%
mssql_python.pybind.ddbc_bindings.h: 67.8%
mssql_python.pybind.ddbc_bindings.cpp: 69.7%
mssql_python.pybind.connection.connection.cpp: 75.3%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection_pool.cpp: 79.6%
mssql_python.cursor.py: 84.8%
mssql_python.__init__.py: 84.9%🔗 Quick Links
|
Sorry, something went wrong.
There was a problem hiding this comment.
need to fix an edge case
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Work Item / Issue Reference
Summary
This pull request introduces a robust fix for detecting real parameter placeholders in SQL statements, specifically addressing false positives caused by question marks inside bracketed identifiers, string literals, quoted identifiers, and comments. The changes add context-aware scanning logic and comprehensive tests, ensuring that only actual parameter placeholders are flagged and handled. This resolves a bug where SQL containing ? inside brackets (e.g., [q?marks]) would incorrectly trigger parameter mismatch errors.
Core logic improvements
Testing improvements
Test harness updates