Refactor function calls

and make it possible to express other DISTINCT aggregates than COUNT: SUM(DISTINCT ...), etc.
This commit is contained in:
Gwendal Roué committed 2021-03-06 13:25:25 +01:00
1 parent 174766925a
commit bac7b6b0e5
6 files changed
+127 -109

No files matched your search

+2 -2
View File
@@ -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)!
}
}