mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
Deprecate SQLExpressionLiteral, hide SQLSelectionLiteral, introduce SQLLiteral.sqlExpression and .sqlSelectable
This commit is contained in:
1 parent
d7ef314a15
commit
5e67ca5566
6 files changed
+133
-110
No files matched your search
@@ -23,45 +23,6 @@ public protocol SQLSelectable {
|
||||
func qualifiedSelectable(with alias: TableAlias) -> SQLSelectable
|
||||
}
|
||||
|
||||
// MARK: - SQLSelectionLiteral
|
||||
|
||||
struct SQLSelectionLiteral: SQLSelectable {
|
||||
private let sqlLiteral: SQLLiteral
|
||||
|
||||
init(literal sqlLiteral: SQLLiteral) {
|
||||
self.sqlLiteral = sqlLiteral
|
||||
}
|
||||
|
||||
func resultColumnSQL(_ context: inout SQLGenerationContext) -> String {
|
||||
return sqlLiteral.resolve(&context)
|
||||
}
|
||||
|
||||
func countedSQL(_ context: inout SQLGenerationContext) -> String {
|
||||
fatalError("""
|
||||
Selection literals can't be counted. \
|
||||
To resolve this error, select one or several SQLExpressionLiteral instead.
|
||||
""")
|
||||
}
|
||||
|
||||
func count(distinct: Bool) -> SQLCount? {
|
||||
fatalError("""
|
||||
Selection literals can't be counted. \
|
||||
To resolve this error, select one or several SQLExpressionLiteral instead.
|
||||
""")
|
||||
}
|
||||
|
||||
func columnCount(_ db: Database) throws -> Int {
|
||||
fatalError("""
|
||||
Selection literals don't known how many columns they contain. \
|
||||
To resolve this error, select one or several SQLExpressionLiteral instead.
|
||||
""")
|
||||
}
|
||||
|
||||
func qualifiedSelectable(with alias: TableAlias) -> SQLSelectable {
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Counting
|
||||
|
||||
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
||||
|
||||
Reference in new issue
Block a user