Skip to content

Commit 0675fcc

Browse files
committed
work on ODBC tests
1 parent fc5437d commit 0675fcc

File tree

3 files changed

+36
-27
lines changed

3 files changed

+36
-27
lines changed

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

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -221,31 +221,40 @@ public override async Task Navs_query(bool async)
221221

222222
AssertSql(
223223
$"""
224-
{AssertSqlHelper.Declaration("@__ef_filter__TenantPrefix_0='B' (Size = 255)")}
225-
{AssertSqlHelper.Declaration("@__ef_filter__TenantPrefix_0='B' (Size = 255)")}
226-
{AssertSqlHelper.Declaration("@__ef_filter__TenantPrefix_0='B' (Size = 255)")}
227-
{AssertSqlHelper.Declaration("@__ef_filter__TenantPrefix_0='B' (Size = 255)")}
228-
{AssertSqlHelper.Declaration("@__ef_filter___quantity_1='50'")}
229-
230-
SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`
231-
FROM `Customers` AS `c`
232-
INNER JOIN (
233-
SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`
234-
FROM `Orders` AS `o`
235-
LEFT JOIN (
236-
SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`
237-
FROM `Customers` AS `c0`
238-
WHERE ({AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0")} = '') OR (`c0`.`CompanyName` IS NOT NULL AND (LEFT(`c0`.`CompanyName`, LEN({AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0")})) = {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0")}))
239-
) AS `t` ON `o`.`CustomerID` = `t`.`CustomerID`
240-
WHERE `t`.`CustomerID` IS NOT NULL AND `t`.`CompanyName` IS NOT NULL
241-
) AS `t0` ON `c`.`CustomerID` = `t0`.`CustomerID`
242-
INNER JOIN (
243-
SELECT `o0`.`OrderID`, `o0`.`ProductID`, `o0`.`Discount`, `o0`.`Quantity`, `o0`.`UnitPrice`
244-
FROM `Order Details` AS `o0`
245-
WHERE `o0`.`Quantity` > {AssertSqlHelper.Parameter("@__ef_filter___quantity_1")}
246-
) AS `t1` ON `t0`.`OrderID` = `t1`.`OrderID`
247-
WHERE (({AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0")} = '') OR ((`c`.`CompanyName` IS NOT NULL) AND (LEFT(`c`.`CompanyName`, LEN({AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0")})) = {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0")}))) AND (`t1`.`Discount` < IIF(10 IS NULL, NULL, CSNG(10)))
248-
""");
224+
@ef_filter__TenantPrefix_startswith='B%' (Size = 40)
225+
@ef_filter__TenantPrefix_startswith='B%' (Size = 40)
226+
@ef_filter___quantity='50'
227+
@ef_filter__TenantPrefix_startswith='B%' (Size = 40)
228+
229+
SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`
230+
FROM (`Customers` AS `c`
231+
INNER JOIN (
232+
SELECT `o`.`OrderID`, `o`.`CustomerID`
233+
FROM `Orders` AS `o`
234+
LEFT JOIN (
235+
SELECT `c0`.`CustomerID`, `c0`.`CompanyName`
236+
FROM `Customers` AS `c0`
237+
WHERE `c0`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@ef_filter__TenantPrefix_startswith")}
238+
) AS `c1` ON `o`.`CustomerID` = `c1`.`CustomerID`
239+
WHERE `c1`.`CustomerID` IS NOT NULL AND `c1`.`CompanyName` IS NOT NULL
240+
) AS `s` ON `c`.`CustomerID` = `s`.`CustomerID`)
241+
LEFT JOIN (
242+
SELECT `o0`.`OrderID`, `o0`.`Discount`
243+
FROM `Order Details` AS `o0`
244+
INNER JOIN (
245+
SELECT `o1`.`OrderID`
246+
FROM `Orders` AS `o1`
247+
LEFT JOIN (
248+
SELECT `c2`.`CustomerID`, `c2`.`CompanyName`
249+
FROM `Customers` AS `c2`
250+
WHERE `c2`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@ef_filter__TenantPrefix_startswith")}
251+
) AS `c3` ON `o1`.`CustomerID` = `c3`.`CustomerID`
252+
WHERE `c3`.`CustomerID` IS NOT NULL AND `c3`.`CompanyName` IS NOT NULL
253+
) AS `s0` ON `o0`.`OrderID` = `s0`.`OrderID`
254+
WHERE `o0`.`Quantity` > {AssertSqlHelper.Parameter("@ef_filter___quantity")}
255+
) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID`
256+
WHERE ((`c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@ef_filter__TenantPrefix_startswith")}) AND `s1`.`Discount` < 10) AND (`s`.`OrderID` IS NOT NULL AND `s1`.`OrderID` IS NOT NULL)
257+
""");
249258
}
250259

251260
[ConditionalFact]

test/EFCore.Jet.FunctionalTests/TestUtilities/AssertSqlHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static string Parameter(string name)
1717

1818
public static string Parameter(string name, DataAccessProviderType dataAccessProviderType)
1919
=> dataAccessProviderType == DataAccessProviderType.Odbc
20-
? "?"
20+
? name //"?" EF10 was changed to log the command before we modify the sql to use unnamed parameters
2121
: name;
2222

2323
public static string Declaration(string fullDeclaration)

test/EFCore.Jet.FunctionalTests/test.runsettings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<RunConfiguration>
55
<EnvironmentVariables>
66
<!-- List of environment variables we want to set-->
7-
<EF_TEST_REWRITE_BASELINES>1</EF_TEST_REWRITE_BASELINES>
7+
<EF_TEST_REWRITE_BASELINES>0</EF_TEST_REWRITE_BASELINES>
88
</EnvironmentVariables>
99
</RunConfiguration>
1010
</RunSettings>

0 commit comments

Comments
 (0)