diff --git a/GRDB.xcodeproj/project.pbxproj b/GRDB.xcodeproj/project.pbxproj index 5a20e3e81..09785bcf6 100755 --- a/GRDB.xcodeproj/project.pbxproj +++ b/GRDB.xcodeproj/project.pbxproj @@ -191,9 +191,6 @@ 5653EB0F20944C7C00F46237 /* AssociationRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EAFC20944C7B00F46237 /* AssociationRequest.swift */; }; 5653EB1020944C7C00F46237 /* AssociationRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EAFC20944C7B00F46237 /* AssociationRequest.swift */; }; 5653EB1120944C7C00F46237 /* AssociationRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EAFC20944C7B00F46237 /* AssociationRequest.swift */; }; - 5653EB1220944C7C00F46237 /* AssociationMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EAFD20944C7B00F46237 /* AssociationMapping.swift */; }; - 5653EB1320944C7C00F46237 /* AssociationMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EAFD20944C7B00F46237 /* AssociationMapping.swift */; }; - 5653EB1420944C7C00F46237 /* AssociationMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EAFD20944C7B00F46237 /* AssociationMapping.swift */; }; 5653EB1520944C7C00F46237 /* AssociationQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EAFE20944C7C00F46237 /* AssociationQuery.swift */; }; 5653EB1620944C7C00F46237 /* AssociationQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EAFE20944C7C00F46237 /* AssociationQuery.swift */; }; 5653EB1720944C7C00F46237 /* AssociationQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EAFE20944C7C00F46237 /* AssociationQuery.swift */; }; @@ -883,7 +880,6 @@ 5653EAFA20944C7B00F46237 /* Association.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Association.swift; sourceTree = ""; }; 5653EAFB20944C7B00F46237 /* HasManyAssociation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HasManyAssociation.swift; sourceTree = ""; }; 5653EAFC20944C7B00F46237 /* AssociationRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationRequest.swift; sourceTree = ""; }; - 5653EAFD20944C7B00F46237 /* AssociationMapping.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationMapping.swift; sourceTree = ""; }; 5653EAFE20944C7C00F46237 /* AssociationQuery.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationQuery.swift; sourceTree = ""; }; 5653EAFF20944C7C00F46237 /* ForeignKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ForeignKey.swift; sourceTree = ""; }; 5653EB0220944C7C00F46237 /* HasOneAssociation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HasOneAssociation.swift; sourceTree = ""; }; @@ -1425,7 +1421,6 @@ isa = PBXGroup; children = ( 5653EAFA20944C7B00F46237 /* Association.swift */, - 5653EAFD20944C7B00F46237 /* AssociationMapping.swift */, 5653EAFE20944C7C00F46237 /* AssociationQuery.swift */, 5653EAFC20944C7B00F46237 /* AssociationRequest.swift */, 5653EAF820944C7B00F46237 /* BelongsToAssociation.swift */, @@ -2365,7 +2360,6 @@ 565490CC1D5AE252005622CB /* (null) in Sources */, 56BF6D351DEF47DA006039A3 /* Fixits-0-84-0.swift in Sources */, 566B91291FA4CF810012D5B0 /* Database+Schema.swift in Sources */, - 5653EB1420944C7C00F46237 /* AssociationMapping.swift in Sources */, 5671FC261DA3CAC9003BF4FF /* FTS3TokenizerDescriptor.swift in Sources */, 56CEB5521EAA359A00BFAF62 /* SQLExpressible.swift in Sources */, 565490DB1D5AE252005622CB /* SQLCollatedExpression.swift in Sources */, @@ -2491,7 +2485,6 @@ 56A238881B9C75030082EB20 /* Row.swift in Sources */, 56CEB4F41EAA2EFA00BFAF62 /* FetchableRecord.swift in Sources */, 569531201C907A8C00CF1A2B /* DatabaseSchemaCache.swift in Sources */, - 5653EB1320944C7C00F46237 /* AssociationMapping.swift in Sources */, 5605F15E1C672E4000235C62 /* DatabaseDateComponents.swift in Sources */, 56BF6D391DEF47DA006039A3 /* Fixits-0-90-1.swift in Sources */, 563363C11C942C04000BE133 /* DatabaseReader.swift in Sources */, @@ -2945,7 +2938,6 @@ 56A238831B9C75030082EB20 /* DatabaseQueue.swift in Sources */, 569A98ED2039B6F3008D7DBF /* Fixits-3.0.swift in Sources */, 5605F1671C672E4000235C62 /* NSNumber.swift in Sources */, - 5653EB1220944C7C00F46237 /* AssociationMapping.swift in Sources */, C96C0F2B2084A442006B2981 /* SQLiteDateParser.swift in Sources */, 56A238871B9C75030082EB20 /* Row.swift in Sources */, 5653EB2120944C7C00F46237 /* HasOneAssociation.swift in Sources */, diff --git a/GRDB/QueryInterface/Association/Association.swift b/GRDB/QueryInterface/Association/Association.swift index 12f190748..c0c1d1883 100644 --- a/GRDB/QueryInterface/Association/Association.swift +++ b/GRDB/QueryInterface/Association/Association.swift @@ -50,7 +50,7 @@ public protocol Association: SelectionRequest, FilteredRequest, OrderedRequest { var request: AssociationRequest { get } /// :nodoc: - func associationMapping(_ db: Database) throws -> AssociationMapping + func joinCondition(_ db: Database) throws -> JoinCondition /// :nodoc: func mapRequest(_ transform: (AssociationRequest) -> AssociationRequest) -> Self @@ -141,51 +141,26 @@ extension Association { } } -/// Not to be mismatched with SQL join operators (inner join, left join). -/// -/// AssociationChainOperator is designed to be hierarchically nested, unlike -/// SQL join operators. -/// -/// Consider the following request for (A, B, C) tuples: -/// -/// let r = A.including(optional: A.b.including(required: B.c)) -/// -/// It chains three associations, the first optional, the second required. -/// -/// It looks like it means: "Give me all As, along with their Bs, granted those -/// Bs have their Cs. For As whose B has no C, give me a nil B". -/// -/// It can not be expressed as one left join, and a regular join, as below, -/// Because this would not honor the first optional: -/// -/// -- dubious -/// SELECT a.*, b.*, c.* -/// FROM a -/// LEFT JOIN b ON ... -/// JOIN c ON ... -/// -/// Instead, it should: -/// - allow (A + missing (B + C)) -/// - prevent (A + (B + missing C)). -/// -/// This can be expressed in SQL with two left joins, and an extra condition: -/// -/// -- likely correct -/// SELECT a.*, b.*, c.* -/// FROM a -/// LEFT JOIN b ON ... -/// LEFT JOIN c ON ... -/// WHERE NOT((b.id IS NOT NULL) AND (c.id IS NULL)) -- no B without C -/// -/// This is currently not implemented, and requires a little more thought. -/// I don't even know if inventing a whole new way to perform joins should even -/// be on the table. But we have a hierarchical way to express joined queries, -/// and they have a meaning: -/// -/// // what is my meaning? -/// A.including(optional: A.b.including(required: B.c)) -enum AssociationChainOperator { - case required, optional +public typealias JoinCondition = (_ leftQualifier: SQLTableQualifier, _ rightQualifier: SQLTableQualifier) -> SQLExpression? + +struct ForeignKeyJoinConditionRequest { + var foreignKeyRequest: ForeignKeyRequest + var originIsLeft: Bool + + func fetch(_ db: Database) throws -> JoinCondition { + let foreignKeyMapping = try foreignKeyRequest.fetch(db).mapping + let columnMapping: [(left: Column, right: Column)] + if originIsLeft { + columnMapping = foreignKeyMapping.map { (left: Column($0.origin), right: Column($0.destination)) } + } else { + columnMapping = foreignKeyMapping.map { (left: Column($0.destination), right: Column($0.origin)) } + } + return { (leftQualifier, rightQualifier) in + return columnMapping + .map { $0.right.qualifiedExpression(with: rightQualifier) == $0.left.qualifiedExpression(with: leftQualifier) } + .joined(operator: .and) + } + } } extension Association { @@ -193,27 +168,46 @@ extension Association { /// associated record are selected. The returned association does not /// require that the associated database table contains a matching row. public func including(optional association: A) -> Self where A.LeftAssociated == RightAssociated { - return mapRequest { $0.chain(.optional, association) } + return mapRequest { $0.joining(.optional, association) } } /// Creates an association that includes another one. The columns of the /// associated record are selected. The returned association requires /// that the associated database table contains a matching row. public func including(required association: A) -> Self where A.LeftAssociated == RightAssociated { - return mapRequest { $0.chain(.required, association) } + return mapRequest { $0.joining(.required, association) } } /// Creates an association that joins another one. The columns of the /// associated record are not selected. The returned association does not /// require that the associated database table contains a matching row. public func joining(optional association: A) -> Self where A.LeftAssociated == RightAssociated { - return mapRequest { $0.chain(.optional, association.select([])) } + return mapRequest { $0.joining(.optional, association.select([])) } } /// Creates an association that joins another one. The columns of the /// associated record are not selected. The returned association requires /// that the associated database table contains a matching row. public func joining(required association: A) -> Self where A.LeftAssociated == RightAssociated { - return mapRequest { $0.chain(.required, association.select([])) } + return mapRequest { $0.joining(.required, association.select([])) } + } +} + +extension Association where LeftAssociated: MutablePersistableRecord { + func request(from record: LeftAssociated) -> QueryInterfaceRequest { + let query = request.query.qualifiedQuery // make sure query has a qualifier + let associationQualifier = query.qualifier! + let recordQualifier = SQLTableQualifier.init(tableName: LeftAssociated.databaseTableName) + + // Turn `right.id = left.id` into `right.id = 1` + let resolvedQuery = query.filter { db in + guard let joinCondition = try self.joinCondition(db)(recordQualifier, associationQualifier) else { + fatalError("Can't request from record without association mapping") + } + let container = PersistenceContainer(record) // support for record classes: late construction of container + return joinCondition.resolvedExpression(inContext: [recordQualifier: container]) + } + + return QueryInterfaceRequest(query: QueryInterfaceQuery(resolvedQuery)) } } diff --git a/GRDB/QueryInterface/Association/AssociationMapping.swift b/GRDB/QueryInterface/Association/AssociationMapping.swift deleted file mode 100644 index a75c01494..000000000 --- a/GRDB/QueryInterface/Association/AssociationMapping.swift +++ /dev/null @@ -1,23 +0,0 @@ -public typealias AssociationMapping = (SQLTableQualifier, SQLTableQualifier) -> SQLExpression? - -enum AssociationMappingRequest { - case foreignKey(request: ForeignKeyRequest, originIsLeft: Bool) - - func fetch(_ db: Database) throws -> AssociationMapping { - switch self { - case .foreignKey(request: let foreignKeyRequest, originIsLeft: let originIsLeft): - let foreignKeyMapping = try foreignKeyRequest.fetch(db).mapping - let columnMapping: [(left: Column, right: Column)] - if originIsLeft { - columnMapping = foreignKeyMapping.map { (left: Column($0.origin), right: Column($0.destination)) } - } else { - columnMapping = foreignKeyMapping.map { (left: Column($0.destination), right: Column($0.origin)) } - } - return { (leftQualifier, rightQualifier) in - return columnMapping - .map { $0.right.qualifiedExpression(with: rightQualifier) == $0.left.qualifiedExpression(with: leftQualifier) } - .joined(operator: .and) - } - } - } -} diff --git a/GRDB/QueryInterface/Association/AssociationRequest.swift b/GRDB/QueryInterface/Association/AssociationRequest.swift index af8046401..2b3b3a568 100644 --- a/GRDB/QueryInterface/Association/AssociationRequest.swift +++ b/GRDB/QueryInterface/Association/AssociationRequest.swift @@ -38,15 +38,15 @@ extension AssociationRequest { return AssociationRequest(query: query.qualified(with: &alias.qualifier)) } - func chain(_ chainOp: AssociationChainOperator, _ association: A) + func joining(_ joinOperator: AssociationJoinOperator, _ association: A) -> AssociationRequest where A.LeftAssociated == T { let join = AssociationJoin( - op: chainOp, + joinOperator: joinOperator, query: association.request.query, key: association.key, - associationMapping: association.associationMapping) + joinConditionPromise: association.joinCondition) return AssociationRequest(query: query.joining(join)) } } diff --git a/GRDB/QueryInterface/Association/BelongsToAssociation.swift b/GRDB/QueryInterface/Association/BelongsToAssociation.swift index 4b66eba1d..7a6623eaa 100644 --- a/GRDB/QueryInterface/Association/BelongsToAssociation.swift +++ b/GRDB/QueryInterface/Association/BelongsToAssociation.swift @@ -22,10 +22,8 @@ public struct BelongsToAssociation : Association, TableRequest wher } /// :nodoc: - public func associationMapping(_ db: Database) throws -> AssociationMapping { - return try AssociationMappingRequest - .foreignKey(request: foreignKeyRequest, originIsLeft: true) - .fetch(db) + public func joinCondition(_ db: Database) throws -> JoinCondition { + return try ForeignKeyJoinConditionRequest(foreignKeyRequest: foreignKeyRequest, originIsLeft: true).fetch(db) } /// :nodoc: diff --git a/GRDB/QueryInterface/Association/HasManyAssociation.swift b/GRDB/QueryInterface/Association/HasManyAssociation.swift index a61dca186..4c9d88edf 100644 --- a/GRDB/QueryInterface/Association/HasManyAssociation.swift +++ b/GRDB/QueryInterface/Association/HasManyAssociation.swift @@ -22,10 +22,8 @@ public struct HasManyAssociation : Association, TableRequest where } /// :nodoc: - public func associationMapping(_ db: Database) throws -> AssociationMapping { - return try AssociationMappingRequest - .foreignKey(request: foreignKeyRequest, originIsLeft: false) - .fetch(db) + public func joinCondition(_ db: Database) throws -> JoinCondition { + return try ForeignKeyJoinConditionRequest(foreignKeyRequest: foreignKeyRequest, originIsLeft: false).fetch(db) } /// :nodoc: diff --git a/GRDB/QueryInterface/Association/HasOneAssociation.swift b/GRDB/QueryInterface/Association/HasOneAssociation.swift index 22c8dbb6f..b3c70de9e 100644 --- a/GRDB/QueryInterface/Association/HasOneAssociation.swift +++ b/GRDB/QueryInterface/Association/HasOneAssociation.swift @@ -22,10 +22,8 @@ public struct HasOneAssociation : Association, TableRequest where } /// :nodoc: - public func associationMapping(_ db: Database) throws -> AssociationMapping { - return try AssociationMappingRequest - .foreignKey(request: foreignKeyRequest, originIsLeft: false) - .fetch(db) + public func joinCondition(_ db: Database) throws -> JoinCondition { + return try ForeignKeyJoinConditionRequest(foreignKeyRequest: foreignKeyRequest, originIsLeft: false).fetch(db) } /// :nodoc: diff --git a/GRDB/QueryInterface/QueryInterfaceQuery.swift b/GRDB/QueryInterface/QueryInterfaceQuery.swift index f0fc04037..598c6e28f 100644 --- a/GRDB/QueryInterface/QueryInterfaceQuery.swift +++ b/GRDB/QueryInterface/QueryInterfaceQuery.swift @@ -414,16 +414,63 @@ extension QueryInterfaceQuery { // MARK: - AssociationJoin +/// Not to be mismatched with SQL join operators (inner join, left join). +/// +/// AssociationJoinOperator is designed to be hierarchically nested, unlike +/// SQL join operators. +/// +/// Consider the following request for (A, B, C) tuples: +/// +/// let r = A.including(optional: A.b.including(required: B.c)) +/// +/// It chains three associations, the first optional, the second required. +/// +/// It looks like it means: "Give me all As, along with their Bs, granted those +/// Bs have their Cs. For As whose B has no C, give me a nil B". +/// +/// It can not be expressed as one left join, and a regular join, as below, +/// Because this would not honor the first optional: +/// +/// -- dubious +/// SELECT a.*, b.*, c.* +/// FROM a +/// LEFT JOIN b ON ... +/// JOIN c ON ... +/// +/// Instead, it should: +/// - allow (A + missing (B + C)) +/// - prevent (A + (B + missing C)). +/// +/// This can be expressed in SQL with two left joins, and an extra condition: +/// +/// -- likely correct +/// SELECT a.*, b.*, c.* +/// FROM a +/// LEFT JOIN b ON ... +/// LEFT JOIN c ON ... +/// WHERE NOT((b.id IS NOT NULL) AND (c.id IS NULL)) -- no B without C +/// +/// This is currently not implemented, and requires a little more thought. +/// I don't even know if inventing a whole new way to perform joins should even +/// be on the table. But we have a hierarchical way to express joined queries, +/// and they have a meaning: +/// +/// // what is my meaning? +/// A.including(optional: A.b.including(required: B.c)) +enum AssociationJoinOperator { + case required, optional +} + struct AssociationJoin { - var op: AssociationChainOperator + var joinOperator: AssociationJoinOperator var query: AssociationQuery var key: String - var associationMapping: (Database) throws -> AssociationMapping + var joinConditionPromise: (Database) throws -> JoinCondition func joinSQL(_ db: Database,_ arguments: inout StatementArguments?, leftQualifier: SQLTableQualifier, isRequiredAllowed: Bool) throws -> String { var isRequiredAllowed = isRequiredAllowed var sql = "" - switch op { + switch joinOperator { case .optional: isRequiredAllowed = false sql += "LEFT JOIN" @@ -439,7 +486,7 @@ struct AssociationJoin { let qualifier = query.qualifier! let filters = try [ - associationMapping(db)(leftQualifier, qualifier), + joinConditionPromise(db)(leftQualifier, qualifier), query.filterPromise.resolve(db) ].compactMap { $0 } if !filters.isEmpty { diff --git a/GRDB/QueryInterface/QueryInterfaceRequest+Association.swift b/GRDB/QueryInterface/QueryInterfaceRequest+Association.swift index 309da524b..4ab22160c 100644 --- a/GRDB/QueryInterface/QueryInterfaceRequest+Association.swift +++ b/GRDB/QueryInterface/QueryInterfaceRequest+Association.swift @@ -1,13 +1,13 @@ extension QueryInterfaceRequest where RowDecoder: TableRecord { - func chain(_ chainOp: AssociationChainOperator, _ association: A) + func joining(_ joinOperator: AssociationJoinOperator, _ association: A) -> QueryInterfaceRequest where A.LeftAssociated == RowDecoder { let join = AssociationJoin( - op: chainOp, + joinOperator: joinOperator, query: association.request.query, key: association.key, - associationMapping: association.associationMapping) + joinConditionPromise: association.joinCondition) return QueryInterfaceRequest(query: query.joining(join)) } @@ -16,60 +16,29 @@ extension QueryInterfaceRequest where RowDecoder: TableRecord { /// Creates a request that includes an association. The columns of the /// associated record are selected. The returned association does not /// require that the associated database table contains a matching row. - public func including(optional association: A) - -> QueryInterfaceRequest - where A.LeftAssociated == RowDecoder - { - return chain(.optional, association) + public func including(optional association: A) -> QueryInterfaceRequest where A.LeftAssociated == RowDecoder { + return joining(.optional, association) } /// Creates a request that includes an association. The columns of the /// associated record are selected. The returned association requires /// that the associated database table contains a matching row. - public func including(required association: A) - -> QueryInterfaceRequest - where A.LeftAssociated == RowDecoder - { - return chain(.required, association) + public func including(required association: A) -> QueryInterfaceRequest where A.LeftAssociated == RowDecoder { + return joining(.required, association) } /// Creates a request that includes an association. The columns of the /// associated record are not selected. The returned association does not /// require that the associated database table contains a matching row. - public func joining(optional association: A) - -> QueryInterfaceRequest - where A.LeftAssociated == RowDecoder - { - return chain(.optional, association.select([])) + public func joining(optional association: A) -> QueryInterfaceRequest where A.LeftAssociated == RowDecoder { + return joining(.optional, association.select([])) } /// Creates a request that includes an association. The columns of the /// associated record are not selected. The returned association requires /// that the associated database table contains a matching row. - public func joining(required association: A) - -> QueryInterfaceRequest - where A.LeftAssociated == RowDecoder - { - return chain(.required, association.select([])) - } -} - -extension Association where LeftAssociated: MutablePersistableRecord { - func request(from record: LeftAssociated) -> QueryInterfaceRequest { - var query = request.query.qualifiedQuery // make sure query has a qualifier - let qualifier = query.qualifier! - let recordQualifier = SQLTableQualifier.init(tableName: LeftAssociated.databaseTableName) - - query = query.filter { db in - let associationMapping = try self.associationMapping(db) - guard let filter = associationMapping(recordQualifier, qualifier) else { - fatalError("Can't request from record without association mapping") - } - let container = PersistenceContainer(record) // support for record classes: late construction of container - return filter.resolvedExpression(inContext: [recordQualifier: container]) - } - - return QueryInterfaceRequest(query: QueryInterfaceQuery(query)) + public func joining(required association: A) -> QueryInterfaceRequest where A.LeftAssociated == RowDecoder { + return joining(.required, association.select([])) } } @@ -85,10 +54,7 @@ extension MutablePersistableRecord { /// let player: Player = ... /// let request = player.request(for: Player.team) /// let team = try request.fetchOne(db) // Team? - public func request(for association: A) - -> QueryInterfaceRequest - where A.LeftAssociated == Self - { + public func request(for association: A) -> QueryInterfaceRequest where A.LeftAssociated == Self { return association.request(from: self) } } @@ -100,40 +66,28 @@ extension TableRecord { /// Creates a request that includes an association. The columns of the /// associated record are selected. The returned association does not /// require that the associated database table contains a matching row. - public static func including(optional association: A) - -> QueryInterfaceRequest - where A.LeftAssociated == Self - { + public static func including(optional association: A) -> QueryInterfaceRequest where A.LeftAssociated == Self { return all().including(optional: association) } /// Creates a request that includes an association. The columns of the /// associated record are selected. The returned association requires /// that the associated database table contains a matching row. - public static func including(required association: A) - -> QueryInterfaceRequest - where A.LeftAssociated == Self - { + public static func including(required association: A) -> QueryInterfaceRequest where A.LeftAssociated == Self { return all().including(required: association) } /// Creates a request that includes an association. The columns of the /// associated record are not selected. The returned association does not /// require that the associated database table contains a matching row. - public static func joining(optional association: A) - -> QueryInterfaceRequest - where A.LeftAssociated == Self - { + public static func joining(optional association: A) -> QueryInterfaceRequest where A.LeftAssociated == Self { return all().joining(optional: association) } /// Creates a request that includes an association. The columns of the /// associated record are not selected. The returned association requires /// that the associated database table contains a matching row. - public static func joining(required association: A) - -> QueryInterfaceRequest - where A.LeftAssociated == Self - { + public static func joining(required association: A) -> QueryInterfaceRequest where A.LeftAssociated == Self { return all().joining(required: association) } } diff --git a/GRDBCipher.xcodeproj/project.pbxproj b/GRDBCipher.xcodeproj/project.pbxproj index 09684ca77..9a083ad0f 100755 --- a/GRDBCipher.xcodeproj/project.pbxproj +++ b/GRDBCipher.xcodeproj/project.pbxproj @@ -211,8 +211,6 @@ 5653EB9C20961FC000F46237 /* AssociationRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB8B20961FBF00F46237 /* AssociationRequest.swift */; }; 5653EB9D20961FC000F46237 /* Association.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB8C20961FBF00F46237 /* Association.swift */; }; 5653EB9E20961FC000F46237 /* Association.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB8C20961FBF00F46237 /* Association.swift */; }; - 5653EB9F20961FC000F46237 /* AssociationMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB8D20961FBF00F46237 /* AssociationMapping.swift */; }; - 5653EBA020961FC000F46237 /* AssociationMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB8D20961FBF00F46237 /* AssociationMapping.swift */; }; 5653EBA220961FCA00F46237 /* QueryInterfaceRequest+Association.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EBA120961FCA00F46237 /* QueryInterfaceRequest+Association.swift */; }; 5653EBA320961FCA00F46237 /* QueryInterfaceRequest+Association.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EBA120961FCA00F46237 /* QueryInterfaceRequest+Association.swift */; }; 5653EBB820961FE800F46237 /* AssociationParallelSQLTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EBA620961FE600F46237 /* AssociationParallelSQLTests.swift */; }; @@ -967,7 +965,6 @@ 5653EB8A20961FBF00F46237 /* ForeignKeyRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ForeignKeyRequest.swift; sourceTree = ""; }; 5653EB8B20961FBF00F46237 /* AssociationRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationRequest.swift; sourceTree = ""; }; 5653EB8C20961FBF00F46237 /* Association.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Association.swift; sourceTree = ""; }; - 5653EB8D20961FBF00F46237 /* AssociationMapping.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationMapping.swift; sourceTree = ""; }; 5653EBA120961FCA00F46237 /* QueryInterfaceRequest+Association.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "QueryInterfaceRequest+Association.swift"; sourceTree = ""; }; 5653EBA620961FE600F46237 /* AssociationParallelSQLTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationParallelSQLTests.swift; sourceTree = ""; }; 5653EBA720961FE600F46237 /* AssociationBelongsToFetchableRecordTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationBelongsToFetchableRecordTests.swift; sourceTree = ""; }; @@ -1471,15 +1468,14 @@ 5653EB8420961FBF00F46237 /* Association */ = { isa = PBXGroup; children = ( - 5653EB8520961FBF00F46237 /* BelongsToAssociation.swift */, - 5653EB8620961FBF00F46237 /* HasOneAssociation.swift */, + 5653EB8C20961FBF00F46237 /* Association.swift */, 5653EB8720961FBF00F46237 /* AssociationQuery.swift */, - 5653EB8820961FBF00F46237 /* HasManyAssociation.swift */, + 5653EB8B20961FBF00F46237 /* AssociationRequest.swift */, + 5653EB8520961FBF00F46237 /* BelongsToAssociation.swift */, 5653EB8920961FBF00F46237 /* ForeignKey.swift */, 5653EB8A20961FBF00F46237 /* ForeignKeyRequest.swift */, - 5653EB8B20961FBF00F46237 /* AssociationRequest.swift */, - 5653EB8C20961FBF00F46237 /* Association.swift */, - 5653EB8D20961FBF00F46237 /* AssociationMapping.swift */, + 5653EB8820961FBF00F46237 /* HasManyAssociation.swift */, + 5653EB8620961FBF00F46237 /* HasOneAssociation.swift */, ); path = Association; sourceTree = ""; @@ -2193,7 +2189,6 @@ 560FC5341CB003810014AA8E /* QueryInterfaceQuery.swift in Sources */, 566B912C1FA4D0CC0012D5B0 /* StatementAuthorizer.swift in Sources */, 560FC5351CB003810014AA8E /* Statement.swift in Sources */, - 5653EB9F20961FC000F46237 /* AssociationMapping.swift in Sources */, 5653EB9320961FC000F46237 /* AssociationQuery.swift in Sources */, 5690C3411D23E82A00E59934 /* Data.swift in Sources */, 5659F4891EA8D94E004A4992 /* Utils.swift in Sources */, @@ -2625,7 +2620,6 @@ 56AFCA091CB1A8BB00F48B96 /* QueryInterfaceQuery.swift in Sources */, 566B912F1FA4D0CC0012D5B0 /* StatementAuthorizer.swift in Sources */, 56AFCA0A1CB1A8BB00F48B96 /* Migration.swift in Sources */, - 5653EBA020961FC000F46237 /* AssociationMapping.swift in Sources */, 5653EB9420961FC000F46237 /* AssociationQuery.swift in Sources */, 5690C3441D23E82A00E59934 /* Data.swift in Sources */, 5659F48C1EA8D94E004A4992 /* Utils.swift in Sources */, diff --git a/GRDBCustom.xcodeproj/project.pbxproj b/GRDBCustom.xcodeproj/project.pbxproj index 210584469..7f137ab7d 100755 --- a/GRDBCustom.xcodeproj/project.pbxproj +++ b/GRDBCustom.xcodeproj/project.pbxproj @@ -67,8 +67,6 @@ 5653EB4E20961F6100F46237 /* AssociationRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB3D20961F6100F46237 /* AssociationRequest.swift */; }; 5653EB4F20961F6100F46237 /* Association.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB3E20961F6100F46237 /* Association.swift */; }; 5653EB5020961F6100F46237 /* Association.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB3E20961F6100F46237 /* Association.swift */; }; - 5653EB5120961F6100F46237 /* AssociationMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB3F20961F6100F46237 /* AssociationMapping.swift */; }; - 5653EB5220961F6100F46237 /* AssociationMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB3F20961F6100F46237 /* AssociationMapping.swift */; }; 5653EB5420961F7D00F46237 /* QueryInterfaceRequest+Association.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB5320961F7D00F46237 /* QueryInterfaceRequest+Association.swift */; }; 5653EB5520961F7D00F46237 /* QueryInterfaceRequest+Association.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB5320961F7D00F46237 /* QueryInterfaceRequest+Association.swift */; }; 5653EB6820961FB200F46237 /* AssociationParallelSQLTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB5820961FB000F46237 /* AssociationParallelSQLTests.swift */; }; @@ -640,7 +638,6 @@ 5653EB3C20961F6000F46237 /* ForeignKeyRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ForeignKeyRequest.swift; sourceTree = ""; }; 5653EB3D20961F6100F46237 /* AssociationRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationRequest.swift; sourceTree = ""; }; 5653EB3E20961F6100F46237 /* Association.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Association.swift; sourceTree = ""; }; - 5653EB3F20961F6100F46237 /* AssociationMapping.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationMapping.swift; sourceTree = ""; }; 5653EB5320961F7D00F46237 /* QueryInterfaceRequest+Association.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "QueryInterfaceRequest+Association.swift"; sourceTree = ""; }; 5653EB5820961FB000F46237 /* AssociationParallelSQLTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationParallelSQLTests.swift; sourceTree = ""; }; 5653EB5920961FB100F46237 /* AssociationBelongsToFetchableRecordTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationBelongsToFetchableRecordTests.swift; sourceTree = ""; }; @@ -1117,15 +1114,14 @@ 5653EB3620961F6000F46237 /* Association */ = { isa = PBXGroup; children = ( - 5653EB3720961F6000F46237 /* BelongsToAssociation.swift */, - 5653EB3820961F6000F46237 /* HasOneAssociation.swift */, + 5653EB3E20961F6100F46237 /* Association.swift */, 5653EB3920961F6000F46237 /* AssociationQuery.swift */, - 5653EB3A20961F6000F46237 /* HasManyAssociation.swift */, + 5653EB3D20961F6100F46237 /* AssociationRequest.swift */, + 5653EB3720961F6000F46237 /* BelongsToAssociation.swift */, 5653EB3B20961F6000F46237 /* ForeignKey.swift */, 5653EB3C20961F6000F46237 /* ForeignKeyRequest.swift */, - 5653EB3D20961F6100F46237 /* AssociationRequest.swift */, - 5653EB3E20961F6100F46237 /* Association.swift */, - 5653EB3F20961F6100F46237 /* AssociationMapping.swift */, + 5653EB3A20961F6000F46237 /* HasManyAssociation.swift */, + 5653EB3820961F6000F46237 /* HasOneAssociation.swift */, ); path = Association; sourceTree = ""; @@ -1868,7 +1864,6 @@ F3BA800C1CFB286F003DC1BA /* DatabaseError.swift in Sources */, 566B91301FA4D0CC0012D5B0 /* StatementAuthorizer.swift in Sources */, F3BA80221CFB288C003DC1BA /* NSNumber.swift in Sources */, - 5653EB5220961F6100F46237 /* AssociationMapping.swift in Sources */, 5653EB4620961F6100F46237 /* AssociationQuery.swift in Sources */, F3BA80321CFB28A4003DC1BA /* FetchedRecordsController.swift in Sources */, 5659F48D1EA8D94E004A4992 /* Utils.swift in Sources */, @@ -2139,7 +2134,6 @@ F3BA80681CFB2E55003DC1BA /* DatabaseError.swift in Sources */, 566B912D1FA4D0CC0012D5B0 /* StatementAuthorizer.swift in Sources */, F3BA807E1CFB2E61003DC1BA /* NSNumber.swift in Sources */, - 5653EB5120961F6100F46237 /* AssociationMapping.swift in Sources */, 5653EB4520961F6100F46237 /* AssociationQuery.swift in Sources */, F3BA808E1CFB2E7A003DC1BA /* FetchedRecordsController.swift in Sources */, 5659F48A1EA8D94E004A4992 /* Utils.swift in Sources */,