mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 08:47:45 +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:
@@ -247,12 +247,14 @@ class dbal_sqlite extends dbal
|
||||
*/
|
||||
function sql_like_expression($expression)
|
||||
{
|
||||
if (strpos($expression, '_') === false)
|
||||
{
|
||||
return "LIKE '" . $this->sql_escape($expression) . "'";
|
||||
}
|
||||
// Unlike LIKE, GLOB is case sensitive (unfortunatly). SQLite users need to live with it!
|
||||
// We only catch * and ? here, not the character map possible on file globbing.
|
||||
$expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression);
|
||||
|
||||
return "GLOB '" . $this->sql_escape(str_replace('%', '*', $expression)) . "'";
|
||||
$expression = str_replace(array('?', '*'), array("\?", "\*"), $expression);
|
||||
$expression = str_replace(array(chr(0) . "\?", chr(0) . "\*"), array('?', '*'), $expression);
|
||||
|
||||
return 'GLOB \'' . $this->sql_escape($expression) . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user