From afef2e53924e1610d32f04cd7f76c40ac602ff4c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 24 Aug 2023 16:33:37 +0000 Subject: [PATCH 1/4] Update dependencies from https://github.com/dotnet/runtime build 20230823.11 (#31543) [release/8.0] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 52 ++++++++++++++++++++--------------------- eng/Versions.props | 26 ++++++++++----------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 444e1edf90c..95e5d687d5c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,58 +1,58 @@ - + https://github.com/dotnet/runtime - 90b92bb265a412592c4c152983d7b30c92236dbe + 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 - + https://github.com/dotnet/runtime - 90b92bb265a412592c4c152983d7b30c92236dbe + 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 - + https://github.com/dotnet/runtime - 90b92bb265a412592c4c152983d7b30c92236dbe + 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 - + https://github.com/dotnet/runtime - 90b92bb265a412592c4c152983d7b30c92236dbe + 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 - + https://github.com/dotnet/runtime - 90b92bb265a412592c4c152983d7b30c92236dbe + 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 - + https://github.com/dotnet/runtime - 90b92bb265a412592c4c152983d7b30c92236dbe + 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 - + https://github.com/dotnet/runtime - 90b92bb265a412592c4c152983d7b30c92236dbe + 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 - + https://github.com/dotnet/runtime - 90b92bb265a412592c4c152983d7b30c92236dbe + 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 - + https://github.com/dotnet/runtime - 90b92bb265a412592c4c152983d7b30c92236dbe + 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 - + https://github.com/dotnet/runtime - 90b92bb265a412592c4c152983d7b30c92236dbe + 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 - + https://github.com/dotnet/runtime - 90b92bb265a412592c4c152983d7b30c92236dbe + 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 - + https://github.com/dotnet/runtime - 90b92bb265a412592c4c152983d7b30c92236dbe + 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 - + https://github.com/dotnet/runtime - 90b92bb265a412592c4c152983d7b30c92236dbe + 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 diff --git a/eng/Versions.props b/eng/Versions.props index b14d08d2f99..2756d32dea3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,19 +16,19 @@ False - 8.0.0-rc.2.23418.14 - 8.0.0-rc.2.23418.14 - 8.0.0-rc.2.23418.14 - 8.0.0-rc.2.23418.14 - 8.0.0-rc.2.23418.14 - 8.0.0-rc.2.23418.14 - 8.0.0-rc.2.23418.14 - 8.0.0-rc.2.23418.14 - 8.0.0-rc.2.23418.14 - 8.0.0-rc.2.23418.14 - 8.0.0-rc.2.23418.14 - 8.0.0-rc.2.23418.14 - 8.0.0-rc.2.23418.14 + 8.0.0-rc.2.23423.11 + 8.0.0-rc.2.23423.11 + 8.0.0-rc.2.23423.11 + 8.0.0-rc.2.23423.11 + 8.0.0-rc.2.23423.11 + 8.0.0-rc.2.23423.11 + 8.0.0-rc.2.23423.11 + 8.0.0-rc.2.23423.11 + 8.0.0-rc.2.23423.11 + 8.0.0-rc.2.23423.11 + 8.0.0-rc.2.23423.11 + 8.0.0-rc.2.23423.11 + 8.0.0-rc.2.23423.11 8.0.0-beta.23419.1 From e1eb9a635f49cda84dbe7d583e7d8f03d3938c2a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 26 Aug 2023 03:26:26 +0000 Subject: [PATCH 2/4] Update dependencies from https://github.com/dotnet/runtime build 20230825.9 (#31557) [release/8.0] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 52 ++++++++++++++++++++--------------------- eng/Versions.props | 26 ++++++++++----------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 95e5d687d5c..7fe53f190c3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,58 +1,58 @@ - + https://github.com/dotnet/runtime - 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 + d379e3a1fe89d463ae55b86525fbd7713e983d9e - + https://github.com/dotnet/runtime - 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 + d379e3a1fe89d463ae55b86525fbd7713e983d9e - + https://github.com/dotnet/runtime - 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 + d379e3a1fe89d463ae55b86525fbd7713e983d9e - + https://github.com/dotnet/runtime - 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 + d379e3a1fe89d463ae55b86525fbd7713e983d9e - + https://github.com/dotnet/runtime - 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 + d379e3a1fe89d463ae55b86525fbd7713e983d9e - + https://github.com/dotnet/runtime - 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 + d379e3a1fe89d463ae55b86525fbd7713e983d9e - + https://github.com/dotnet/runtime - 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 + d379e3a1fe89d463ae55b86525fbd7713e983d9e - + https://github.com/dotnet/runtime - 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 + d379e3a1fe89d463ae55b86525fbd7713e983d9e - + https://github.com/dotnet/runtime - 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 + d379e3a1fe89d463ae55b86525fbd7713e983d9e - + https://github.com/dotnet/runtime - 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 + d379e3a1fe89d463ae55b86525fbd7713e983d9e - + https://github.com/dotnet/runtime - 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 + d379e3a1fe89d463ae55b86525fbd7713e983d9e - + https://github.com/dotnet/runtime - 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 + d379e3a1fe89d463ae55b86525fbd7713e983d9e - + https://github.com/dotnet/runtime - 3d1b2543593f0dc3fbbdc2b8cad9b1f8e7554af6 + d379e3a1fe89d463ae55b86525fbd7713e983d9e diff --git a/eng/Versions.props b/eng/Versions.props index 2756d32dea3..5ebbd1b2534 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,19 +16,19 @@ False - 8.0.0-rc.2.23423.11 - 8.0.0-rc.2.23423.11 - 8.0.0-rc.2.23423.11 - 8.0.0-rc.2.23423.11 - 8.0.0-rc.2.23423.11 - 8.0.0-rc.2.23423.11 - 8.0.0-rc.2.23423.11 - 8.0.0-rc.2.23423.11 - 8.0.0-rc.2.23423.11 - 8.0.0-rc.2.23423.11 - 8.0.0-rc.2.23423.11 - 8.0.0-rc.2.23423.11 - 8.0.0-rc.2.23423.11 + 8.0.0-rc.2.23425.9 + 8.0.0-rc.2.23425.9 + 8.0.0-rc.2.23425.9 + 8.0.0-rc.2.23425.9 + 8.0.0-rc.2.23425.9 + 8.0.0-rc.2.23425.9 + 8.0.0-rc.2.23425.9 + 8.0.0-rc.2.23425.9 + 8.0.0-rc.2.23425.9 + 8.0.0-rc.2.23425.9 + 8.0.0-rc.2.23425.9 + 8.0.0-rc.2.23425.9 + 8.0.0-rc.2.23425.9 8.0.0-beta.23419.1 From 1e2660954847624620dc7c31d3cd8181dea42461 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 27 Aug 2023 03:18:41 +0000 Subject: [PATCH 3/4] Update dependencies from https://github.com/dotnet/runtime build 20230826.4 (#31561) [release/8.0] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 52 ++++++++++++++++++++--------------------- eng/Versions.props | 26 ++++++++++----------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7fe53f190c3..0c6520bc93a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,58 +1,58 @@ - + https://github.com/dotnet/runtime - d379e3a1fe89d463ae55b86525fbd7713e983d9e + 4122c63a13cfe40e97ac1f9ef01d8110a66943f4 - + https://github.com/dotnet/runtime - d379e3a1fe89d463ae55b86525fbd7713e983d9e + 4122c63a13cfe40e97ac1f9ef01d8110a66943f4 - + https://github.com/dotnet/runtime - d379e3a1fe89d463ae55b86525fbd7713e983d9e + 4122c63a13cfe40e97ac1f9ef01d8110a66943f4 - + https://github.com/dotnet/runtime - d379e3a1fe89d463ae55b86525fbd7713e983d9e + 4122c63a13cfe40e97ac1f9ef01d8110a66943f4 - + https://github.com/dotnet/runtime - d379e3a1fe89d463ae55b86525fbd7713e983d9e + 4122c63a13cfe40e97ac1f9ef01d8110a66943f4 - + https://github.com/dotnet/runtime - d379e3a1fe89d463ae55b86525fbd7713e983d9e + 4122c63a13cfe40e97ac1f9ef01d8110a66943f4 - + https://github.com/dotnet/runtime - d379e3a1fe89d463ae55b86525fbd7713e983d9e + 4122c63a13cfe40e97ac1f9ef01d8110a66943f4 - + https://github.com/dotnet/runtime - d379e3a1fe89d463ae55b86525fbd7713e983d9e + 4122c63a13cfe40e97ac1f9ef01d8110a66943f4 - + https://github.com/dotnet/runtime - d379e3a1fe89d463ae55b86525fbd7713e983d9e + 4122c63a13cfe40e97ac1f9ef01d8110a66943f4 - + https://github.com/dotnet/runtime - d379e3a1fe89d463ae55b86525fbd7713e983d9e + 4122c63a13cfe40e97ac1f9ef01d8110a66943f4 - + https://github.com/dotnet/runtime - d379e3a1fe89d463ae55b86525fbd7713e983d9e + 4122c63a13cfe40e97ac1f9ef01d8110a66943f4 - + https://github.com/dotnet/runtime - d379e3a1fe89d463ae55b86525fbd7713e983d9e + 4122c63a13cfe40e97ac1f9ef01d8110a66943f4 - + https://github.com/dotnet/runtime - d379e3a1fe89d463ae55b86525fbd7713e983d9e + 4122c63a13cfe40e97ac1f9ef01d8110a66943f4 diff --git a/eng/Versions.props b/eng/Versions.props index 5ebbd1b2534..1627f6f945f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,19 +16,19 @@ False - 8.0.0-rc.2.23425.9 - 8.0.0-rc.2.23425.9 - 8.0.0-rc.2.23425.9 - 8.0.0-rc.2.23425.9 - 8.0.0-rc.2.23425.9 - 8.0.0-rc.2.23425.9 - 8.0.0-rc.2.23425.9 - 8.0.0-rc.2.23425.9 - 8.0.0-rc.2.23425.9 - 8.0.0-rc.2.23425.9 - 8.0.0-rc.2.23425.9 - 8.0.0-rc.2.23425.9 - 8.0.0-rc.2.23425.9 + 8.0.0-rc.2.23426.4 + 8.0.0-rc.2.23426.4 + 8.0.0-rc.2.23426.4 + 8.0.0-rc.2.23426.4 + 8.0.0-rc.2.23426.4 + 8.0.0-rc.2.23426.4 + 8.0.0-rc.2.23426.4 + 8.0.0-rc.2.23426.4 + 8.0.0-rc.2.23426.4 + 8.0.0-rc.2.23426.4 + 8.0.0-rc.2.23426.4 + 8.0.0-rc.2.23426.4 + 8.0.0-rc.2.23426.4 8.0.0-beta.23419.1 From affd44045f41a2dd58c5667ce3938e42568fbe84 Mon Sep 17 00:00:00 2001 From: Simon S <54024766+smnsht@users.noreply.github.com> Date: Mon, 28 Aug 2023 21:12:43 +0300 Subject: [PATCH 4/4] 31355: SQLite: Add EF.Functions.Unhex (#31454) Fixes #31355 Co-authored-by: Brice Lambson --- .../Extensions/SqliteDbFunctionsExtensions.cs | 27 +++++++++++++ .../Internal/SqliteHexMethodTranslator.cs | 21 +++++++++- .../BuiltInDataTypesSqliteTest.cs | 40 +++++++++++++++++++ 3 files changed, 86 insertions(+), 2 deletions(-) diff --git a/src/EFCore.Sqlite.Core/Extensions/SqliteDbFunctionsExtensions.cs b/src/EFCore.Sqlite.Core/Extensions/SqliteDbFunctionsExtensions.cs index 585a0936030..f52da2ec8f4 100644 --- a/src/EFCore.Sqlite.Core/Extensions/SqliteDbFunctionsExtensions.cs +++ b/src/EFCore.Sqlite.Core/Extensions/SqliteDbFunctionsExtensions.cs @@ -43,6 +43,33 @@ public static bool Glob(this DbFunctions _, string matchExpression, string patte public static string Hex(this DbFunctions _, byte[] bytes) => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(Hex))); + /// + /// Maps to the SQLite unhex function which returns a BLOB representing decoding of the hexadecimal string. + /// + /// + /// See Database functions, and + /// Accessing SQLite databases with EF Core for more information and examples. + /// + /// The instance. + /// The hexadecimal string. + /// Decoded hexadecimal string as binary value. + public static byte[] Unhex(this DbFunctions _, string value) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(Unhex))); + + /// + /// Maps to the SQLite unhex function which returns a BLOB representing decoding of the hexadecimal string. + /// + /// + /// See Database functions, and + /// Accessing SQLite databases with EF Core for more information and examples. + /// + /// The instance. + /// The hexadecimal string. + /// Characters that are ignored in . + /// Decoded hexadecimal string as binary value. + public static byte[] Unhex(this DbFunctions _, string value, string ignoreChars) + => throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(Unhex))); + /// /// Maps to the SQLite substr function which returns a subarray of the specified value. The subarray starts /// at and continues to the end of the value. diff --git a/src/EFCore.Sqlite.Core/Query/Internal/SqliteHexMethodTranslator.cs b/src/EFCore.Sqlite.Core/Query/Internal/SqliteHexMethodTranslator.cs index 68e759f7a85..ede730114ed 100644 --- a/src/EFCore.Sqlite.Core/Query/Internal/SqliteHexMethodTranslator.cs +++ b/src/EFCore.Sqlite.Core/Query/Internal/SqliteHexMethodTranslator.cs @@ -13,9 +13,15 @@ namespace Microsoft.EntityFrameworkCore.Sqlite.Query.Internal; /// public class SqliteHexMethodTranslator : IMethodCallTranslator { - private static readonly MethodInfo MethodInfo = typeof(SqliteDbFunctionsExtensions) + private static readonly MethodInfo HexMethodInfo = typeof(SqliteDbFunctionsExtensions) .GetMethod(nameof(SqliteDbFunctionsExtensions.Hex), new[] { typeof(DbFunctions), typeof(byte[]) })!; + private static readonly MethodInfo UnhexMethodInfo = typeof(SqliteDbFunctionsExtensions) + .GetMethod(nameof(SqliteDbFunctionsExtensions.Unhex), new[] { typeof(DbFunctions), typeof(string) })!; + + private static readonly MethodInfo UnhexWithIgnoreCharsMethodInfo = typeof(SqliteDbFunctionsExtensions) + .GetMethod(nameof(SqliteDbFunctionsExtensions.Unhex), new[] { typeof(DbFunctions), typeof(string), typeof(string) })!; + private readonly ISqlExpressionFactory _sqlExpressionFactory; /// @@ -41,7 +47,7 @@ public SqliteHexMethodTranslator(ISqlExpressionFactory sqlExpressionFactory) IReadOnlyList arguments, IDiagnosticsLogger logger) { - if (method.Equals(MethodInfo)) + if (method.Equals(HexMethodInfo)) { return _sqlExpressionFactory.Function( "hex", @@ -51,6 +57,17 @@ public SqliteHexMethodTranslator(ISqlExpressionFactory sqlExpressionFactory) typeof(string)); } + if (method.Equals(UnhexMethodInfo) + || method.Equals(UnhexWithIgnoreCharsMethodInfo)) + { + return _sqlExpressionFactory.Function( + "unhex", + arguments.Skip(1), + nullable: true, + arguments.Skip(1).Select(_ => true).ToArray(), + typeof(byte[])); + } + return null; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs index 08fc4c6e23a..c1a73c88ac5 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs @@ -1546,6 +1546,46 @@ SELECT hex("o"."Bytes") Assert.Equal(expectedResults, results); } + [ConditionalFact] + public virtual void Can_query_using_unhex_function() + { + using var context = CreateContext(); + + var results = context.Set() + .Select(e => EF.Functions.Unhex(EF.Functions.Hex(e.Bytes))).ToList(); + + AssertSql( +""" +SELECT unhex(hex("o"."Bytes")) +FROM "ObjectBackedDataTypes" AS "o" +"""); + + var expectedResults = context.Set().AsEnumerable() + .Select(e => e.Bytes).ToList(); + + Assert.Equal(expectedResults, results); + } + + [ConditionalFact] + public virtual void Can_query_using_unhex_function_with_ignore_chars() + { + using var context = CreateContext(); + + var results = context.Set() + .Select(e => EF.Functions.Unhex(EF.Functions.Hex(e.Bytes) + "!?", "!?")).ToList(); + + AssertSql( +""" +SELECT unhex(COALESCE(hex("o"."Bytes"), '') || '!?', '!?') +FROM "ObjectBackedDataTypes" AS "o" +"""); + + var expectedResults = context.Set().AsEnumerable() + .Select(e => e.Bytes).ToList(); + + Assert.Equal(expectedResults, results); + } + [ConditionalFact] public virtual void Can_query_using_substr_function() {