aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/sqlite.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/db/sqlite.php')
-rw-r--r--phpBB/includes/db/sqlite.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php
index 88a0d612b4..3248b439c6 100644
--- a/phpBB/includes/db/sqlite.php
+++ b/phpBB/includes/db/sqlite.php
@@ -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);
+
+ $expression = str_replace(array('?', '*'), array("\?", "\*"), $expression);
+ $expression = str_replace(array(chr(0) . "\?", chr(0) . "\*"), array('?', '*'), $expression);
- return "GLOB '" . $this->sql_escape(str_replace('%', '*', $expression)) . "'";
+ return 'GLOB \'' . $this->sql_escape($expression) . '\'';
}
/**