Page MenuHomePhabricator

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


Author: emadelwany

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


Revisions and Commits

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:51 AM
bzimport added a project: Wikimedia-Rdbms.
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.

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

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