From 8095648ad00f765cd7a9068638161ca6df3cc998 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 12 Oct 2024 16:16:38 +0800 Subject: [PATCH 1/3] Add Std Dev and Variance using EF.Functions --- .../Extensions/JetDbFunctionsExtensions.cs | 369 +++++++- .../JetServiceCollectionExtensions.cs | 1 + ...etAggregateMethodCallTranslatorProvider.cs | 30 + .../JetMethodCallTranslatorProvider.cs | 2 +- .../JetStatisticsAggregateMethodTranslator.cs | 72 ++ ...orthwindFunctionsQueryJetTest.Functions.cs | 831 ++++++++++-------- 6 files changed, 920 insertions(+), 385 deletions(-) create mode 100644 src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetAggregateMethodCallTranslatorProvider.cs create mode 100644 src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStatisticsAggregateMethodTranslator.cs diff --git a/src/EFCore.Jet/Extensions/JetDbFunctionsExtensions.cs b/src/EFCore.Jet/Extensions/JetDbFunctionsExtensions.cs index b0315322..829629b0 100644 --- a/src/EFCore.Jet/Extensions/JetDbFunctionsExtensions.cs +++ b/src/EFCore.Jet/Extensions/JetDbFunctionsExtensions.cs @@ -1,6 +1,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using JetBrains.Annotations; using Microsoft.EntityFrameworkCore.Diagnostics; @@ -22,7 +23,7 @@ public static class JetDbFunctionsExtensions /// Ending date for the calculation. /// Number of year boundaries crossed between the dates. public static int DateDiffYear( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTime startDate, DateTime endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffYear))); @@ -36,7 +37,7 @@ public static int DateDiffYear( /// Ending date for the calculation. /// Number of year boundaries crossed between the dates. public static int? DateDiffYear( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTime? startDate, DateTime? endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffYear))); @@ -50,7 +51,7 @@ public static int DateDiffYear( /// Ending date for the calculation. /// Number of year boundaries crossed between the dates. public static int DateDiffYear( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTimeOffset startDate, DateTimeOffset endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffYear))); @@ -64,7 +65,7 @@ public static int DateDiffYear( /// Ending date for the calculation. /// Number of year boundaries crossed between the dates. public static int? DateDiffYear( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTimeOffset? startDate, DateTimeOffset? endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffYear))); @@ -78,7 +79,7 @@ public static int DateDiffYear( /// Ending date for the calculation. /// Number of month boundaries crossed between the dates. public static int DateDiffMonth( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTime startDate, DateTime endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffMonth))); @@ -92,7 +93,7 @@ public static int DateDiffMonth( /// Ending date for the calculation. /// Number of month boundaries crossed between the dates. public static int? DateDiffMonth( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTime? startDate, DateTime? endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffMonth))); @@ -106,7 +107,7 @@ public static int DateDiffMonth( /// Ending date for the calculation. /// Number of month boundaries crossed between the dates. public static int DateDiffMonth( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTimeOffset startDate, DateTimeOffset endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffMonth))); @@ -120,7 +121,7 @@ public static int DateDiffMonth( /// Ending date for the calculation. /// Number of month boundaries crossed between the dates. public static int? DateDiffMonth( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTimeOffset? startDate, DateTimeOffset? endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffMonth))); @@ -134,7 +135,7 @@ public static int DateDiffMonth( /// Ending date for the calculation. /// Number of day boundaries crossed between the dates. public static int DateDiffDay( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTime startDate, DateTime endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffDay))); @@ -148,7 +149,7 @@ public static int DateDiffDay( /// Ending date for the calculation. /// Number of day boundaries crossed between the dates. public static int? DateDiffDay( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTime? startDate, DateTime? endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffDay))); @@ -162,7 +163,7 @@ public static int DateDiffDay( /// Ending date for the calculation. /// Number of day boundaries crossed between the dates. public static int DateDiffDay( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTimeOffset startDate, DateTimeOffset endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffDay))); @@ -176,7 +177,7 @@ public static int DateDiffDay( /// Ending date for the calculation. /// Number of day boundaries crossed between the dates. public static int? DateDiffDay( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTimeOffset? startDate, DateTimeOffset? endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffDay))); @@ -190,7 +191,7 @@ public static int DateDiffDay( /// Ending date for the calculation. /// Number of hour boundaries crossed between the dates. public static int DateDiffHour( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTime startDate, DateTime endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffHour))); @@ -204,7 +205,7 @@ public static int DateDiffHour( /// Ending date for the calculation. /// Number of hour boundaries crossed between the dates. public static int? DateDiffHour( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTime? startDate, DateTime? endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffHour))); @@ -218,7 +219,7 @@ public static int DateDiffHour( /// Ending date for the calculation. /// Number of hour boundaries crossed between the dates. public static int DateDiffHour( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTimeOffset startDate, DateTimeOffset endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffHour))); @@ -232,7 +233,7 @@ public static int DateDiffHour( /// Ending date for the calculation. /// Number of hour boundaries crossed between the dates. public static int? DateDiffHour( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTimeOffset? startDate, DateTimeOffset? endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffHour))); @@ -246,7 +247,7 @@ public static int DateDiffHour( /// Ending timespan for the calculation. /// Number of hour boundaries crossed between the timespans. public static int DateDiffHour( - [CanBeNull] this DbFunctions _, + this DbFunctions _, TimeSpan startTimeSpan, TimeSpan endTimeSpan) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffHour))); @@ -260,7 +261,7 @@ public static int DateDiffHour( /// Ending timespan for the calculation. /// Number of hour boundaries crossed between the timespans. public static int? DateDiffHour( - [CanBeNull] this DbFunctions _, + this DbFunctions _, TimeSpan? startTimeSpan, TimeSpan? endTimeSpan) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffHour))); @@ -274,7 +275,7 @@ public static int DateDiffHour( /// Ending date for the calculation. /// Number of minute boundaries crossed between the dates. public static int DateDiffMinute( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTime startDate, DateTime endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffMinute))); @@ -288,7 +289,7 @@ public static int DateDiffMinute( /// Ending date for the calculation. /// Number of minute boundaries crossed between the dates. public static int? DateDiffMinute( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTime? startDate, DateTime? endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffMinute))); @@ -302,7 +303,7 @@ public static int DateDiffMinute( /// Ending date for the calculation. /// Number of minute boundaries crossed between the dates. public static int DateDiffMinute( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTimeOffset startDate, DateTimeOffset endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffMinute))); @@ -316,7 +317,7 @@ public static int DateDiffMinute( /// Ending date for the calculation. /// Number of minute boundaries crossed between the dates. public static int? DateDiffMinute( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTimeOffset? startDate, DateTimeOffset? endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffMinute))); @@ -330,7 +331,7 @@ public static int DateDiffMinute( /// Ending timespan for the calculation. /// Number of minute boundaries crossed between the timespans. public static int DateDiffMinute( - [CanBeNull] this DbFunctions _, + this DbFunctions _, TimeSpan startTimeSpan, TimeSpan endTimeSpan) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffMinute))); @@ -344,7 +345,7 @@ public static int DateDiffMinute( /// Ending timespan for the calculation. /// Number of minute boundaries crossed between the timespans. public static int? DateDiffMinute( - [CanBeNull] this DbFunctions _, + this DbFunctions _, TimeSpan? startTimeSpan, TimeSpan? endTimeSpan) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffMinute))); @@ -358,7 +359,7 @@ public static int DateDiffMinute( /// Ending date for the calculation. /// Number of second boundaries crossed between the dates. public static int DateDiffSecond( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTime startDate, DateTime endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffSecond))); @@ -372,7 +373,7 @@ public static int DateDiffSecond( /// Ending date for the calculation. /// Number of second boundaries crossed between the dates. public static int? DateDiffSecond( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTime? startDate, DateTime? endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffSecond))); @@ -386,7 +387,7 @@ public static int DateDiffSecond( /// Ending date for the calculation. /// Number of second boundaries crossed between the dates. public static int DateDiffSecond( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTimeOffset startDate, DateTimeOffset endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffSecond))); @@ -400,7 +401,7 @@ public static int DateDiffSecond( /// Ending date for the calculation. /// Number of second boundaries crossed between the dates. public static int? DateDiffSecond( - [CanBeNull] this DbFunctions _, + this DbFunctions _, DateTimeOffset? startDate, DateTimeOffset? endDate) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffSecond))); @@ -414,7 +415,7 @@ public static int DateDiffSecond( /// Ending timespan for the calculation. /// Number of second boundaries crossed between the timespans. public static int DateDiffSecond( - [CanBeNull] this DbFunctions _, + this DbFunctions _, TimeSpan startTimeSpan, TimeSpan endTimeSpan) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffSecond))); @@ -428,7 +429,7 @@ public static int DateDiffSecond( /// Ending timespan for the calculation. /// Number of second boundaries crossed between the timespans. public static int? DateDiffSecond( - [CanBeNull] this DbFunctions _, + this DbFunctions _, TimeSpan? startTimeSpan, TimeSpan? endTimeSpan) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(DateDiffSecond))); @@ -441,12 +442,12 @@ public static int DateDiffSecond( /// Expression to validate /// true for valid date and false otherwise. public static bool IsDate( - [CanBeNull] this DbFunctions _, - [NotNull] string expression) + this DbFunctions _, + string expression) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(IsDate))); public static double Random( - [CanBeNull] this DbFunctions _) + this DbFunctions _) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(Random))); @@ -478,8 +479,306 @@ public static double Random( /// The `byte[]` array. /// The length of , or the length of -1 in some cases. public static int ByteArrayLength( - [CanBeNull] this DbFunctions _, - [NotNull] byte[] byteArray) + this DbFunctions _, + byte[] byteArray) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(ByteArrayLength))); + + + + #region Sample standard deviation + + /// + /// Returns the sample standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDev. + /// + /// The instance. + /// The values. + /// The computed sample standard deviation. + public static double? StandardDeviationSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationSample))); + + /// + /// Returns the sample standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDev. + /// + /// The instance. + /// The values. + /// The computed sample standard deviation. + public static double? StandardDeviationSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationSample))); + + /// + /// Returns the sample standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDev. + /// + /// The instance. + /// The values. + /// The computed sample standard deviation. + public static double? StandardDeviationSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationSample))); + + /// + /// Returns the sample standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDev. + /// + /// The instance. + /// The values. + /// The computed sample standard deviation. + public static double? StandardDeviationSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationSample))); + + /// + /// Returns the sample standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDev. + /// + /// The instance. + /// The values. + /// The computed sample standard deviation. + public static double? StandardDeviationSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationSample))); + + /// + /// Returns the sample standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDev. + /// + /// The instance. + /// The values. + /// The computed sample standard deviation. + public static double? StandardDeviationSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationSample))); + + /// + /// Returns the sample standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDev. + /// + /// The instance. + /// The values. + /// The computed sample standard deviation. + public static double? StandardDeviationSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationSample))); + + #endregion Sample standard deviation + + #region Population standard deviation + + /// + /// Returns the population standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDevP. + /// + /// The instance. + /// The values. + /// The computed population standard deviation. + public static double? StandardDeviationPopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationPopulation))); + + /// + /// Returns the population standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDevP. + /// + /// The instance. + /// The values. + /// The computed population standard deviation. + public static double? StandardDeviationPopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationPopulation))); + + /// + /// Returns the population standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDevP. + /// + /// The instance. + /// The values. + /// The computed population standard deviation. + public static double? StandardDeviationPopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationPopulation))); + + /// + /// Returns the population standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDevP. + /// + /// The instance. + /// The values. + /// The computed population standard deviation. + public static double? StandardDeviationPopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationPopulation))); + + /// + /// Returns the population standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDevP. + /// + /// The instance. + /// The values. + /// The computed population standard deviation. + public static double? StandardDeviationPopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationPopulation))); + + /// + /// Returns the population standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDevP. + /// + /// The instance. + /// The values. + /// The computed population standard deviation. + public static double? StandardDeviationPopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationPopulation))); + + /// + /// Returns the population standard deviation of all values in the specified expression. + /// Corresponds to Jet/MS Access StDevP. + /// + /// The instance. + /// The values. + /// The computed population standard deviation. + public static double? StandardDeviationPopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(StandardDeviationPopulation))); + + #endregion Population standard deviation + + #region Sample variance + + /// + /// Returns the sample variance of all values in the specified expression. + /// Corresponds to Jet/MS Access Var. + /// + /// The instance. + /// The values. + /// The computed sample variance. + public static double? VarianceSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VarianceSample))); + + /// + /// Returns the sample variance of all values in the specified expression. + /// Corresponds to Jet/MS Access Var. + /// + /// The instance. + /// The values. + /// The computed sample variance. + public static double? VarianceSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VarianceSample))); + + /// + /// Returns the sample variance of all values in the specified expression. + /// Corresponds to Jet/MS Access Var. + /// + /// The instance. + /// The values. + /// The computed sample variance. + public static double? VarianceSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VarianceSample))); + + /// + /// Returns the sample variance of all values in the specified expression. + /// Corresponds to Jet/MS Access Var. + /// + /// The instance. + /// The values. + /// The computed sample variance. + public static double? VarianceSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VarianceSample))); + + /// + /// Returns the sample variance of all values in the specified expression. + /// Corresponds to Jet/MS Access Var. + /// + /// The instance. + /// The values. + /// The computed sample variance. + public static double? VarianceSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VarianceSample))); + + /// + /// Returns the sample variance of all values in the specified expression. + /// Corresponds to Jet/MS Access Var. + /// + /// The instance. + /// The values. + /// The computed sample variance. + public static double? VarianceSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VarianceSample))); + + /// + /// Returns the sample variance of all values in the specified expression. + /// Corresponds to Jet/MS Access Var. + /// + /// The instance. + /// The values. + /// The computed sample variance. + public static double? VarianceSample(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VarianceSample))); + + #endregion Sample variance + + #region Population variance + + /// + /// Returns the population variance of all values in the specified expression. + /// Corresponds to Jet/MS Access VarP. + /// + /// The instance. + /// The values. + /// The computed population variance. + public static double? VariancePopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VariancePopulation))); + + /// + /// Returns the population variance of all values in the specified expression. + /// Corresponds to Jet/MS Access VarP. + /// + /// The instance. + /// The values. + /// The computed population variance. + public static double? VariancePopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VariancePopulation))); + + /// + /// Returns the population variance of all values in the specified expression. + /// Corresponds to Jet/MS Access VarP. + /// + /// The instance. + /// The values. + /// The computed population variance. + public static double? VariancePopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VariancePopulation))); + + /// + /// Returns the population variance of all values in the specified expression. + /// Corresponds to Jet/MS Access VarP. + /// + /// The instance. + /// The values. + /// The computed population variance. + public static double? VariancePopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VariancePopulation))); + + /// + /// Returns the population variance of all values in the specified expression. + /// Corresponds to Jet/MS Access VarP. + /// + /// The instance. + /// The values. + /// The computed population variance. + public static double? VariancePopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VariancePopulation))); + + /// + /// Returns the population variance of all values in the specified expression. + /// Corresponds to Jet/MS Access VarP. + /// + /// The instance. + /// The values. + /// The computed population variance. + public static double? VariancePopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VariancePopulation))); + + /// + /// Returns the population variance of all values in the specified expression. + /// Corresponds to Jet/MS Access VarP. + /// + /// The instance. + /// The values. + /// The computed population variance. + public static double? VariancePopulation(this DbFunctions _, IEnumerable values) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(VariancePopulation))); + + #endregion Population variance } } diff --git a/src/EFCore.Jet/Extensions/JetServiceCollectionExtensions.cs b/src/EFCore.Jet/Extensions/JetServiceCollectionExtensions.cs index de93ac24..02a843fe 100644 --- a/src/EFCore.Jet/Extensions/JetServiceCollectionExtensions.cs +++ b/src/EFCore.Jet/Extensions/JetServiceCollectionExtensions.cs @@ -59,6 +59,7 @@ public static IServiceCollection AddEntityFrameworkJet([NotNull] this IServiceCo .TryAdd(p => p.GetRequiredService()) .TryAdd() .TryAdd() + .TryAdd() .TryAdd() .TryAdd() .TryAdd() diff --git a/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetAggregateMethodCallTranslatorProvider.cs b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetAggregateMethodCallTranslatorProvider.cs new file mode 100644 index 00000000..c680d17e --- /dev/null +++ b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetAggregateMethodCallTranslatorProvider.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Query; + +namespace EntityFrameworkCore.Jet.Query.ExpressionTranslators.Internal; + +/// +/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to +/// the same compatibility standards as public APIs. It may be changed or removed without notice in +/// any release. You should only use it directly in your code with extreme caution and knowing that +/// doing so can result in application failures when updating to a new Entity Framework Core release. +/// +public class JetAggregateMethodCallTranslatorProvider : RelationalAggregateMethodCallTranslatorProvider +{ + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public JetAggregateMethodCallTranslatorProvider(RelationalAggregateMethodCallTranslatorProviderDependencies dependencies) + : base(dependencies) + { + var sqlExpressionFactory = dependencies.SqlExpressionFactory; + var typeMappingSource = dependencies.RelationalTypeMappingSource; + + AddTranslators( + [ + new JetStatisticsAggregateMethodTranslator(sqlExpressionFactory, typeMappingSource) + ]); + } +} diff --git a/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetMethodCallTranslatorProvider.cs b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetMethodCallTranslatorProvider.cs index 07a424d0..cdcfda16 100644 --- a/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetMethodCallTranslatorProvider.cs +++ b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetMethodCallTranslatorProvider.cs @@ -16,7 +16,7 @@ public class JetMethodCallTranslatorProvider : RelationalMethodCallTranslatorPro /// directly from your code. This API may change or be removed in future releases. /// public JetMethodCallTranslatorProvider( - [NotNull] RelationalMethodCallTranslatorProviderDependencies dependencies) + RelationalMethodCallTranslatorProviderDependencies dependencies) : base(dependencies) { var sqlExpressionFactory = (JetSqlExpressionFactory)dependencies.SqlExpressionFactory; diff --git a/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStatisticsAggregateMethodTranslator.cs b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStatisticsAggregateMethodTranslator.cs new file mode 100644 index 00000000..9974d9af --- /dev/null +++ b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStatisticsAggregateMethodTranslator.cs @@ -0,0 +1,72 @@ +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Diagnostics; +using Microsoft.EntityFrameworkCore.Query; +using Microsoft.EntityFrameworkCore.Query.SqlExpressions; +using Microsoft.EntityFrameworkCore.Storage; + +namespace EntityFrameworkCore.Jet.Query.ExpressionTranslators.Internal; + +/// +/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to +/// the same compatibility standards as public APIs. It may be changed or removed without notice in +/// any release. You should only use it directly in your code with extreme caution and knowing that +/// doing so can result in application failures when updating to a new Entity Framework Core release. +/// +public class JetStatisticsAggregateMethodTranslator : IAggregateMethodCallTranslator +{ + private readonly ISqlExpressionFactory _sqlExpressionFactory; + private readonly RelationalTypeMapping _doubleTypeMapping; + + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public JetStatisticsAggregateMethodTranslator( + ISqlExpressionFactory sqlExpressionFactory, + IRelationalTypeMappingSource typeMappingSource) + { + _sqlExpressionFactory = sqlExpressionFactory; + _doubleTypeMapping = typeMappingSource.FindMapping(typeof(double))!; + } + + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public virtual SqlExpression? Translate( + MethodInfo method, + EnumerableExpression source, + IReadOnlyList arguments, + IDiagnosticsLogger logger) + { + // Docs: https://docs.microsoft.com/sql/t-sql/functions/aggregate-functions-transact-sql + + if (method.DeclaringType != typeof(JetDbFunctionsExtensions) + || source.Selector is not SqlExpression sqlExpression) + { + return null; + } + + var functionName = method.Name switch + { + nameof(JetDbFunctionsExtensions.StandardDeviationSample) => "StDev", + nameof(JetDbFunctionsExtensions.StandardDeviationPopulation) => "StDevP", + nameof(JetDbFunctionsExtensions.VarianceSample) => "Var", + nameof(JetDbFunctionsExtensions.VariancePopulation) => "VarP", + _ => null + }; + + if (functionName is null) + { + return null; + } + + return _sqlExpressionFactory.Function(functionName, [sqlExpression], nullable: true, argumentsPropagateNullability: [false], typeof(double), _doubleTypeMapping); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs index 8ed9aa20..c5ff2fa4 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs @@ -461,420 +461,552 @@ public override async Task String_Compare_simple_zero(bool isAsync) { await base.String_Compare_simple_zero(isAsync); - // issue #15994 - // AssertSql( - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` = 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <> 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` > 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` > 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= 'ALFKI'"); + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <> 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` > 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` > 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= 'AROUT' +"""); } public override async Task String_Compare_simple_one(bool isAsync) { await base.String_Compare_simple_one(isAsync); - // issue #15994 - // AssertSql( - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` > 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` < 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` >= 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` >= 'ALFKI'"); + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` > 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` < 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` >= 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` >= 'AROUT' +"""); } public override async Task String_compare_with_parameter(bool isAsync) { await base.String_compare_with_parameter(isAsync); - // issue #15994 - // AssertSql( - // $@"{AssertSqlHelper.Declaration("@__customer_CustomerID_0='ALFKI' (Size = 4000)")} - - //SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` > @__customer_CustomerID_0", - // // - // $@"{AssertSqlHelper.Declaration("@__customer_CustomerID_0='ALFKI' (Size = 4000)")} - - //SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` < @__customer_CustomerID_0", - // // - // $@"{AssertSqlHelper.Declaration("@__customer_CustomerID_0='ALFKI' (Size = 4000)")} - - //SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= @__customer_CustomerID_0", - // // - // $@"{AssertSqlHelper.Declaration("@__customer_CustomerID_0='ALFKI' (Size = 4000)")} - - //SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= @__customer_CustomerID_0", - // // - // $@"{AssertSqlHelper.Declaration("@__customer_CustomerID_0='ALFKI' (Size = 4000)")} - - //SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` >= @__customer_CustomerID_0", - // // - // $@"{AssertSqlHelper.Declaration("@__customer_CustomerID_0='ALFKI' (Size = 4000)")} - - //SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` >= @__customer_CustomerID_0"); + AssertSql( +""" +@__customer_CustomerID_0='AROUT' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` > @__customer_CustomerID_0 +""", + // + """ +@__customer_CustomerID_0='AROUT' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` < @__customer_CustomerID_0 +""", + // + """ +@__customer_CustomerID_0='AROUT' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= @__customer_CustomerID_0 +""", + // + """ +@__customer_CustomerID_0='AROUT' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= @__customer_CustomerID_0 +""", + // + """ +@__customer_CustomerID_0='AROUT' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` >= @__customer_CustomerID_0 +""", + // + """ +@__customer_CustomerID_0='AROUT' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` >= @__customer_CustomerID_0 +"""); } public override async Task String_Compare_simple_more_than_one(bool isAsync) { await base.String_Compare_simple_more_than_one(isAsync); - // issue #15994 - // AssertSql( - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c`", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c`", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c`"); + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE IIF(`c`.`CustomerID` = 'ALFKI', 0, IIF(`c`.`CustomerID` > 'ALFKI', 1, IIF(`c`.`CustomerID` < 'ALFKI', -1, NULL))) = 42 +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE IIF(`c`.`CustomerID` = 'ALFKI', 0, IIF(`c`.`CustomerID` > 'ALFKI', 1, IIF(`c`.`CustomerID` < 'ALFKI', -1, NULL))) > 42 +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE 42 > IIF(`c`.`CustomerID` = 'ALFKI', 0, IIF(`c`.`CustomerID` > 'ALFKI', 1, IIF(`c`.`CustomerID` < 'ALFKI', -1, NULL))) +"""); } public override async Task String_Compare_nested(bool isAsync) { await base.String_Compare_nested(isAsync); - // issue #15994 - // AssertSql( - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` = 'M' + `c`.`CustomerID`", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <> UPPER(`c`.`CustomerID`)", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` > REPLACE('ALFKI', 'ALF', `c`.`CustomerID`)", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= 'M' + `c`.`CustomerID`", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` > UPPER(`c`.`CustomerID`)", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` < REPLACE('ALFKI', 'ALF', `c`.`CustomerID`)"); + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = ('M' & `c`.`CustomerID`) +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <> UCASE(`c`.`CustomerID`) +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` > REPLACE('ALFKI', 'ALF', `c`.`CustomerID`) +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= ('M' & `c`.`CustomerID`) +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` > UCASE(`c`.`CustomerID`) +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` < REPLACE('ALFKI', 'ALF', `c`.`CustomerID`) +"""); } public override async Task String_Compare_multi_predicate(bool isAsync) { await base.String_Compare_multi_predicate(isAsync); - // issue #15994 - // AssertSql( - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` >= 'ALFKI' AND `c`.`CustomerID` < 'CACTU'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`ContactTitle` = 'Owner' AND `c`.`Country` <> 'USA'"); + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` >= 'ALFKI' AND `c`.`CustomerID` < 'CACTU' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`ContactTitle` = 'Owner' AND (`c`.`Country` <> 'USA' OR `c`.`Country` IS NULL) +"""); } public override async Task String_Compare_to_simple_zero(bool isAsync) { await base.String_Compare_to_simple_zero(isAsync); - // issue #15994 - // AssertSql( - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` = 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <> 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` > 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` > 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= 'ALFKI'"); + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <> 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` > 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` > 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= 'AROUT' +"""); } public override async Task String_Compare_to_simple_one(bool isAsync) { await base.String_Compare_to_simple_one(isAsync); - // issue #15994 - // AssertSql( - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` > 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` < 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` >= 'ALFKI'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` >= 'ALFKI'"); + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` > 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` < 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` >= 'AROUT' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` >= 'AROUT' +"""); } public override async Task String_compare_to_with_parameter(bool isAsync) { await base.String_compare_to_with_parameter(isAsync); - // issue #15994 - // AssertSql( - // $@"{AssertSqlHelper.Declaration("@__customer_CustomerID_0='ALFKI' (Size = 4000)")} - - //SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` > @__customer_CustomerID_0", - // // - // $@"{AssertSqlHelper.Declaration("@__customer_CustomerID_0='ALFKI' (Size = 4000)")} - - //SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` < @__customer_CustomerID_0", - // // - // $@"{AssertSqlHelper.Declaration("@__customer_CustomerID_0='ALFKI' (Size = 4000)")} - - //SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= @__customer_CustomerID_0", - // // - // $@"{AssertSqlHelper.Declaration("@__customer_CustomerID_0='ALFKI' (Size = 4000)")} - - //SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= @__customer_CustomerID_0", - // // - // $@"{AssertSqlHelper.Declaration("@__customer_CustomerID_0='ALFKI' (Size = 4000)")} - - //SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` >= @__customer_CustomerID_0", - // // - // $@"{AssertSqlHelper.Declaration("@__customer_CustomerID_0='ALFKI' (Size = 4000)")} - - //SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` >= @__customer_CustomerID_0"); + AssertSql( +""" +@__customer_CustomerID_0='AROUT' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` > @__customer_CustomerID_0 +""", + // + """ +@__customer_CustomerID_0='AROUT' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` < @__customer_CustomerID_0 +""", + // + """ +@__customer_CustomerID_0='AROUT' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= @__customer_CustomerID_0 +""", + // + """ +@__customer_CustomerID_0='AROUT' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= @__customer_CustomerID_0 +""", + // + """ +@__customer_CustomerID_0='AROUT' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` >= @__customer_CustomerID_0 +""", + // + """ +@__customer_CustomerID_0='AROUT' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` >= @__customer_CustomerID_0 +"""); } public override async Task String_Compare_to_simple_more_than_one(bool isAsync) { await base.String_Compare_to_simple_more_than_one(isAsync); - // issue #15994 - // AssertSql( - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c`", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c`", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c`"); + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE IIF(`c`.`CustomerID` = 'ALFKI', 0, IIF(`c`.`CustomerID` > 'ALFKI', 1, IIF(`c`.`CustomerID` < 'ALFKI', -1, NULL))) = 42 +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE IIF(`c`.`CustomerID` = 'ALFKI', 0, IIF(`c`.`CustomerID` > 'ALFKI', 1, IIF(`c`.`CustomerID` < 'ALFKI', -1, NULL))) > 42 +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE 42 > IIF(`c`.`CustomerID` = 'ALFKI', 0, IIF(`c`.`CustomerID` > 'ALFKI', 1, IIF(`c`.`CustomerID` < 'ALFKI', -1, NULL))) +"""); } public override async Task String_Compare_to_nested(bool isAsync) { await base.String_Compare_to_nested(isAsync); - //issue #15994 - // AssertSql( - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` = 'M' + `c`.`CustomerID`", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <> UPPER(`c`.`CustomerID`)", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` > REPLACE('ALFKI', 'ALF', `c`.`CustomerID`)", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` <= 'M' + `c`.`CustomerID`", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` > UPPER(`c`.`CustomerID`)", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` < REPLACE('ALFKI', 'ALF', `c`.`CustomerID`)"); + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <> ('M' & `c`.`CustomerID`) +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = UCASE(`c`.`CustomerID`) +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` > REPLACE('AROUT', 'OUT', `c`.`CustomerID`) +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <= ('M' & `c`.`CustomerID`) +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` > UCASE(`c`.`CustomerID`) +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` < REPLACE('AROUT', 'OUT', `c`.`CustomerID`) +"""); } public override async Task String_Compare_to_multi_predicate(bool isAsync) { await base.String_Compare_to_multi_predicate(isAsync); - // issue #15994 - // AssertSql( - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`CustomerID` >= 'ALFKI' AND `c`.`CustomerID` < 'CACTU'", - // // - // $@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - //FROM `Customers` AS `c` - //WHERE `c`.`ContactTitle` = 'Owner' AND `c`.`Country` <> 'USA'"); + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` >= 'ALFKI' AND `c`.`CustomerID` < 'CACTU' +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`ContactTitle` = 'Owner' AND (`c`.`Country` <> 'USA' OR `c`.`Country` IS NULL) +"""); } public override async Task DateTime_Compare_to_simple_zero(bool isAsync, bool compareTo) { await base.DateTime_Compare_to_simple_zero(isAsync, compareTo); - // issue #15994 - // AssertSql( - // $@"{AssertSqlHelper.Declaration("@__myDatetime_0='1998-05-04T00:00:00'")} - - //SELECT `c`.`OrderID`, `c`.`CustomerID`, `c`.`EmployeeID`, `c`.`OrderDate` - //FROM `Orders` AS `c` - //WHERE `c`.`OrderDate` = @__myDatetime_0", - // // - // $@"{AssertSqlHelper.Declaration("@__myDatetime_0='1998-05-04T00:00:00'")} - - //SELECT `c`.`OrderID`, `c`.`CustomerID`, `c`.`EmployeeID`, `c`.`OrderDate` - //FROM `Orders` AS `c` - //WHERE `c`.`OrderDate` <> @__myDatetime_0", - // // - // $@"{AssertSqlHelper.Declaration("@__myDatetime_0='1998-05-04T00:00:00'")} - - //SELECT `c`.`OrderID`, `c`.`CustomerID`, `c`.`EmployeeID`, `c`.`OrderDate` - //FROM `Orders` AS `c` - //WHERE `c`.`OrderDate` > @__myDatetime_0", - // // - // $@"{AssertSqlHelper.Declaration("@__myDatetime_0='1998-05-04T00:00:00'")} - - //SELECT `c`.`OrderID`, `c`.`CustomerID`, `c`.`EmployeeID`, `c`.`OrderDate` - //FROM `Orders` AS `c` - //WHERE `c`.`OrderDate` <= @__myDatetime_0", - // // - // $@"{AssertSqlHelper.Declaration("@__myDatetime_0='1998-05-04T00:00:00'")} - - //SELECT `c`.`OrderID`, `c`.`CustomerID`, `c`.`EmployeeID`, `c`.`OrderDate` - //FROM `Orders` AS `c` - //WHERE `c`.`OrderDate` > @__myDatetime_0", - // // - // $@"{AssertSqlHelper.Declaration("@__myDatetime_0='1998-05-04T00:00:00'")} - - //SELECT `c`.`OrderID`, `c`.`CustomerID`, `c`.`EmployeeID`, `c`.`OrderDate` - //FROM `Orders` AS `c` - //WHERE `c`.`OrderDate` <= @__myDatetime_0"); + AssertSql( + """ +@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderDate` = CDATE(@__myDatetime_0) +""", + // + """ +@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderDate` <> CDATE(@__myDatetime_0) OR `o`.`OrderDate` IS NULL +""", + // + """ +@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderDate` > CDATE(@__myDatetime_0) +""", + // + """ +@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderDate` <= CDATE(@__myDatetime_0) +""", + // + """ +@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderDate` > CDATE(@__myDatetime_0) +""", + // + """ +@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderDate` <= CDATE(@__myDatetime_0) +"""); } public override async Task Int_Compare_to_simple_zero(bool isAsync) { await base.Int_Compare_to_simple_zero(isAsync); - // issue #15994 - // AssertSql( - // $@"{AssertSqlHelper.Declaration("@__orderId_0='10250'")} - - //SELECT `c`.`OrderID`, `c`.`CustomerID`, `c`.`EmployeeID`, `c`.`OrderDate` - //FROM `Orders` AS `c` - //WHERE `c`.`OrderID` = @__orderId_0", - // // - // $@"{AssertSqlHelper.Declaration("@__orderId_0='10250'")} - - //SELECT `c`.`OrderID`, `c`.`CustomerID`, `c`.`EmployeeID`, `c`.`OrderDate` - //FROM `Orders` AS `c` - //WHERE `c`.`OrderID` <> @__orderId_0", - // // - // $@"{AssertSqlHelper.Declaration("@__orderId_0='10250'")} - - //SELECT `c`.`OrderID`, `c`.`CustomerID`, `c`.`EmployeeID`, `c`.`OrderDate` - //FROM `Orders` AS `c` - //WHERE `c`.`OrderID` > @__orderId_0", - // // - // $@"{AssertSqlHelper.Declaration("@__orderId_0='10250'")} - - //SELECT `c`.`OrderID`, `c`.`CustomerID`, `c`.`EmployeeID`, `c`.`OrderDate` - //FROM `Orders` AS `c` - //WHERE `c`.`OrderID` <= @__orderId_0", - // // - // $@"{AssertSqlHelper.Declaration("@__orderId_0='10250'")} - - //SELECT `c`.`OrderID`, `c`.`CustomerID`, `c`.`EmployeeID`, `c`.`OrderDate` - //FROM `Orders` AS `c` - //WHERE `c`.`OrderID` > @__orderId_0", - // // - // $@"{AssertSqlHelper.Declaration("@__orderId_0='10250'")} - - //SELECT `c`.`OrderID`, `c`.`CustomerID`, `c`.`EmployeeID`, `c`.`OrderDate` - //FROM `Orders` AS `c` - //WHERE `c`.`OrderID` <= @__orderId_0"); + AssertSql( + """ +@__orderId_0='10250' + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` = @__orderId_0 +""", + // + """ +@__orderId_0='10250' + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` <> @__orderId_0 +""", + // + """ +@__orderId_0='10250' + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` > @__orderId_0 +""", + // + """ +@__orderId_0='10250' + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` <= @__orderId_0 +""", + // + """ +@__orderId_0='10250' + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` > @__orderId_0 +""", + // + """ +@__orderId_0='10250' + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` <= @__orderId_0 +"""); } public override async Task Where_math_abs1(bool isAsync) @@ -2554,8 +2686,9 @@ public override async Task String_Contains_with_StringComparison_unsupported(boo AssertSql(); } - /*[ConditionalTheory` - [MemberData(nameof(IsAsyncData))` + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] public virtual async Task StandardDeviation(bool async) { await using var ctx = CreateContext(); @@ -2579,15 +2712,15 @@ public virtual async Task StandardDeviation(bool async) Assert.Equal(7.759999999999856, product9.PopulationStandardDeviation.Value, 5); AssertSql( - """ -SELECT [o`.[ProductID`, STDEV([o`.[UnitPrice`) AS [SampleStandardDeviation`, STDEVP([o`.[UnitPrice`) AS [PopulationStandardDeviation` -FROM [Order Details` AS [o` -GROUP BY [o`.[ProductID` + """ +SELECT `o`.`ProductID`, StDev(`o`.`UnitPrice`) AS `SampleStandardDeviation`, StDevP(`o`.`UnitPrice`) AS `PopulationStandardDeviation` +FROM `Order Details` AS `o` +GROUP BY `o`.`ProductID` """); } - [ConditionalTheory` - [MemberData(nameof(IsAsyncData))` + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] public virtual async Task Variance(bool async) { await using var ctx = CreateContext(); @@ -2611,12 +2744,12 @@ public virtual async Task Variance(bool async) Assert.Equal(60.217599999997766, product9.PopulationStandardDeviation.Value, 5); AssertSql( - """ -SELECT [o`.[ProductID`, VAR([o`.[UnitPrice`) AS [SampleStandardDeviation`, VARP([o`.[UnitPrice`) AS [PopulationStandardDeviation` -FROM [Order Details` AS [o` -GROUP BY [o`.[ProductID` + """ +SELECT `o`.`ProductID`, Var(`o`.`UnitPrice`) AS `SampleStandardDeviation`, VarP(`o`.`UnitPrice`) AS `PopulationStandardDeviation` +FROM `Order Details` AS `o` +GROUP BY `o`.`ProductID` """); - }*/ + } private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); From 72ba5cd056af56e9c31b5b3b680702fca7390343 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sun, 13 Oct 2024 19:59:02 +0800 Subject: [PATCH 2/3] Update tests for ODBC style --- ...orthwindFunctionsQueryJetTest.Functions.cs | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs index c5ff2fa4..2e9acb07 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs @@ -546,52 +546,52 @@ public override async Task String_compare_with_parameter(bool isAsync) await base.String_compare_with_parameter(isAsync); AssertSql( -""" +$""" @__customer_CustomerID_0='AROUT' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > @__customer_CustomerID_0 +WHERE `c`.`CustomerID` > {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} """, // - """ + $""" @__customer_CustomerID_0='AROUT' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` < @__customer_CustomerID_0 +WHERE `c`.`CustomerID` < {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} """, // - """ + $""" @__customer_CustomerID_0='AROUT' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= @__customer_CustomerID_0 +WHERE `c`.`CustomerID` <= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} """, // - """ + $""" @__customer_CustomerID_0='AROUT' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= @__customer_CustomerID_0 +WHERE `c`.`CustomerID` <= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} """, // - """ + $""" @__customer_CustomerID_0='AROUT' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= @__customer_CustomerID_0 +WHERE `c`.`CustomerID` >= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} """, // - """ + $""" @__customer_CustomerID_0='AROUT' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= @__customer_CustomerID_0 +WHERE `c`.`CustomerID` >= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} """); } @@ -768,52 +768,52 @@ public override async Task String_compare_to_with_parameter(bool isAsync) await base.String_compare_to_with_parameter(isAsync); AssertSql( -""" +$""" @__customer_CustomerID_0='AROUT' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > @__customer_CustomerID_0 +WHERE `c`.`CustomerID` > {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} """, // - """ + $""" @__customer_CustomerID_0='AROUT' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` < @__customer_CustomerID_0 +WHERE `c`.`CustomerID` < {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} """, // - """ + $""" @__customer_CustomerID_0='AROUT' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= @__customer_CustomerID_0 +WHERE `c`.`CustomerID` <= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} """, // - """ + $""" @__customer_CustomerID_0='AROUT' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= @__customer_CustomerID_0 +WHERE `c`.`CustomerID` <= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} """, // - """ + $""" @__customer_CustomerID_0='AROUT' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= @__customer_CustomerID_0 +WHERE `c`.`CustomerID` >= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} """, // - """ + $""" @__customer_CustomerID_0='AROUT' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= @__customer_CustomerID_0 +WHERE `c`.`CustomerID` >= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} """); } @@ -906,52 +906,52 @@ public override async Task DateTime_Compare_to_simple_zero(bool isAsync, bool co await base.DateTime_Compare_to_simple_zero(isAsync, compareTo); AssertSql( - """ + $""" @__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderDate` = CDATE(@__myDatetime_0) +WHERE `o`.`OrderDate` = CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) """, // - """ + $""" @__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderDate` <> CDATE(@__myDatetime_0) OR `o`.`OrderDate` IS NULL +WHERE `o`.`OrderDate` <> CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) OR `o`.`OrderDate` IS NULL """, // - """ + $""" @__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderDate` > CDATE(@__myDatetime_0) +WHERE `o`.`OrderDate` > CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) """, // - """ + $""" @__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderDate` <= CDATE(@__myDatetime_0) +WHERE `o`.`OrderDate` <= CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) """, // - """ + $""" @__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderDate` > CDATE(@__myDatetime_0) +WHERE `o`.`OrderDate` > CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) """, // - """ + $""" @__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderDate` <= CDATE(@__myDatetime_0) +WHERE `o`.`OrderDate` <= CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) """); } @@ -960,52 +960,52 @@ public override async Task Int_Compare_to_simple_zero(bool isAsync) await base.Int_Compare_to_simple_zero(isAsync); AssertSql( - """ + $""" @__orderId_0='10250' SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderID` = @__orderId_0 +WHERE `o`.`OrderID` = {AssertSqlHelper.Parameter("@__orderId_0")} """, // - """ + $""" @__orderId_0='10250' SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderID` <> @__orderId_0 +WHERE `o`.`OrderID` <> {AssertSqlHelper.Parameter("@__orderId_0")} """, // - """ + $""" @__orderId_0='10250' SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderID` > @__orderId_0 +WHERE `o`.`OrderID` > {AssertSqlHelper.Parameter("@__orderId_0")} """, // - """ + $""" @__orderId_0='10250' SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderID` <= @__orderId_0 +WHERE `o`.`OrderID` <= {AssertSqlHelper.Parameter("@__orderId_0")} """, // - """ + $""" @__orderId_0='10250' SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderID` > @__orderId_0 +WHERE `o`.`OrderID` > {AssertSqlHelper.Parameter("@__orderId_0")} """, // - """ + $""" @__orderId_0='10250' SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderID` <= @__orderId_0 +WHERE `o`.`OrderID` <= {AssertSqlHelper.Parameter("@__orderId_0")} """); } From e18a55169ff089e9cdf0ab3852c1f7c99e4cfdc6 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 13 Oct 2024 12:20:25 +0000 Subject: [PATCH 3/3] [GitHub Actions] Update green tests. --- .../GreenTests/ace_2010_odbc_x86.txt | 4 ++++ .../GreenTests/ace_2010_oledb_x86.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt index 4dc10a80..8be808ee 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt @@ -13060,6 +13060,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Sel EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Select_mathf_truncate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Select_ToString_IndexOf(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Select_ToString_IndexOf(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.StandardDeviation(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.StandardDeviation(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Static_equals_int_compared_to_long(isAsync: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Static_equals_int_compared_to_long(isAsync: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Static_equals_nullable_datetime_compared_to_non_nullable(isAsync: False) @@ -13194,6 +13196,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Tri EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.TrimEnd_without_arguments_in_predicate(isAsync: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.TrimStart_without_arguments_in_predicate(isAsync: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.TrimStart_without_arguments_in_predicate(isAsync: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Variance(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Variance(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Where_DateOnly_FromDateTime(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Where_DateOnly_FromDateTime(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Where_functions_nested(isAsync: False) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt index fb80f7bc..a7051d59 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -14350,6 +14350,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Sel EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Select_mathf_truncate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Select_ToString_IndexOf(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Select_ToString_IndexOf(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.StandardDeviation(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.StandardDeviation(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Static_equals_int_compared_to_long(isAsync: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Static_equals_int_compared_to_long(isAsync: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Static_equals_nullable_datetime_compared_to_non_nullable(isAsync: False) @@ -14484,6 +14486,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Tri EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.TrimEnd_without_arguments_in_predicate(isAsync: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.TrimStart_without_arguments_in_predicate(isAsync: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.TrimStart_without_arguments_in_predicate(isAsync: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Variance(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Variance(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Where_DateOnly_FromDateTime(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Where_DateOnly_FromDateTime(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindFunctionsQueryJetTest.Where_functions_nested(isAsync: False)