Skip to content

Conversation

@jahnvi480
Copy link
Contributor

@jahnvi480 jahnvi480 commented Aug 22, 2025

Work Item / Issue Reference

AB#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.

@github-actions github-actions bot added the pr-size: medium Moderate update size label Aug 22, 2025
Copy link
Contributor

@sumitmsft sumitmsft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment

@github-actions github-actions bot added pr-size: medium Moderate update size and removed pr-size: medium Moderate update size labels Sep 15, 2025
@jahnvi480 jahnvi480 requested a review from sumitmsft September 17, 2025 06:14
@jahnvi480 jahnvi480 merged commit 5df084f into jahnvi/conn_getinfo Sep 18, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-size: medium Moderate update size

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants