Skip to content

Commit f259d76

Browse files
committed
add support for unicode NOCASE comparisons with the built-in SQLite
see #155
1 parent 9089e64 commit f259d76

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/webserver/database/connect.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,7 @@ fn set_custom_connect_options(options: &mut AnyConnectOptions, config: &AppConfi
127127
log::info!("Loading SQLite extension: {}", extension_name);
128128
*sqlite_options = std::mem::take(sqlite_options).extension(extension_name.clone());
129129
}
130+
*sqlite_options = std::mem::take(sqlite_options)
131+
.collation("NOCASE", |a, b| a.to_lowercase().cmp(&b.to_lowercase()));
130132
}
131133
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- Checks that the NOCASE collation is working correctly with unicode characters.
2+
select 'text' as component,
3+
case
4+
when 'é' = 'É' COLLATE NOCASE then 'It works !'
5+
else 'It failed ! Expected "é" = "É" COLLATE NOCASE.'
6+
end as contents;

0 commit comments

Comments
 (0)