mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-30 04:28:44 +00:00
Xcode 12.3 formatting
This commit is contained in:
1 parent
3a76b84eae
commit
836efb120f
70 files changed
+612
-634
No files matched your search
@@ -39,7 +39,7 @@ struct SQLExpressionNot: SQLExpression {
|
||||
|
||||
case .false:
|
||||
return SQLExpressionEqual(.equal, self, false.sqlExpression)
|
||||
|
||||
|
||||
case .falsey:
|
||||
// Support `NOT (NOT expression)` as a technique to build 0 or 1
|
||||
return SQLExpressionNot(self)
|
||||
@@ -726,10 +726,9 @@ struct SQLExpressionContains: SQLExpression {
|
||||
}
|
||||
|
||||
func _identifyingRowIDs(_ db: Database, for alias: TableAlias) throws -> Set<Int64>? {
|
||||
if
|
||||
let expressions = collection._collectionExpressions,
|
||||
let column = try expression._column(db, for: alias),
|
||||
try db.columnIsRowID(column, of: alias.tableName)
|
||||
if let expressions = collection._collectionExpressions,
|
||||
let column = try expression._column(db, for: alias),
|
||||
try db.columnIsRowID(column, of: alias.tableName)
|
||||
{
|
||||
return Set(expressions.compactMap {
|
||||
($0 as? DatabaseValue).flatMap { Int64.fromDatabaseValue($0) }
|
||||
@@ -776,7 +775,7 @@ struct SQLExpressionContains: SQLExpression {
|
||||
}
|
||||
|
||||
if let expressions = collection._collectionExpressions,
|
||||
expressions.contains(where: \._isAggregate)
|
||||
expressions.contains(where: \._isAggregate)
|
||||
{
|
||||
// SELECT expr IN (aggregate, ...)
|
||||
return true
|
||||
@@ -914,9 +913,8 @@ struct SQLExpressionFunction: SQLExpression {
|
||||
|
||||
var _isConstantInRequest: Bool {
|
||||
let function = self.function.uppercased()
|
||||
guard
|
||||
((function == "MAX" || function == "MIN") && arguments.count > 1)
|
||||
|| Self.knownPureFunctions.contains(function)
|
||||
guard ((function == "MAX" || function == "MIN") && arguments.count > 1)
|
||||
|| Self.knownPureFunctions.contains(function)
|
||||
else {
|
||||
return false // Don't know - assume not constant
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public protocol _SQLExpression {
|
||||
///
|
||||
/// This property supports `_identifyingColums(_:for:)`
|
||||
var _isConstantInRequest: Bool { get }
|
||||
|
||||
|
||||
/// Returns true iff the expression is trivially true.
|
||||
///
|
||||
/// When in doubt, returns false.
|
||||
@@ -213,7 +213,7 @@ extension SQLExpression {
|
||||
|
||||
/// :nodoc:
|
||||
public var _isConstantInRequest: Bool { false }
|
||||
|
||||
|
||||
/// :nodoc:
|
||||
public var _isTrue: Bool { false }
|
||||
|
||||
@@ -236,7 +236,7 @@ extension SQLExpression {
|
||||
|
||||
/// :nodoc:
|
||||
public func _columnCount(_ db: Database) throws -> Int { 1 }
|
||||
|
||||
|
||||
/// :nodoc:
|
||||
public func _count(distinct: Bool) -> _SQLCount? {
|
||||
if distinct {
|
||||
|
||||
@@ -138,7 +138,7 @@ extension SQLQuery {
|
||||
return try QueryInterfaceRequest(query: countQuery).fetchOne(db)!
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// SELECT COUNT(*) FROM (self)
|
||||
func fetchTrivialCount(_ db: Database) throws -> Int {
|
||||
let request = QueryInterfaceRequest<Void>(query: unordered())
|
||||
|
||||
@@ -368,11 +368,11 @@ extension SQLRelation {
|
||||
|
||||
func removingChildrenForPrefetchedAssociations() -> Self {
|
||||
filteringChildren {
|
||||
switch $0.kind {
|
||||
case .allPrefetched, .allNotPrefetched: return false
|
||||
case .oneRequired, .oneOptional: return true
|
||||
}
|
||||
}
|
||||
switch $0.kind {
|
||||
case .allPrefetched, .allNotPrefetched: return false
|
||||
case .oneRequired, .oneOptional: return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ struct SQLRowValue: SQLExpression {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
func _qualifiedExpression(with alias: TableAlias) -> SQLExpression {
|
||||
SQLRowValue(expressions.map { $0._qualifiedExpression(with: alias) })
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ struct SQLQualifiedAllColumns: SQLSelectable {
|
||||
}
|
||||
|
||||
func _count(distinct: Bool) -> _SQLCount? { nil }
|
||||
|
||||
|
||||
func _countedSQL(_ context: SQLGenerationContext) throws -> String {
|
||||
if context.qualifier(for: alias) != nil {
|
||||
// SELECT COUNT(t.*) is invalid SQL
|
||||
@@ -143,7 +143,7 @@ struct SQLAliasedExpression: SQLSelectable {
|
||||
self.expression = expression
|
||||
self.name = name
|
||||
}
|
||||
|
||||
|
||||
func _columnCount(_ db: Database) throws -> Int { 1 }
|
||||
|
||||
func _count(distinct: Bool) -> _SQLCount? {
|
||||
|
||||
@@ -19,7 +19,7 @@ public protocol _SQLSelectable {
|
||||
/// - parameter context: An SQL generation context which accepts
|
||||
/// statement arguments.
|
||||
func _countedSQL(_ context: SQLGenerationContext) throws -> String
|
||||
|
||||
|
||||
/// Returns true if the selectable is an aggregate.
|
||||
///
|
||||
/// When in doubt, returns false.
|
||||
|
||||
Reference in new issue
Block a user