-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix SQLite decimal comparison with turkish culture #37429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
55b5f7d
[release/10.0] Source code updates from dotnet/dotnet (#37412)
dotnet-maestro[bot] d7a0830
[release/10.0] Source code updates from dotnet/dotnet (#37421)
dotnet-maestro[bot] ac4d0ea
Ensure decimal collation uses invariant culture
salihozkara 4a2a691
Remove unused using directive in test file
salihozkara d9d9d96
Update decimal test values in Turkish culture test
salihozkara f5f312f
Merge branch 'main' into fix-sqlite-decimal-compare
AndriySvyryd c171fd4
Update src/EFCore.Sqlite.Core/Storage/Internal/SqliteRelationalConnec…
salihozkara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
|
|
||
| using System.Text.RegularExpressions; | ||
| using Microsoft.EntityFrameworkCore.Sqlite.Internal; | ||
| using Microsoft.EntityFrameworkCore.TestUtilities.Xunit; | ||
|
|
||
| // ReSharper disable InconsistentNaming | ||
| // ReSharper disable ParameterOnlyUsedForPreconditionCheck.Local | ||
|
|
@@ -1544,6 +1545,76 @@ LIMIT 1 | |
| Assert.Equal(expectedResults, results); | ||
| } | ||
|
|
||
| [ConditionalFact, UseCulture("tr-TR")] | ||
| public virtual void Can_query_OrderBy_decimal_with_Turkish_culture() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please reduce this test to the bare minimum, removing all the unneeded stuff? Check out the minimal repro posted here. |
||
| { | ||
| using var context = CreateContext(); | ||
| var min = new BuiltInDataTypes | ||
| { | ||
| Id = 225, | ||
| PartitionId = 209, | ||
| TestDecimal = 1.05m, | ||
| TestDateTimeOffset = new DateTimeOffset(2018, 1, 1, 12, 0, 0, TimeSpan.Zero), | ||
| TestTimeSpan = TimeSpan.FromDays(1), | ||
| TestUnsignedInt64 = 0 | ||
| }; | ||
| context.Add(min); | ||
|
|
||
| var middle = new BuiltInDataTypes | ||
| { | ||
| Id = 226, | ||
| PartitionId = 209, | ||
| TestDecimal = 1.5m, | ||
| TestDateTimeOffset = new DateTimeOffset(2018, 1, 1, 12, 0, 0, TimeSpan.Zero), | ||
| TestTimeSpan = TimeSpan.FromDays(2), | ||
| TestUnsignedInt64 = 1 | ||
| }; | ||
| context.Add(middle); | ||
|
|
||
| var max = new BuiltInDataTypes | ||
| { | ||
salihozkara marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Id = 227, | ||
| PartitionId = 209, | ||
| TestDecimal = 2.5m, | ||
| TestDateTimeOffset = new DateTimeOffset(2018, 1, 1, 11, 0, 0, TimeSpan.FromHours(-2)), | ||
| TestTimeSpan = TimeSpan.FromDays(10), | ||
| TestUnsignedInt64 = long.MaxValue + 1ul | ||
| }; | ||
| context.Add(max); | ||
|
|
||
| context.SaveChanges(); | ||
|
|
||
| Fixture.TestSqlLoggerFactory.Clear(); | ||
|
|
||
| var query = context.Set<BuiltInDataTypes>() | ||
| .Where(e => e.PartitionId == 209); | ||
|
|
||
| var results = query | ||
| .OrderBy(e => e.TestDecimal) | ||
| .Select(e => new { e.Id, e.TestDecimal }) | ||
| .ToList(); | ||
|
|
||
| AssertSql( | ||
| """ | ||
| SELECT "b"."Id", "b"."TestDecimal" | ||
| FROM "BuiltInDataTypes" AS "b" | ||
| WHERE "b"."PartitionId" = 209 | ||
| ORDER BY "b"."TestDecimal" COLLATE EF_DECIMAL | ||
| """); | ||
|
|
||
| var expectedResults = query.AsEnumerable() | ||
| .OrderBy(e => e.TestDecimal) | ||
| .Select(e => new { e.Id, e.TestDecimal }) | ||
| .ToList(); | ||
|
|
||
| Assert.Equal(expectedResults.Count, results.Count); | ||
| for (var i = 0; i < expectedResults.Count; i++) | ||
| { | ||
| Assert.Equal(expectedResults[i].Id, results[i].Id); | ||
| Assert.Equal(expectedResults[i].TestDecimal, results[i].TestDecimal); | ||
| } | ||
| } | ||
|
|
||
| [ConditionalFact] | ||
| public virtual void Can_query_using_char_ToLower() | ||
| { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert, we handle version bumps separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was caused by the base branch change. Please rebase on main