mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-29 04:24:21 +00:00
!FetchRequest.contains()
This commit is contained in:
1 parent
17aa9350c5
commit
09c599cc62
2 files changed
+7
No files matched your search
@@ -379,6 +379,8 @@ public indirect enum _SQLExpression {
|
||||
} else {
|
||||
return try "(" + expression.sql(db, &bindings) + " NOT IN (" + expressions.map { try $0.sql(db, &bindings) }.joinWithSeparator(", ") + "))"
|
||||
}
|
||||
case .InSubQuery(let subQuery, let expression):
|
||||
return try "(" + expression.sql(db, &bindings) + " NOT IN (" + subQuery.sql(db, &bindings) + "))"
|
||||
case .Equal(let lhs, let rhs):
|
||||
return try _SQLExpression.NotEqual(lhs, rhs).sql(db, &bindings)
|
||||
case .NotEqual(let lhs, let rhs):
|
||||
|
||||
@@ -112,6 +112,11 @@ class SQLSupportTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(tableRequest.filter(tableRequest.select(Col.id).contains(Col.id))),
|
||||
"SELECT * FROM \"readers\" WHERE (\"id\" IN (SELECT \"id\" FROM \"readers\"))")
|
||||
|
||||
// Subquery
|
||||
XCTAssertEqual(
|
||||
sql(tableRequest.filter(!tableRequest.select(Col.id).contains(Col.id))),
|
||||
"SELECT * FROM \"readers\" WHERE (\"id\" NOT IN (SELECT \"id\" FROM \"readers\"))")
|
||||
}
|
||||
|
||||
func testContainsWithCollation() {
|
||||
|
||||
Reference in new issue
Block a user