aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/mssql.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/db/mssql.php')
-rw-r--r--phpBB/includes/db/mssql.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php
index 44ea132a8f..ba8e8681ec 100644
--- a/phpBB/includes/db/mssql.php
+++ b/phpBB/includes/db/mssql.php
@@ -309,6 +309,22 @@ class dbal_mssql extends dbal
}
/**
+ * Correctly adjust LIKE expression for special characters
+ * MSSQL needs an escape character being defined
+ */
+ 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 sql error array
* @access private
*/