From 643a86504a30f6b9fbe0f073bb03009b4fbd0f43 Mon Sep 17 00:00:00 2001 From: Andreas Fischer <bantu@phpbb.com> 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/mssql_odbc.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/includes/db/mssql_odbc.php') diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php index 34f7a87337..2ecc42cadf 100644 --- a/phpBB/includes/db/mssql_odbc.php +++ b/phpBB/includes/db/mssql_odbc.php @@ -310,6 +310,14 @@ class dbal_mssql_odbc 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