Skip to content

Commit 62b0c4a

Browse files
committed
closes #24
1 parent eb5352a commit 62b0c4a

File tree

2 files changed

+130
-10
lines changed

2 files changed

+130
-10
lines changed

QueryBaseline.cs

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80682,3 +80682,124 @@ HAVING COUNT(*) > 5
8068280682

8068380683

8068480684

80685+
EntityFramework.Jet.FunctionalTests.DbFunctionsJetTest.AssertSql(String[] expected) :
80686+
AssertSql(
80687+
@"SELECT COUNT(*)
80688+
FROM [Customers] AS [c]
80689+
WHERE [c].[ContactName] LIKE '!%'");
80690+
80691+
80692+
80693+
EntityFramework.Jet.FunctionalTests.DbFunctionsJetTest.AssertSql(String[] expected) :
80694+
AssertSql(
80695+
@"SELECT COUNT(*)
80696+
FROM [Customers] AS [c]
80697+
WHERE [c].[ContactName] LIKE '%M%'");
80698+
80699+
80700+
80701+
EntityFramework.Jet.FunctionalTests.Query.SimpleQueryJetTest.AssertSql(String[] expected) :
80702+
AssertSql(
80703+
@"SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock]
80704+
FROM [Products] AS [p]
80705+
WHERE ([p].[Discontinued] = False) AND ([p].[ProductID] >= 20)");
80706+
80707+
80708+
80709+
EntityFramework.Jet.FunctionalTests.Query.SimpleQueryJetTest.AssertSql(String[] expected) :
80710+
AssertSql(
80711+
@"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
80712+
FROM [Customers] AS [c]
80713+
WHERE [c].[ContactName] LIKE '%' + [c].[ContactName]");
80714+
80715+
80716+
80717+
EntityFramework.Jet.FunctionalTests.ComplexNavigationsQueryJetTest.AssertSql(String[] expected) :
80718+
AssertSql(
80719+
);
80720+
80721+
80722+
80723+
EntityFramework.Jet.FunctionalTests.QueryNavigationsJetTest.AssertSql(String[] expected) :
80724+
AssertSql(
80725+
@"@__p_0='2'
80726+
80727+
SELECT TOP @__p_0 [c].[CustomerID]
80728+
FROM [Customers] AS [c]
80729+
ORDER BY [c].[CustomerID]",
80730+
//
80731+
@"@_outer_CustomerID='ALFKI' (Nullable = false) (Size = 5)
80732+
80733+
SELECT TOP 1 [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate]
80734+
FROM [Orders] AS [o]
80735+
WHERE @_outer_CustomerID = [o].[CustomerID]
80736+
ORDER BY [o].[OrderID]",
80737+
//
80738+
@"@_outer_CustomerID='ANATR' (Nullable = false) (Size = 5)
80739+
80740+
SELECT TOP 1 [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate]
80741+
FROM [Orders] AS [o]
80742+
WHERE @_outer_CustomerID = [o].[CustomerID]
80743+
ORDER BY [o].[OrderID]");
80744+
80745+
80746+
80747+
EntityFramework.Jet.FunctionalTests.Query.SimpleQueryJetTest.AssertSql(String[] expected) :
80748+
AssertSql(
80749+
@"@__LocalMethod2_0='m' (Nullable = false) (Size = 1)
80750+
80751+
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
80752+
FROM [Customers] AS [c]
80753+
WHERE [c].[ContactName] LIKE '%' + @__LocalMethod2_0");
80754+
80755+
80756+
80757+
EntityFramework.Jet.FunctionalTests.QueryNavigationsJetTest.AssertContains(String[] expected) :
80758+
AssertSql(
80759+
@"SELECT [od0].[OrderID], [od0].[ProductID], [od0].[Discount], [od0].[Quantity], [od0].[UnitPrice], [od#Product0].[ProductID], [od#Product0].[Discontinued], [od#Product0].[ProductName], [od#Product0].[SupplierID], [od#Product0].[UnitPrice], [od#Product0].[UnitsInStock]
80760+
FROM ([Order Details] AS [od0]
80761+
INNER JOIN [Products] AS [od#Product0] ON [od0].[ProductID] = [od#Product0].[ProductID])",
80762+
//
80763+
@"SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [o#Customer0].[CustomerID], [o#Customer0].[Address], [o#Customer0].[City], [o#Customer0].[CompanyName], [o#Customer0].[ContactName], [o#Customer0].[ContactTitle], [o#Customer0].[Country], [o#Customer0].[Fax], [o#Customer0].[Phone], [o#Customer0].[PostalCode], [o#Customer0].[Region]
80764+
FROM ([Orders] AS [o0]
80765+
LEFT JOIN [Customers] AS [o#Customer0] ON [o0].[CustomerID] = [o#Customer0].[CustomerID])",
80766+
//
80767+
@"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
80768+
FROM [Customers] AS [c]");
80769+
80770+
80771+
80772+
EntityFramework.Jet.FunctionalTests.ComplexNavigationsQueryJetTest.AssertSql(String[] expected) :
80773+
AssertSql(
80774+
);
80775+
80776+
80777+
80778+
EntityFramework.Jet.FunctionalTests.ComplexNavigationsQueryJetTest.AssertSql(String[] expected) :
80779+
AssertSql(
80780+
);
80781+
80782+
80783+
80784+
EntityFramework.Jet.FunctionalTests.Query.SimpleQueryJetTest.AssertSql(String[] expected) :
80785+
AssertSql(
80786+
@"@__get_Item_0='London' (Nullable = false) (Size = 6)
80787+
80788+
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
80789+
FROM [Customers] AS [c]
80790+
WHERE [c].[City] = @__get_Item_0");
80791+
80792+
80793+
80794+
EntityFramework.Jet.FunctionalTests.Query.SimpleQueryJetTest.AssertSql(String[] expected) :
80795+
AssertSql(
80796+
@"@__london_0='London' (Nullable = false) (Size = 6)
80797+
@__lisboa_1='Lisboa' (Nullable = false) (Size = 6)
80798+
80799+
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title]
80800+
FROM [Customers] AS [c]
80801+
, [Employees] AS [e]
80802+
WHERE [c].[City] IN (@__london_0, 'Berlin', 'Seattle', @__lisboa_1)");
80803+
80804+
80805+

src/EFCore.Jet/Migrations/Internal/JetHistoryRepository.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ protected override string ExistsSql
3737

3838
var builder = new StringBuilder();
3939
builder
40-
.Append("SHOW TABLES WHERE NAME='")
41-
.Append(stringTypeMapping.GenerateSqlLiteral(TableName))
42-
.Append("'");
40+
.Append("SHOW TABLES WHERE NAME=")
41+
.Append(stringTypeMapping.GenerateSqlLiteral(TableName));
4342

4443
return builder.ToString();
4544
}
@@ -110,9 +109,9 @@ public override string GetCreateIfNotExistsScript()
110109
var stringTypeMapping = Dependencies.TypeMappingSource.GetMapping(typeof(string));
111110

112111
builder
113-
.Append("IF NOT EXISTS (SELECT * FROM (SHOW TABLES) WHERE Name = '")
112+
.Append("IF NOT EXISTS (SELECT * FROM (SHOW TABLES) WHERE Name = ")
114113
.Append(stringTypeMapping.GenerateSqlLiteral(TableName))
115-
.Append("') THEN ");
114+
.Append(") THEN ");
116115
using (builder.Indent())
117116
{
118117
builder.AppendLines(GetCreateScript());
@@ -137,9 +136,9 @@ public override string GetBeginIfNotExistsScript(string migrationId)
137136
.Append(SqlGenerationHelper.DelimitIdentifier(TableName))
138137
.Append(" WHERE ")
139138
.Append(SqlGenerationHelper.DelimitIdentifier(MigrationIdColumnName))
140-
.Append(" = '")
139+
.Append(" = ")
141140
.Append(stringTypeMapping.GenerateSqlLiteral(migrationId))
142-
.AppendLine("')")
141+
.AppendLine(")")
143142
.Append("THEN")
144143
.ToString();
145144
}
@@ -159,9 +158,9 @@ public override string GetBeginIfExistsScript(string migrationId)
159158
.Append(SqlGenerationHelper.DelimitIdentifier(TableName))
160159
.Append(" WHERE ")
161160
.Append(SqlGenerationHelper.DelimitIdentifier(MigrationIdColumnName))
162-
.Append(" = '")
161+
.Append(" = ")
163162
.Append(stringTypeMapping.GenerateSqlLiteral(migrationId))
164-
.AppendLine("')")
163+
.AppendLine(")")
165164
.Append("THEN")
166165
.ToString();
167166
}
@@ -172,4 +171,4 @@ public override string GetBeginIfExistsScript(string migrationId)
172171
/// </summary>
173172
public override string GetEndIfScript() => ";" + Environment.NewLine;
174173
}
175-
}
174+
}

0 commit comments

Comments
 (0)