mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
Refactor function calls
and make it possible to express other DISTINCT aggregates than COUNT: SUM(DISTINCT ...), etc.
This commit is contained in:
1 parent
174766925a
commit
bac7b6b0e5
6 files changed
+127
-109
No files matched your search
@@ -123,7 +123,7 @@ extension SQLQuery {
|
||||
countQuery.isDistinct = false
|
||||
switch count {
|
||||
case .all:
|
||||
countQuery = countQuery.select(.count(.allColumns))
|
||||
countQuery = countQuery.select(.countAll)
|
||||
case .distinct(let expression):
|
||||
countQuery = countQuery.select(.countDistinct(expression))
|
||||
}
|
||||
@@ -138,7 +138,7 @@ extension SQLQuery {
|
||||
// SELECT expr1, expr2, ... FROM tableName ...
|
||||
// ->
|
||||
// SELECT COUNT(*) FROM tableName ...
|
||||
let countQuery = unordered().select(SQLExpression.count(.allColumns))
|
||||
let countQuery = unordered().select(.countAll)
|
||||
return try QueryInterfaceRequest(query: countQuery).fetchOne(db)!
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user