diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2021-08-31 21:01:27 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2021-09-01 11:57:47 +0200 |
commit | ce283c12b6ba8d27dc0d2934ffe7d6f7b6743a02 (patch) | |
tree | 04a680d4bf2d42241dc5a039c7ec1c17875e6b19 /lib/private/DB/AdapterMySQL.php | |
parent | 734a750074c08051f3e24b7454f00018da868898 (diff) | |
download | nextcloud-server-ce283c12b6ba8d27dc0d2934ffe7d6f7b6743a02.tar.gz nextcloud-server-ce283c12b6ba8d27dc0d2934ffe7d6f7b6743a02.zip |
make it possible to override the default collation
- allows admins to configure it for edge cases like accent sensitivity
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib/private/DB/AdapterMySQL.php')
-rw-r--r-- | lib/private/DB/AdapterMySQL.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/private/DB/AdapterMySQL.php b/lib/private/DB/AdapterMySQL.php index 43da88b4b74..b4be5c2e96a 100644 --- a/lib/private/DB/AdapterMySQL.php +++ b/lib/private/DB/AdapterMySQL.php @@ -25,7 +25,7 @@ namespace OC\DB; class AdapterMySQL extends Adapter { /** @var string */ - protected $charset; + protected $collation; /** * @param string $tableName @@ -39,16 +39,16 @@ class AdapterMySQL extends Adapter { } public function fixupStatement($statement) { - $statement = str_replace(' ILIKE ', ' COLLATE ' . $this->getCharset() . '_general_ci LIKE ', $statement); + $statement = str_replace(' ILIKE ', ' COLLATE ' . $this->getCollation() . ' LIKE ', $statement); return $statement; } - protected function getCharset() { - if (!$this->charset) { + protected function getCollation(): string { + if (!$this->collation) { $params = $this->conn->getParams(); - $this->charset = isset($params['charset']) ? $params['charset'] : 'utf8'; + $this->collation = $params['collation'] ?? (($params['charset'] ?? 'utf8') . '_general_ci'); } - return $this->charset; + return $this->collation; } } |