Skip to content

Commit ff81424

Browse files
committed
more fixes
1 parent 009fe06 commit ff81424

7 files changed

Lines changed: 510 additions & 508 deletions

File tree

src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,8 +817,10 @@ protected override void GenerateTop(SelectExpression selectExpression)
817817
if (selectExpression.Limit != null)
818818
{
819819
Sql.Append("TOP ");
820+
parent.Push(selectExpression);
820821
Visit(selectExpression.Limit);
821822
Sql.Append(" ");
823+
parent.Pop();
822824
}
823825
}
824826

test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt

Lines changed: 232 additions & 232 deletions
Large diffs are not rendered by default.

test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt

Lines changed: 218 additions & 218 deletions
Large diffs are not rendered by default.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7347,7 +7347,7 @@ public override async Task Enum_flags_closure_typed_as_different_type_generates_
73477347
73487348
SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`
73497349
FROM `Gears` AS `g`
7350-
WHERE (@prm BAND CLNG(`g`.`Rank`)) = CLNG(`g`.`Rank`)
7350+
WHERE (@prm BAND CLNG(CINT(`g`.`Rank`))) = CLNG(`g`.`Rank`)
73517351
""");
73527352
}
73537353

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

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2298,18 +2298,18 @@ public override async Task Skip_Take_Any(bool isAsync)
22982298

22992299
AssertSql(
23002300
"""
2301-
SELECT IIF(EXISTS (
2302-
SELECT 1
2301+
SELECT EXISTS (
2302+
SELECT 1
2303+
FROM (
2304+
SELECT TOP @p0 `c0`.`ContactName`
23032305
FROM (
2304-
SELECT TOP @p0 `c0`.`ContactName`
2305-
FROM (
2306-
SELECT TOP @p + @p0 `c`.`ContactName`
2307-
FROM `Customers` AS `c`
2308-
ORDER BY `c`.`ContactName`
2309-
) AS `c0`
2310-
ORDER BY `c0`.`ContactName` DESC
2311-
) AS `c1`
2312-
ORDER BY `c1`.`ContactName`), TRUE, FALSE)
2306+
SELECT TOP @p + @p0 `c`.`ContactName`
2307+
FROM `Customers` AS `c`
2308+
ORDER BY `c`.`ContactName`
2309+
) AS `c0`
2310+
ORDER BY `c0`.`ContactName` DESC
2311+
) AS `c1`
2312+
ORDER BY `c1`.`ContactName`)
23132313
FROM (SELECT COUNT(*) FROM `#Dual`)
23142314
""");
23152315
}
@@ -2320,22 +2320,22 @@ public override async Task Skip_Take_All(bool isAsync)
23202320

23212321
AssertSql(
23222322
"""
2323-
SELECT IIF(NOT EXISTS (
2324-
SELECT 1
2323+
SELECT NOT EXISTS (
2324+
SELECT 1
2325+
FROM (
2326+
SELECT `c2`.`CustomerID`
23252327
FROM (
2326-
SELECT `c2`.`CustomerID`
2328+
SELECT TOP @p0 `c1`.`CustomerID`
23272329
FROM (
2328-
SELECT TOP @p0 `c1`.`CustomerID`
2329-
FROM (
2330-
SELECT TOP @p + @p0 `c`.`CustomerID`
2331-
FROM `Customers` AS `c`
2332-
ORDER BY `c`.`CustomerID`
2333-
) AS `c1`
2334-
ORDER BY `c1`.`CustomerID` DESC
2335-
) AS `c2`
2336-
ORDER BY `c2`.`CustomerID`
2337-
) AS `c0`
2338-
WHERE `c0`.`CustomerID` NOT LIKE 'B%'), TRUE, FALSE)
2330+
SELECT TOP @p + @p0 `c`.`CustomerID`
2331+
FROM `Customers` AS `c`
2332+
ORDER BY `c`.`CustomerID`
2333+
) AS `c1`
2334+
ORDER BY `c1`.`CustomerID` DESC
2335+
) AS `c2`
2336+
ORDER BY `c2`.`CustomerID`
2337+
) AS `c0`
2338+
WHERE `c0`.`CustomerID` NOT LIKE 'B%')
23392339
FROM (SELECT COUNT(*) FROM `#Dual`)
23402340
""");
23412341
}
@@ -2346,14 +2346,14 @@ public override async Task Take_All(bool isAsync)
23462346

23472347
AssertSql(
23482348
"""
2349-
SELECT IIF(NOT EXISTS (
2350-
SELECT 1
2351-
FROM (
2352-
SELECT TOP @p `c`.`CustomerID`
2353-
FROM `Customers` AS `c`
2354-
ORDER BY `c`.`CustomerID`
2355-
) AS `c0`
2356-
WHERE `c0`.`CustomerID` NOT LIKE 'A%'), TRUE, FALSE)
2349+
SELECT NOT EXISTS (
2350+
SELECT 1
2351+
FROM (
2352+
SELECT TOP @p `c`.`CustomerID`
2353+
FROM `Customers` AS `c`
2354+
ORDER BY `c`.`CustomerID`
2355+
) AS `c0`
2356+
WHERE `c0`.`CustomerID` NOT LIKE 'A%')
23572357
FROM (SELECT COUNT(*) FROM `#Dual`)
23582358
""");
23592359
}
@@ -2364,22 +2364,22 @@ public override async Task Skip_Take_Any_with_predicate(bool isAsync)
23642364

23652365
AssertSql(
23662366
"""
2367-
SELECT IIF(EXISTS (
2368-
SELECT 1
2367+
SELECT EXISTS (
2368+
SELECT 1
2369+
FROM (
2370+
SELECT `c2`.`CustomerID`
23692371
FROM (
2370-
SELECT `c2`.`CustomerID`
2372+
SELECT TOP @p0 `c1`.`CustomerID`
23712373
FROM (
2372-
SELECT TOP @p0 `c1`.`CustomerID`
2373-
FROM (
2374-
SELECT TOP @p + @p0 `c`.`CustomerID`
2375-
FROM `Customers` AS `c`
2376-
ORDER BY `c`.`CustomerID`
2377-
) AS `c1`
2378-
ORDER BY `c1`.`CustomerID` DESC
2379-
) AS `c2`
2380-
ORDER BY `c2`.`CustomerID`
2381-
) AS `c0`
2382-
WHERE `c0`.`CustomerID` LIKE 'C%'), TRUE, FALSE)
2374+
SELECT TOP @p + @p0 `c`.`CustomerID`
2375+
FROM `Customers` AS `c`
2376+
ORDER BY `c`.`CustomerID`
2377+
) AS `c1`
2378+
ORDER BY `c1`.`CustomerID` DESC
2379+
) AS `c2`
2380+
ORDER BY `c2`.`CustomerID`
2381+
) AS `c0`
2382+
WHERE `c0`.`CustomerID` LIKE 'C%')
23832383
FROM (SELECT COUNT(*) FROM `#Dual`)
23842384
""");
23852385
}
@@ -2390,14 +2390,14 @@ public override async Task Take_Any_with_predicate(bool isAsync)
23902390

23912391
AssertSql(
23922392
"""
2393-
SELECT IIF(EXISTS (
2394-
SELECT 1
2395-
FROM (
2396-
SELECT TOP @p `c`.`CustomerID`
2397-
FROM `Customers` AS `c`
2398-
ORDER BY `c`.`CustomerID`
2399-
) AS `c0`
2400-
WHERE `c0`.`CustomerID` LIKE 'B%'), TRUE, FALSE)
2393+
SELECT EXISTS (
2394+
SELECT 1
2395+
FROM (
2396+
SELECT TOP @p `c`.`CustomerID`
2397+
FROM `Customers` AS `c`
2398+
ORDER BY `c`.`CustomerID`
2399+
) AS `c0`
2400+
WHERE `c0`.`CustomerID` LIKE 'B%')
24012401
FROM (SELECT COUNT(*) FROM `#Dual`)
24022402
""");
24032403
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9964,7 +9964,7 @@ UNION ALL
99649964
SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator`
99659965
FROM `Officers` AS `o`
99669966
) AS `u`
9967-
WHERE (@prm BAND CLNG(`u`.`Rank`)) = CLNG(`u`.`Rank`)
9967+
WHERE (@prm BAND CLNG(CINT(`u`.`Rank`))) = CLNG(`u`.`Rank`)
99689968
""");
99699969
}
99709970

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7961,7 +7961,7 @@ public override async Task Enum_flags_closure_typed_as_different_type_generates_
79617961
SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator`
79627962
FROM `Gears` AS `g`
79637963
LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`
7964-
WHERE (@prm BAND CLNG(`g`.`Rank`)) = CLNG(`g`.`Rank`)
7964+
WHERE (@prm BAND CLNG(CINT(`g`.`Rank`))) = CLNG(`g`.`Rank`)
79657965
""");
79667966
}
79677967

0 commit comments

Comments
 (0)