1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

tweak the sql_like_expression feature a little bit to allow correct escaping

git-svn-id: file:///svn/phpbb/trunk@7789 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2007-06-24 12:49:13 +00:00
parent 318418b0f2
commit 5aa220bcd2
22 changed files with 96 additions and 53 deletions

View File

@@ -320,19 +320,12 @@ class dbal_mssql_odbc extends dbal
}
/**
* Correctly adjust LIKE expression for special characters
* MSSQL needs an escape character being defined
* Build LIKE expression
* @access private
*/
function sql_like_expression($expression)
function _sql_like_expression($expression)
{
// Standard for most DBMS
if (strpos($expression, '_') === false)
{
return 'LIKE \'' . $this->sql_escape($expression) . '\'';
}
// sql_like_expression is only allowed directly within single quotes (to ease the use of it), therefore the special writing of ESCAPE below
return 'LIKE \'' . $this->sql_escape(str_replace('_', "\_", $expression)) . "' ESCAPE '\\'";
return $expression . " ESCAPE '\\'";
}
/**