Skip to content

Commit fc8873f

Browse files
committed
more test work
1 parent da54696 commit fc8873f

17 files changed

+279
-274
lines changed

src/EFCore.Jet/Query/Internal/SearchConditionConvertingExpressionVisitor.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,14 @@ protected override Expression VisitSqlFunction(SqlFunctionExpression sqlFunction
405405

406406
protected override Expression VisitRightJoin(RightJoinExpression rightJoinExpression)
407407
{
408-
throw new NotImplementedException();
408+
var parentSearchCondition = _isSearchCondition;
409+
_isSearchCondition = false;
410+
var table = (TableExpressionBase)Visit(rightJoinExpression.Table);
411+
_isSearchCondition = true;
412+
var joinPredicate = (SqlExpression)Visit(rightJoinExpression.JoinPredicate);
413+
_isSearchCondition = parentSearchCondition;
414+
415+
return rightJoinExpression.Update(table, joinPredicate);
409416
}
410417

411418
/// <summary>

test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -671,19 +671,25 @@ public override async Task Delete_with_RightJoin(bool async)
671671

672672
AssertSql(
673673
"""
674-
@p='0'
675-
@p0='100'
676-
677-
DELETE FROM [o]
678-
FROM [Order Details] AS [o]
679-
RIGHT JOIN (
680-
SELECT [o0].[OrderID]
681-
FROM [Orders] AS [o0]
682-
WHERE [o0].[OrderID] < 10300
683-
ORDER BY [o0].[OrderID]
684-
OFFSET @p ROWS FETCH NEXT @p0 ROWS ONLY
685-
) AS [o1] ON [o].[OrderID] = [o1].[OrderID]
686-
WHERE [o].[OrderID] < 10276
674+
DELETE FROM `Order Details` AS `o`
675+
WHERE EXISTS (
676+
SELECT 1
677+
FROM `Order Details` AS `o0`
678+
RIGHT JOIN (
679+
SELECT `o4`.`OrderID`
680+
FROM (
681+
SELECT TOP @p0 `o3`.`OrderID`
682+
FROM (
683+
SELECT TOP @p + @p0 `o2`.`OrderID`
684+
FROM `Orders` AS `o2`
685+
WHERE `o2`.`OrderID` < 10300
686+
ORDER BY `o2`.`OrderID`
687+
) AS `o3`
688+
ORDER BY `o3`.`OrderID` DESC
689+
) AS `o4`
690+
ORDER BY `o4`.`OrderID`
691+
) AS `o1` ON `o0`.`OrderID` = `o1`.`OrderID`
692+
WHERE `o0`.`OrderID` < 10276 AND `o0`.`OrderID` = `o`.`OrderID` AND `o0`.`ProductID` = `o`.`ProductID`)
687693
""");
688694
}
689695

@@ -1386,15 +1392,14 @@ public override async Task Update_with_RightJoin(bool async)
13861392
"""
13871393
@p='2020-01-01T00:00:00.0000000Z' (Nullable = true) (DbType = DateTime)
13881394
1389-
UPDATE [o]
1390-
SET [o].[OrderDate] = @p
1391-
FROM [Orders] AS [o]
1395+
UPDATE `Orders` AS `o`
13921396
RIGHT JOIN (
1393-
SELECT [c].[CustomerID]
1394-
FROM [Customers] AS [c]
1395-
WHERE [c].[CustomerID] LIKE N'F%'
1396-
) AS [c0] ON [o].[CustomerID] = [c0].[CustomerID]
1397-
WHERE [o].[OrderID] < 10300
1397+
SELECT `c`.`CustomerID`
1398+
FROM `Customers` AS `c`
1399+
WHERE `c`.`CustomerID` LIKE 'F%'
1400+
) AS `c0` ON `o`.`CustomerID` = `c0`.`CustomerID`
1401+
SET `o`.`OrderDate` = CDATE(@p)
1402+
WHERE `o`.`OrderID` < 10300
13981403
""");
13991404
}
14001405

test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4174,12 +4174,12 @@ public override async Task Correlated_collections_on_RightJoin_with_predicate(bo
41744174

41754175
AssertSql(
41764176
"""
4177-
SELECT [g].[Nickname], [g].[SquadId], [t].[Id], [w].[Name], [w].[Id]
4178-
FROM [Gears] AS [g]
4179-
RIGHT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName]
4180-
LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName]
4181-
WHERE [g].[HasSoulPatch] = CAST(0 AS bit)
4182-
ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id]
4177+
SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Name`, `w`.`Id`
4178+
FROM (`Gears` AS `g`
4179+
RIGHT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName`)
4180+
LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName`
4181+
WHERE `g`.`HasSoulPatch` = FALSE
4182+
ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`
41834183
""");
41844184
}
41854185

test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,12 @@ public override async Task Include_collection_with_right_join_clause_with_filter
509509

510510
AssertSql(
511511
"""
512-
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate]
513-
FROM [Customers] AS [c]
514-
RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]
515-
LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID]
516-
WHERE [c].[CustomerID] LIKE N'F%'
517-
ORDER BY [c].[CustomerID], [o].[OrderID]
512+
SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`
513+
FROM (`Customers` AS `c`
514+
RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`)
515+
LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID`
516+
WHERE `c`.`CustomerID` LIKE 'F%'
517+
ORDER BY `c`.`CustomerID`, `o`.`OrderID`
518518
""");
519519
}
520520

