mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-29 04:24:21 +00:00
Add failing tests for Reader.select(Col.name).distinct.fetchCount(db)
This commit is contained in:
1 parent
cdc102de70
commit
de9d8e65bb
3 files changed
+29
-1
No files matched your search
@@ -11,7 +11,7 @@
|
||||
- [ ] REGEXP https://www.sqlite.org/lang_expr.html
|
||||
- [ ] CASE x WHEN w1 THEN r1 WHEN w2 THEN r2 ELSE r3 END https://www.sqlite.org/lang_expr.html
|
||||
- [ ] EXISTS https://www.sqlite.org/lang_expr.html
|
||||
|
||||
- [ ] Person.select(Col.name).distinct.fetchCount(db)
|
||||
|
||||
Not sure:
|
||||
|
||||
|
||||
@@ -105,6 +105,20 @@ class FetchRequestTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchCountWithCustomSelect() {
|
||||
dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(tableRequest.select(Col.name).fetchCount(db), 0)
|
||||
XCTAssertEqual(self.lastSQLQuery, "SELECT COUNT(\"name\") FROM \"readers\"")
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchCountDistinctWithCustomSelect() {
|
||||
dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(tableRequest.select(Col.name).distinct.fetchCount(db), 0)
|
||||
XCTAssertEqual(self.lastSQLQuery, "SELECT COUNT(DISTINCT \"name\") FROM \"readers\"")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Select
|
||||
|
||||
|
||||
@@ -60,6 +60,20 @@ class TableMappingFetchRequestTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchCountWithCustomSelect() {
|
||||
dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(Reader.select(Col.name).fetchCount(db), 0)
|
||||
XCTAssertEqual(self.lastSQLQuery, "SELECT COUNT(\"name\") FROM \"readers\"")
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchCountDistinctWithCustomSelect() {
|
||||
dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(Reader.select(Col.name).distinct.fetchCount(db), 0)
|
||||
XCTAssertEqual(self.lastSQLQuery, "SELECT COUNT(DISTINCT \"name\") FROM \"readers\"")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Select
|
||||
|
||||
|
||||
Reference in new issue
Block a user