MS SQL Driver doesn't handle escaping for LIKE patterns correctly
Closed, ResolvedPublic

Description

Author: emadelwany

Description:
MS SQL requires specifying the escape character in the query using the ESCAPE directive. The way it is currently handled leads to incorrect escaping, for example, simpleSearch doesn't work since the backend query contains something like:

"...page_title LIKE '%foo\_bar'%..." which works for most DB's, but MS SQL requires:
"...page_title LIKE '%foo\_bar'% ESCAPE '\'..."

This is breaking various functions around the code base that expect LIKE queries to work correctly.


Version: 1.25-git
Severity: normal

bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz71207.
bzimport added a subscriber: Unknown Object (MLST).

gerritadmin wrote:

Change 162508 had a related patch set uploaded by Emadelwany:
Add ESCAPE identifier to MS SQL LIKE queries so that the escaping would work as expected.

https://gerrit.wikimedia.org/r/162508

Change 162508 had a related patch set uploaded (by Legoktm):
Fix escaping for MSSQL LIKE queries.

https://gerrit.wikimedia.org/r/162508

Change 162508 merged by jenkins-bot:
Fix escaping for MSSQL LIKE queries.

https://gerrit.wikimedia.org/r/162508