mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
Refactor test for association from CTE to Table
This commit is contained in:
1 parent
17ee1debdc
commit
120c973e29
1 file changed
+4
-19
@@ -295,25 +295,10 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
literal: "SELECT \("O'Brien")")
|
||||
let assoc1 = T.association(to: cte1)
|
||||
let assoc2 = cte1.association(to: cte2)
|
||||
do {
|
||||
let assoc3 = cte2.association(to: T.self)
|
||||
let request = T.all()
|
||||
.with(cte1)
|
||||
.with(cte2)
|
||||
.including(required: assoc1.including(required: assoc2.including(required: assoc3)))
|
||||
try assertEqualSQL(db, request, """
|
||||
WITH \
|
||||
"cte1" AS (SELECT * FROM "t"), \
|
||||
"cte2" AS (SELECT 'O''Brien') \
|
||||
SELECT "t1".*, "cte1".*, "cte2".*, "t2".* \
|
||||
FROM "t" "t1" \
|
||||
JOIN "cte1" \
|
||||
JOIN "cte2" \
|
||||
JOIN "t" "t2"
|
||||
""")
|
||||
}
|
||||
do {
|
||||
let assoc3 = cte2.association(to: Table("t"))
|
||||
for assoc3 in [
|
||||
cte2.association(to: T.self),
|
||||
cte2.association(to: Table("t")),
|
||||
] {
|
||||
let request = T.all()
|
||||
.with(cte1)
|
||||
.with(cte2)
|
||||
|
||||
Reference in new issue
Block a user