mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-06 06:25:04 +02:00
[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
This commit is contained in:
parent
275dabbc4f
commit
643a86504a
@ -500,6 +500,18 @@ class dbal
|
||||
return $column_name . ' | ' . (1 << $bit) . (($compare) ? ' ' . $compare : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run LOWER() on DB column of type text (i.e. neither varchar nor char).
|
||||
*
|
||||
* @param string $column_name The column name to use
|
||||
*
|
||||
* @return string A SQL statement like "LOWER($column_name)"
|
||||
*/
|
||||
function sql_lower_text($column_name)
|
||||
{
|
||||
return "LOWER($column_name)";
|
||||
}
|
||||
|
||||
/**
|
||||
* Run more than one insert statement.
|
||||
*
|
||||
|
@ -332,6 +332,14 @@ class dbal_mssql 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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user