test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,12 +1870,12 @@ public override async Task Include_collection_with_right_join_clause_with_filter
18701870

18711871
AssertSql(
18721872
"""
1873-
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate]
1874-
FROM [Customers] AS [c]
1875-
RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]
1876-
LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID]
1877-
WHERE [c].[CustomerID] LIKE N'F%'
1878-
ORDER BY [c].[CustomerID], [o].[OrderID]
1873+
SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`
1874+
FROM (`Customers` AS `c`
1875+
RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`)
1876+
LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID`
1877+
WHERE `c`.`CustomerID` LIKE 'F%'
1878+
ORDER BY `c`.`CustomerID`, `o`.`OrderID`
18791879
""");
18801880
}
18811881

test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -569,12 +569,12 @@ public override async Task Include_collection_with_right_join_clause_with_filter
569569

570570
AssertSql(
571571
"""
572-
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate]
573-
FROM [Customers] AS [c]
574-
RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]
575-
LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID]
576-
WHERE [c].[CustomerID] LIKE N'F%'
577-
ORDER BY [c].[CustomerID], [o].[OrderID]
572+
SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`
573+
FROM (`Customers` AS `c`
574+
RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`)
575+
LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID`
576+
WHERE `c`.`CustomerID` LIKE 'F%'
577+
ORDER BY `c`.`CustomerID`, `o`.`OrderID`
578578
""");
579579
}
580580

test/EFCore.Jet.FunctionalTests/Query/NorthwindJoinQueryJetTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ public override async Task RightJoin(bool async)
251251

252252
AssertSql(
253253
"""
254-
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate]
255-
FROM [Customers] AS [c]
256-
RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]
254+
SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`
255+
FROM `Customers` AS `c`
256+
RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`
257257
""");
258258
}
259259

test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,12 +511,12 @@ public override async Task Include_collection_with_right_join_clause_with_filter
511511

512512
AssertSql(
513513
"""
514-
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate]
515-
FROM [Customers] AS [c]
516-
RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]
517-
LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID]
518-
WHERE [c].[CustomerID] LIKE N'F%'
519-
ORDER BY [c].[CustomerID], [o].[OrderID]
514+
SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`
515+
FROM (`Customers` AS `c`
516+
RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`)
517+
LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID`
518+
WHERE `c`.`CustomerID` LIKE 'F%'
519+
ORDER BY `c`.`CustomerID`, `o`.`OrderID`
520520
""");
521521
}
522522

test/EFCore.Jet.FunctionalTests/Query/PrecompiledQueryJetTest.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,18 +1348,17 @@ public override async Task Terminating_ExecuteUpdate_with_lambda()
13481348

13491349
AssertSql(
13501350
"""
1351-
@suffix='Suffix' (Size = 4000)
1351+
@suffix='Suffix' (Size = 255)
13521352
1353-
UPDATE [b]
1354-
SET [b].[Name] = COALESCE([b].[Name], N'') + @suffix
1355-
FROM [Blogs] AS [b]
1356-
WHERE [b].[Id] > 8
1353+
UPDATE `Blogs` AS `b`
1354+
SET `b`.`Name` = IIF(`b`.`Name` IS NULL, '', `b`.`Name`) & @suffix
1355+
WHERE `b`.`Id` > 8
13571356
""",
13581357
//
13591358
"""
13601359
SELECT COUNT(*)
1361-
FROM [Blogs] AS [b]
1362-
WHERE [b].[Id] = 9 AND [b].[Name] = N'Blog2Suffix'
1360+
FROM `Blogs` AS `b`
1361+
WHERE `b`.`Id` = 9 AND `b`.`Name` = 'Blog2Suffix'
13631362
""");
13641363
}
13651364

test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,21 +1179,15 @@ public override async Task Parameter_collection_of_structs_Contains_nullable_str
11791179

11801180
AssertSql(
11811181
"""
1182-
@values1='22'
1183-
@values2='33'
1184-
1185-
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId]
1186-
FROM [PrimitiveCollectionsEntity] AS [p]
1187-
WHERE [p].[NullableWrappedId] IN (@values1, @values2)
1182+
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId`
1183+
FROM `PrimitiveCollectionsEntity` AS `p`
1184+
WHERE `p`.`NullableWrappedId` IN (22, 33)
11881185
""",
11891186
//
11901187
"""
1191-
@values1='11'
1192-
@values2='44'
1193-
1194-
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId]
1195-
FROM [PrimitiveCollectionsEntity] AS [p]
1196-
WHERE [p].[NullableWrappedId] NOT IN (@values1, @values2) OR [p].[NullableWrappedId] IS NULL
1188+
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId`
1189+
FROM `PrimitiveCollectionsEntity` AS `p`
1190+
WHERE `p`.`NullableWrappedId` NOT IN (11, 44) OR `p`.`NullableWrappedId` IS NULL
11971191
""");
11981192
}
11991193

0 commit comments

Comments
 (0)