mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Association limit WIP
This commit is contained in:
1 parent
6eba24d169
commit
63590ede60
6 files changed
+738
-4
No files matched your search
@@ -138,7 +138,7 @@ struct SQLQueryGenerator: Refinable {
|
||||
let region = try prefetchedRegion(
|
||||
db,
|
||||
associations: prefetchedAssociations,
|
||||
from: relation.source.tableName)
|
||||
from: relation.source.associationOriginTable ?? relation.source.tableName)
|
||||
statement.databaseRegion.formUnion(region)
|
||||
}
|
||||
|
||||
@@ -741,9 +741,15 @@ private struct SQLQualifiedSource {
|
||||
var tableName: String
|
||||
var alias: TableAlias
|
||||
|
||||
/// When not nil, use this table name instead of `tableName` when looking
|
||||
/// for foreign keys on this source. This string is not nil when an
|
||||
/// `SQLRelation` has been turned into a common table expression.
|
||||
var associationOriginTable: String?
|
||||
|
||||
init(_ source: SQLSource) {
|
||||
self.tableName = source.tableName
|
||||
self.alias = source.alias ?? TableAlias(tableName: source.tableName)
|
||||
self.associationOriginTable = source.associationOriginTable
|
||||
assert(alias.tableName == tableName)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user