Issue #2454733 followup by amateescu: Add a user-space case-insensitive collation to the SQLite driver
parent
98b74d2d45
commit
2492b80255
|
@ -553,8 +553,8 @@ EOD;
|
||||||
* Returns < 0 if $str1 is less than $str2; > 0 if $str1 is greater than
|
* Returns < 0 if $str1 is less than $str2; > 0 if $str1 is greater than
|
||||||
* $str2, and 0 if they are equal.
|
* $str2, and 0 if they are equal.
|
||||||
*/
|
*/
|
||||||
public static function strCaseCmp($str1 , $str2) {
|
public static function strcasecmp($str1 , $str2) {
|
||||||
return strcmp(mb_strtoupper($str1, 'utf-8'), mb_strtoupper($str2, 'utf-8'));
|
return strcmp(static::strtoupper($str1), static::strtoupper($str2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -125,7 +125,7 @@ class Connection extends DatabaseConnection {
|
||||||
$pdo->sqliteCreateFunction('regexp', array(__CLASS__, 'sqlFunctionRegexp'));
|
$pdo->sqliteCreateFunction('regexp', array(__CLASS__, 'sqlFunctionRegexp'));
|
||||||
|
|
||||||
// Create a user-space case-insensitive collation with UTF-8 support.
|
// Create a user-space case-insensitive collation with UTF-8 support.
|
||||||
$pdo->sqliteCreateCollation('NOCASE_UTF8', array('Drupal\Component\Utility\Unicode', 'strCaseCmp'));
|
$pdo->sqliteCreateCollation('NOCASE_UTF8', array('Drupal\Component\Utility\Unicode', 'strcasecmp'));
|
||||||
|
|
||||||
// Execute sqlite init_commands.
|
// Execute sqlite init_commands.
|
||||||
if (isset($connection_options['init_commands'])) {
|
if (isset($connection_options['init_commands'])) {
|
||||||
|
|
Loading…
Reference in New Issue