mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-30 04:28:44 +00:00
Merge associations: SQL tests
This commit is contained in:
1 parent
4c58fd5111
commit
ba11d7be66
2 files changed
+635
-48
No files matched your search
@@ -178,19 +178,14 @@ extension AssociationQuery {
|
||||
mergedJoins.append(value: join, forKey: key)
|
||||
}
|
||||
|
||||
// There is a possible conflict when both selections are not empty.
|
||||
let mergedSelection: [SQLSelectable]
|
||||
if selection.isEmpty {
|
||||
mergedSelection = other.selection
|
||||
} else {
|
||||
mergedSelection = selection
|
||||
}
|
||||
// replace selection unless empty
|
||||
let mergedSelection = other.selection.isEmpty ? selection : other.selection
|
||||
|
||||
return AssociationQuery(
|
||||
source: mergedSource,
|
||||
selection: mergedSelection,
|
||||
filterPromise: mergedFilterPromise,
|
||||
ordering: other.ordering, // reorder
|
||||
ordering: other.ordering, // replace ordering
|
||||
joins: mergedJoins)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user