From 643a86504a30f6b9fbe0f073bb03009b4fbd0f43 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 31 May 2012 11:44:41 +0200 Subject: [ticket/10751] Add sql_lower_text() to database abstraction layer. On MSSQL, LOWER() can only be called on bounded strings (i.e. varchar or char). So, in order to use it on a text column, we have to convert it to an appropriate type. We do so using the SUBSTRING function. PHPBB3-10751 --- phpBB/includes/db/mssqlnative.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/includes/db/mssqlnative.php') diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php index 92ac9b1fb9..c91cc188b0 100644 --- a/phpBB/includes/db/mssqlnative.php +++ b/phpBB/includes/db/mssqlnative.php @@ -492,6 +492,14 @@ class dbal_mssqlnative extends dbal return str_replace(array("'", "\0"), array("''", ''), $msg); } + /** + * {@inheritDoc} + */ + function sql_lower_text($column_name) + { + return "LOWER(SUBSTRING($column_name, 1, DATALENGTH($column_name)))"; + } + /** * Build LIKE expression * @access private -- cgit v1.2.1