From 3bc662c98481109a06f1e388665604af41fc76ac Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Thu, 22 Aug 2024 20:26:37 -0400 Subject: [PATCH] Preserve additional ORDER BY qualifiers - Bump version to v4-rc3 --- src/Common/Library.fs | 2 +- src/Directory.Build.props | 4 ++-- src/Tests.CSharp/CommonCSharpTests.cs | 8 ++++---- src/Tests/CommonTests.fs | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Common/Library.fs b/src/Common/Library.fs index dcdd584..bf6f9bd 100644 --- a/src/Common/Library.fs +++ b/src/Common/Library.fs @@ -398,7 +398,7 @@ module Query = |> Seq.map (fun it -> if it.Name.Contains ' ' then let parts = it.Name.Split ' ' - { it with Name = parts[0] }, Some $" {parts[1]}" + { it with Name = parts[0] }, Some $""" {parts |> Array.skip 1 |> String.concat " "}""" else it, None) |> Seq.map (fun (field, direction) -> if field.Name.StartsWith "n:" then diff --git a/src/Directory.Build.props b/src/Directory.Build.props index fb65acb..0c4f795 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -6,8 +6,8 @@ 4.0.0.0 4.0.0.0 4.0.0 - rc2 - From rc1: add case-insensitive ordering. From v3.1: Change ByField to ByFields; support dot-access to nested document fields; add Find*Ordered functions/methods; see project site for breaking changes and compatibility + rc3 + From rc2: preserve additional ORDER BY qualifiers. From rc1: add case-insensitive ordering. From v3.1: Change ByField to ByFields; support dot-access to nested document fields; add Find*Ordered functions/methods; see project site for breaking changes and compatibility danieljsummers Bit Badger Solutions README.md diff --git a/src/Tests.CSharp/CommonCSharpTests.cs b/src/Tests.CSharp/CommonCSharpTests.cs index 397e29c..0e33791 100644 --- a/src/Tests.CSharp/CommonCSharpTests.cs +++ b/src/Tests.CSharp/CommonCSharpTests.cs @@ -616,14 +616,14 @@ public static class CommonCSharpTests }), TestCase("succeeds for PostgreSQL case-insensitive ordering", () => { - Expect.equal(Query.OrderBy([Field.Named("i:Test.Field DESC")], Dialect.PostgreSQL), - " ORDER BY LOWER(data#>>'{Test,Field}') DESC", + Expect.equal(Query.OrderBy([Field.Named("i:Test.Field DESC NULLS FIRST")], Dialect.PostgreSQL), + " ORDER BY LOWER(data#>>'{Test,Field}') DESC NULLS FIRST", "Order By not constructed correctly for case-insensitive field"); }), TestCase("succeeds for SQLite case-insensitive ordering", () => { - Expect.equal(Query.OrderBy([Field.Named("i:Test.Field ASC")], Dialect.SQLite), - " ORDER BY data->>'Test'->>'Field' COLLATE NOCASE ASC", + Expect.equal(Query.OrderBy([Field.Named("i:Test.Field ASC NULLS LAST")], Dialect.SQLite), + " ORDER BY data->>'Test'->>'Field' COLLATE NOCASE ASC NULLS LAST", "Order By not constructed correctly for case-insensitive field"); }) ]) diff --git a/src/Tests/CommonTests.fs b/src/Tests/CommonTests.fs index 16bea05..5718789 100644 --- a/src/Tests/CommonTests.fs +++ b/src/Tests/CommonTests.fs @@ -452,14 +452,14 @@ let queryTests = testList "Query" [ } test "succeeds for PostgreSQL case-insensitive ordering" { Expect.equal - (Query.orderBy [ Field.Named "i:Test.Field DESC" ] PostgreSQL) - " ORDER BY LOWER(data#>>'{Test,Field}') DESC" + (Query.orderBy [ Field.Named "i:Test.Field DESC NULLS FIRST" ] PostgreSQL) + " ORDER BY LOWER(data#>>'{Test,Field}') DESC NULLS FIRST" "Order By not constructed correctly for case-insensitive field" } test "succeeds for SQLite case-insensitive ordering" { Expect.equal - (Query.orderBy [ Field.Named "i:Test.Field ASC" ] SQLite) - " ORDER BY data->>'Test'->>'Field' COLLATE NOCASE ASC" + (Query.orderBy [ Field.Named "i:Test.Field ASC NULLS LAST" ] SQLite) + " ORDER BY data->>'Test'->>'Field' COLLATE NOCASE ASC NULLS LAST" "Order By not constructed correctly for case-insensitive field" } ]