Simplify handling of collated expressions

This commit is contained in:
Gwendal Roué committed 2021-03-27 16:34:37 +01:00
1 parent fcff9b34ba
commit c4f9ddd688
10 files changed
+64 -346

No files matched your search

+5 -8
View File
@@ -103,15 +103,12 @@ extension SQLCollection {
guard let expression = expressions.first else {
return false.sqlExpression
}
// With SQLite, `expr IN (NULL)` never succeeds.
//
// We must not provide special handling of NULL, because we can not
// guess if our `expressions` array contains a value evaluates to NULL.
if expressions.count == 1 {
// Output `expr = value` instead of `expr IN (value)`, because it
// looks nicer. And make sure we do not produce 'expr IS NULL'.
// Output `value = expression` instead of `value IN (expression)`,
// because it looks nicer. Force the equal `=` operator, so that
// the result evaluates just as `value IN (expression)`, even
// if expression is NULL.
return .compare(.equal, value, expression)
}