FEAT: Adding getInfo by jahnvi480 · Pull Request #201 · microsoft/mssql-python

added 4 commits

August 20, 2025 14:42

sumitmsft

@jahnvi480

@jahnvi480 jahnvi480 changed the base branch from jahnvi/global_decimalseperator to main

September 18, 2025 08:32

@jahnvi480

### Work Item / Issue Reference  
<!-- 
IMPORTANT: Please follow the PR template guidelines below.
For mssql-python maintainers: Insert your ADO Work Item ID below (e.g.
AB#37452)
For external contributors: Insert Github Issue number below (e.g. #149)
Only one reference is required - either GitHub issue OR ADO Work Item.
-->

<!-- mssql-python maintainers: ADO Work Item -->
>
[AB#34909](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/34909)

-------------------------------------------------------------------
### Summary   
This pull request adds a new `searchescape` property to the `Connection`
class in `mssql_python`, which exposes the ODBC search pattern escape
character used for escaping special characters in SQL LIKE clauses. It
also introduces comprehensive tests to ensure correct and consistent
behavior of this property, including its use in various SQL queries and
its caching mechanism.

Enhancements to connection escape character handling:

* Added a `searchescape` property to the `Connection` class in
`connection.py`, which retrieves and caches the ODBC search pattern
escape character using `SQLGetInfo`, with sensible defaults and error
handling.
* Imported `GetInfoConstants` in `connection.py` to support the new
property.

Testing improvements:

* Added multiple tests in `test_003_connection.py` to verify the
`searchescape` property's basic functionality, its use in SQL LIKE
queries (with `%`, `_`, and bracket wildcards), multiple escape
scenarios, and property consistency and caching.

---------

Co-authored-by: Jahnvi Thakkar <jathakkar@microsoft.com>

Copilot AI review requested due to automatic review settings

September 18, 2025 13:22

@jahnvi480

@jahnvi480

github-advanced-security[bot]

@jahnvi480

sumitmsft

bewithgaurav