mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-30 04:28:44 +00:00
Simplify handling of collated expressions
This commit is contained in:
1 parent
fcff9b34ba
commit
c4f9ddd688
10 files changed
+64
-346
No files matched your search
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user