Skip to content

Commit 7a41636

Browse files
linq2dbotMaceWindu
andauthored
unrevieved (#1468)
Co-authored-by: MaceWindu <[email protected]>
1 parent cb9c002 commit 7a41636

File tree

390 files changed

+3018
-1821
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

390 files changed

+3018
-1821
lines changed

PostgreSQL.13.LinqService/Tests/UserTests/Issue3186Tests/Tests.UserTests.Issue3186Tests.UpdateWhenTableFirstWithLeftJoin(PostgreSQL.13.LinqService).sql

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ UPDATE
88
SET
99
is_deleted = :is_deleted
1010
FROM
11-
element_services sr,
12-
"Components" cm
11+
component_categories ct
12+
INNER JOIN element_services sr ON sr.id = ct.service_id
13+
LEFT JOIN "Components" cm ON ct.id = cm.category_id AND NOT cm.is_deleted
1314
WHERE
14-
sr.id = 'TestProcessService' AND
15-
sr.id = component_categories.service_id AND
16-
component_categories.id = cm.category_id AND
17-
NOT cm.is_deleted
15+
sr.id = 'TestProcessService' AND component_categories.id = ct.id
1816

1917
BeforeExecute
2018
-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL

PostgreSQL.13.LinqService/Tests/xUpdate/DynamicColumnsTests/Tests.xUpdate.DynamicColumnsTests.UpdateViaSqlProperty(PostgreSQL.13.LinqService).sql

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ SET @id = 1001
3434
UPDATE
3535
"Child"
3636
SET
37-
"ChildID" = "Child"."ChildID" + 1
37+
"ChildID" = c_1."ChildID" + 1
3838
FROM
39-
"Parent" "a_Parent"
39+
"Child" c_1
40+
LEFT JOIN "Parent" "a_Parent" ON c_1."ParentID" = "a_Parent"."ParentID"
4041
WHERE
41-
"Child"."ChildID" = :id AND "a_Parent"."Value1" = 1 AND
42-
"Child"."ParentID" = "a_Parent"."ParentID"
42+
c_1."ChildID" = :id AND
43+
"a_Parent"."Value1" = 1 AND
44+
"Child"."ParentID" = c_1."ParentID" AND
45+
"Child"."ChildID" = c_1."ChildID"
4346

4447
BeforeExecute
4548
-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL

PostgreSQL.13.LinqService/Tests/xUpdate/DynamicColumnsTests/Tests.xUpdate.DynamicColumnsTests.UpdateViaSqlPropertyValue(PostgreSQL.13.LinqService).sql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,13 @@ UPDATE
3838
SET
3939
"ChildID" = :ChildID
4040
FROM
41-
"Parent" "a_Parent"
41+
"Child" c_1
42+
LEFT JOIN "Parent" "a_Parent" ON c_1."ParentID" = "a_Parent"."ParentID"
4243
WHERE
43-
"Child"."ChildID" = :id AND "a_Parent"."Value1" = 1 AND
44-
"Child"."ParentID" = "a_Parent"."ParentID"
44+
c_1."ChildID" = :id AND
45+
"a_Parent"."Value1" = 1 AND
46+
"Child"."ParentID" = c_1."ParentID" AND
47+
"Child"."ChildID" = c_1."ChildID"
4548

4649
BeforeExecute
4750
-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL

PostgreSQL.13.LinqService/Tests/xUpdate/UpdateFromTests/Tests.xUpdate.UpdateFromTests.UpdateTestAssociation(PostgreSQL.13.LinqService).sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ UPDATE
66
SET
77
"Value1" = "a_Relation"."RelatedValue3"
88
FROM
9-
"UpdateRelation" "a_Relation"
9+
"UpdatedEntities" v
10+
LEFT JOIN "UpdateRelation" "a_Relation" ON v."RelationId" = "a_Relation".id
1011
WHERE
11-
"a_Relation"."RelatedValue1" = 11 AND "UpdatedEntities"."RelationId" = "a_Relation".id
12+
"a_Relation"."RelatedValue1" = 11 AND "UpdatedEntities".id = v.id
1213

1314
BeforeExecute
1415
-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL

PostgreSQL.13.LinqService/Tests/xUpdate/UpdateFromTests/Tests.xUpdate.UpdateFromTests.UpdateTestAssociationAsUpdatable(PostgreSQL.13.LinqService).sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ UPDATE
66
SET
77
"Value1" = "a_Relation"."RelatedValue3"
88
FROM
9-
"UpdateRelation" "a_Relation"
9+
"UpdatedEntities" v
10+
LEFT JOIN "UpdateRelation" "a_Relation" ON v."RelationId" = "a_Relation".id
1011
WHERE
11-
"a_Relation"."RelatedValue1" = 11 AND "UpdatedEntities"."RelationId" = "a_Relation".id
12+
"a_Relation"."RelatedValue1" = 11 AND "UpdatedEntities".id = v.id
1213

1314
BeforeExecute
1415
-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL

PostgreSQL.13.LinqService/Tests/xUpdate/UpdateFromTests/Tests.xUpdate.UpdateFromTests.UpdateTestAssociationSimple(PostgreSQL.13.LinqService).sql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
UPDATE
55
"UpdatedEntities"
66
SET
7-
"Value1" = "UpdatedEntities"."Value1" + "UpdatedEntities"."Value2" + "UpdatedEntities"."Value3",
8-
"Value2" = "UpdatedEntities"."Value1" + "UpdatedEntities"."Value2" + "UpdatedEntities"."Value3",
7+
"Value1" = v."Value1" + v."Value2" + v."Value3",
8+
"Value2" = v."Value1" + v."Value2" + v."Value3",
99
"Value3" = 1
1010
FROM
11-
"UpdateRelation" "a_Relation"
11+
"UpdatedEntities" v
12+
LEFT JOIN "UpdateRelation" "a_Relation" ON v."RelationId" = "a_Relation".id
1213
WHERE
13-
"a_Relation"."RelatedValue1" = 11 AND "UpdatedEntities"."RelationId" = "a_Relation".id
14+
"a_Relation"."RelatedValue1" = 11 AND "UpdatedEntities".id = v.id
1415

1516
BeforeExecute
1617
-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL

PostgreSQL.13.LinqService/Tests/xUpdate/UpdateFromTests/Tests.xUpdate.UpdateFromTests.UpdateTestAssociationSimpleAsUpdatable(PostgreSQL.13.LinqService).sql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
UPDATE
55
"UpdatedEntities"
66
SET
7-
"Value1" = "UpdatedEntities"."Value1" + "UpdatedEntities"."Value2" + "UpdatedEntities"."Value3",
8-
"Value2" = "UpdatedEntities"."Value1" + "UpdatedEntities"."Value2" + "UpdatedEntities"."Value3",
7+
"Value1" = v."Value1" + v."Value2" + v."Value3",
8+
"Value2" = v."Value1" + v."Value2" + v."Value3",
99
"Value3" = 1
1010
FROM
11-
"UpdateRelation" "a_Relation"
11+
"UpdatedEntities" v
12+
LEFT JOIN "UpdateRelation" "a_Relation" ON v."RelationId" = "a_Relation".id
1213
WHERE
13-
"a_Relation"."RelatedValue1" = 11 AND "UpdatedEntities"."RelationId" = "a_Relation".id
14+
"a_Relation"."RelatedValue1" = 11 AND "UpdatedEntities".id = v.id
1415

1516
BeforeExecute
1617
-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL

PostgreSQL.13.LinqService/Tests/xUpdate/UpdateTests/Tests.xUpdate.UpdateTests.AsUpdatableDuplicate(PostgreSQL.13.LinqService).sql

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,15 @@ SET @id = 1001
4242
UPDATE
4343
"Child"
4444
SET
45-
"ChildID" = "Child"."ChildID" + 2
45+
"ChildID" = c_1."ChildID" + 2
4646
FROM
47-
"Parent" "a_Parent"
47+
"Child" c_1
48+
LEFT JOIN "Parent" "a_Parent" ON c_1."ParentID" = "a_Parent"."ParentID"
4849
WHERE
49-
"Child"."ChildID" = :id AND "a_Parent"."Value1" = 1 AND
50-
"Child"."ParentID" = "a_Parent"."ParentID"
50+
c_1."ChildID" = :id AND
51+
"a_Parent"."Value1" = 1 AND
52+
"Child"."ParentID" = c_1."ParentID" AND
53+
"Child"."ChildID" = c_1."ChildID"
5154

5255
BeforeExecute
5356
-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL

PostgreSQL.13.LinqService/Tests/xUpdate/UpdateTests/Tests.xUpdate.UpdateTests.AsUpdatableTest(PostgreSQL.13.LinqService).sql

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,15 @@ SET @id = 1001
4242
UPDATE
4343
"Child"
4444
SET
45-
"ChildID" = "Child"."ChildID" + 1
45+
"ChildID" = c_1."ChildID" + 1
4646
FROM
47-
"Parent" "a_Parent"
47+
"Child" c_1
48+
LEFT JOIN "Parent" "a_Parent" ON c_1."ParentID" = "a_Parent"."ParentID"
4849
WHERE
49-
"Child"."ChildID" = :id AND "a_Parent"."Value1" = 1 AND
50-
"Child"."ParentID" = "a_Parent"."ParentID"
50+
c_1."ChildID" = :id AND
51+
"a_Parent"."Value1" = 1 AND
52+
"Child"."ParentID" = c_1."ParentID" AND
53+
"Child"."ChildID" = c_1."ChildID"
5154

5255
BeforeExecute
5356
-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL

PostgreSQL.13.LinqService/Tests/xUpdate/UpdateTests/Tests.xUpdate.UpdateTests.TestUpdateFromJoin(PostgreSQL.13.LinqService).sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ UPDATE
66
SET
77
col1 = gt_s_one.col1,
88
col2 = gt_s_one.col2,
9-
col3 = Replace(gt_s_one.col3, 'auth.', ''),
9+
col3 = Replace(x.col3, 'auth.', ''),
1010
col4 = gt_s_one.col4,
1111
col5 = CASE
12-
WHEN gt_s_one.col3 = 'empty' THEN '1'
12+
WHEN x.col3 = 'empty' THEN '1'
1313
ELSE '0'
1414
END,
1515
col6 = CASE
16-
WHEN gt_s_one.col3 = 'empty' THEN ''
16+
WHEN x.col3 = 'empty' THEN ''
1717
ELSE y1.id::text
1818
END
1919
FROM
20-
access_mode y1
20+
gt_s_one x
21+
LEFT JOIN access_mode y1 ON Upper(Replace(x.col3, 'auth.', '')) = Upper(y1.code) OR x.col3 IS NULL AND y1.code IS NULL
2122
WHERE
22-
Upper(Replace(gt_s_one.col3, 'auth.', '')) = Upper(y1.code) OR
23-
gt_s_one.col3 IS NULL AND y1.code IS NULL
23+
gt_s_one.id = x.id
2424

0 commit comments

Comments
 (0)