1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

Use PosgreSQL's existing general Unicode collation

All collations appear to be case-insensitive
This commit is contained in:
J. King 2018-12-14 09:18:56 -05:00
parent 17052d3232
commit 50f92625ef
3 changed files with 16 additions and 16 deletions

View file

@ -475,7 +475,8 @@ class Database {
join arsse_feeds on feed = arsse_feeds.id
left join topmost on folder=f_id"
);
$q->setOrder("pinned desc, coalesce(arsse_subscriptions.title, arsse_feeds.title) collate nocase");
$nocase = $this->db->sqlToken("nocase");
$q->setOrder("pinned desc, coalesce(arsse_subscriptions.title, arsse_feeds.title) collate $nocase");
// define common table expressions
$q->setCTE("userdata(userid)", "SELECT ?", "str", $user); // the subject user; this way we only have to pass it to prepare() once
// topmost folders belonging to the user

View file

@ -113,8 +113,13 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
}
public function sqlToken(string $token): string {
switch (strtolower($token)) {
case "nocase":
return '"und-x-icu"';
default:
return $token;
}
}
public function savepointCreate(bool $lock = false): int {
if (!$this->transStart) {

View file

@ -4,19 +4,13 @@
-- Please consult the SQLite 3 schemata for commented version
-- create a case-insensitive generic Unicode collation sequence
create collation nocase(
provider = icu,
locale = '@kf=false'
);
alter table arsse_users alter column id type text collate nocase;
alter table arsse_folders alter column name type text collate nocase;
alter table arsse_feeds alter column title type text collate nocase;
alter table arsse_subscriptions alter column title type text collate nocase;
alter table arsse_articles alter column title type text collate nocase;
alter table arsse_articles alter column author type text collate nocase;
alter table arsse_categories alter column name type text collate nocase;
alter table arsse_labels alter column name type text collate nocase;
alter table arsse_users alter column id type text collate "und-x-icu";
alter table arsse_folders alter column name type text collate "und-x-icu";
alter table arsse_feeds alter column title type text collate "und-x-icu";
alter table arsse_subscriptions alter column title type text collate "und-x-icu";
alter table arsse_articles alter column title type text collate "und-x-icu";
alter table arsse_articles alter column author type text collate "und-x-icu";
alter table arsse_categories alter column name type text collate "und-x-icu";
alter table arsse_labels alter column name type text collate "und-x-icu";
update arsse_meta set value = '3' where key = 'schema_version';