diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a13fdc9..1ee358b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,6 +70,12 @@ jobs: CoverletOutputFormat: lcov run: dotnet test --configuration Release --verbosity normal --logger GitHubActions /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:BuildType=Full /p:DoesNotReturnAttribute="DoesNotReturnAttribute" + - name: Trust Coveralls Homebrew tap + if: runner.os == 'macOS' && github.event_name != 'schedule' + run: | + brew tap coverallsapp/coveralls + brew trust coverallsapp/coveralls + - name: Upload coverage reports to Coveralls Parallel uses: coverallsapp/github-action@v2 if: github.event_name != 'schedule' diff --git a/.github/workflows/preview-release.yml b/.github/workflows/preview-release.yml index e2327f8..7d20c68 100644 --- a/.github/workflows/preview-release.yml +++ b/.github/workflows/preview-release.yml @@ -12,10 +12,8 @@ jobs: publish-fork-package: if: >- startsWith(github.event.release.tag_name, 'v1.5.') && - ((github.event.release.prerelease == true && - contains(github.event.release.tag_name, '-preview.')) || - (github.event.release.prerelease == false && - !contains(github.event.release.tag_name, '-'))) + github.event.release.prerelease == false && + !contains(github.event.release.tag_name, '-') runs-on: ubuntu-latest environment: nuget-preview @@ -32,21 +30,14 @@ jobs: version="${{ github.event.release.tag_name }}" version="${version#v}" - if [[ "$version" =~ ^1\.5\.[0-9]+-preview\.[0-9]+$ ]]; then - fork_preview=true - fork_release=false - elif [[ "$version" =~ ^1\.5\.[0-9]+$ ]]; then - fork_preview=false - fork_release=true - else + if [[ ! "$version" =~ ^1\.5\.[0-9]+(\.[0-9]+)?$ ]]; then echo "Unexpected fork package version: $version" >&2 exit 1 fi { echo "PACKAGE_VERSION=$version" - echo "FORK_PREVIEW=$fork_preview" - echo "FORK_RELEASE=$fork_release" + echo "FORK_RELEASE=true" } >> "$GITHUB_ENV" - name: Setup .NET SDK @@ -65,7 +56,6 @@ jobs: /m:1 /p:BuildType=Full /p:CI=false - /p:ForkPreview="$FORK_PREVIEW" /p:ForkRelease="$FORK_RELEASE" /p:Version="$PACKAGE_VERSION" /p:PackageVersion="$PACKAGE_VERSION" @@ -80,7 +70,6 @@ jobs: --logger "console;verbosity=quiet" /p:BuildType=Full /p:CI=false - /p:ForkPreview="$FORK_PREVIEW" /p:ForkRelease="$FORK_RELEASE" /p:DoesNotReturnAttribute=DoesNotReturnAttribute @@ -96,7 +85,6 @@ jobs: /m:1 /p:BuildType=Full /p:CI=false - /p:ForkPreview="$FORK_PREVIEW" /p:ForkRelease="$FORK_RELEASE" /p:ForkPack=true /p:Version="$PACKAGE_VERSION" @@ -109,7 +97,6 @@ jobs: --source https://api.nuget.org/v3/index.json \ /p:BuildType=Full \ /p:CI=false \ - /p:ForkPreview="$FORK_PREVIEW" \ /p:ForkRelease="$FORK_RELEASE" \ /p:ForkPack=true \ /p:Version="$PACKAGE_VERSION" \ diff --git a/Directory.Build.props b/Directory.Build.props index 603223b..1405871 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -21,6 +21,7 @@ true Skuirrels. + 1.5.5 DuckDB.NET.$(MSBuildProjectName) $(ForkPackagePrefix)DuckDB.NET.$(MSBuildProjectName) DuckDB;ADO.NET;Database;Olap;Embedded diff --git a/DuckDB.NET.Benchmarks/PreparedCommandWorkload.cs b/DuckDB.NET.Benchmarks/PreparedCommandWorkload.cs index 69c6bb2..1c7aaa1 100644 --- a/DuckDB.NET.Benchmarks/PreparedCommandWorkload.cs +++ b/DuckDB.NET.Benchmarks/PreparedCommandWorkload.cs @@ -9,7 +9,7 @@ internal static class PreparedCommandWorkload #if DUCKDB_NET_BASELINE_1_5_3 private const string ExpectedEngineVersion = "v1.5.3"; #else - private const string ExpectedEngineVersion = "v1.5.4"; + private const string ExpectedEngineVersion = "v1.5.5"; #endif public static DuckDBConnection OpenVerifiedConnection() diff --git a/DuckDB.NET.Bindings/Bindings.csproj b/DuckDB.NET.Bindings/Bindings.csproj index cb88a77..1bba3e5 100644 --- a/DuckDB.NET.Bindings/Bindings.csproj +++ b/DuckDB.NET.Bindings/Bindings.csproj @@ -3,15 +3,15 @@ DuckDB Bindings for C#. -- Updated to DuckDB v1.5.4 +- Updated to DuckDB v$(DuckDbNativeVersion) Unofficial preview build of the DuckDB native bindings from the skuirrels DuckDB.NET fork. Unofficial preview bindings for the consolidated DuckDB.NET performance work, bundling DuckDB v1.5.4. Unofficial stable build of the DuckDB native bindings from the skuirrels DuckDB.NET fork. - Stable fork bindings for the consolidated DuckDB.NET performance work, bundling DuckDB v1.5.4. + Stable fork bindings for the consolidated DuckDB.NET performance work, bundling DuckDB v$(DuckDbNativeVersion). DuckDB.NET.Native win-x64;win-arm64;linux-x64;linux-arm64;osx - https://github.com/duckdb/duckdb/releases/download/v1.5.4 + https://github.com/duckdb/duckdb/releases/download/v$(DuckDbNativeVersion) True ..\keyPair.snk true diff --git a/DuckDB.NET.Bindings/DownloadNativeLibs.targets b/DuckDB.NET.Bindings/DownloadNativeLibs.targets index 0a73e20..db93767 100644 --- a/DuckDB.NET.Bindings/DownloadNativeLibs.targets +++ b/DuckDB.NET.Bindings/DownloadNativeLibs.targets @@ -1,47 +1,55 @@ - + - - + + $(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native $(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native.zip + $(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\source-url.txt + $(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\temp + + + + + + true + true - + + + - + - - - - - - - $(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native.zip - $(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\temp - - - - - + - - - + + + diff --git a/DuckDB.NET.Bindings/DuckDBStatementType.cs b/DuckDB.NET.Bindings/DuckDBStatementType.cs index 3169983..610d81e 100644 --- a/DuckDB.NET.Bindings/DuckDBStatementType.cs +++ b/DuckDB.NET.Bindings/DuckDBStatementType.cs @@ -3,32 +3,36 @@ public enum DuckDBStatementType { Invalid = 0, - Select, - Insert, - Update, - Explain, - Delete, - Prepare, - Create, - Execute, - Alter, - Transaction, - Copy, - Analyze, - VariableSet, - CreateFunc, - Drop, - Export, - Pragma, - Show, - Vacuum, - Call, - Set, - Load, - Relation, - Extension, - LogicalPlan, - Attach, - Detach, - Multi, -} \ No newline at end of file + Select = 1, + Insert = 2, + Update = 3, + Explain = 4, + Delete = 5, + Prepare = 6, + Create = 7, + Execute = 8, + Alter = 9, + Transaction = 10, + Copy = 11, + Analyze = 12, + VariableSet = 13, + CreateFunc = 14, + Drop = 15, + Export = 16, + Pragma = 17, + [Obsolete("DuckDB reports SHOW statements as Select.")] + Show = Select, + Vacuum = 18, + Call = 19, + Set = 20, + Load = 21, + Relation = 22, + Extension = 23, + LogicalPlan = 24, + Attach = 25, + Detach = 26, + Multi = 27, + CopyDatabase = 28, + UpdateExtensions = 29, + MergeInto = 30, +} diff --git a/DuckDB.NET.Data/Data.csproj b/DuckDB.NET.Data/Data.csproj index 0154d74..d84306c 100644 --- a/DuckDB.NET.Data/Data.csproj +++ b/DuckDB.NET.Data/Data.csproj @@ -14,7 +14,7 @@ Fixes: Unofficial preview build of the DuckDB ADO.NET provider from the skuirrels DuckDB.NET fork. Unofficial preview of the consolidated DuckDB.NET performance work for DuckDB v1.5.4. Do not reference this package alongside the official DuckDB.NET packages. Unofficial stable build of the DuckDB ADO.NET provider from the skuirrels DuckDB.NET fork. - Stable fork release of the consolidated DuckDB.NET performance work for DuckDB v1.5.4. Do not reference this package alongside the official DuckDB.NET packages. + Stable fork release of the consolidated DuckDB.NET performance work for DuckDB v$(DuckDbNativeVersion). Do not reference this package alongside the official DuckDB.NET packages. True ..\keyPair.snk true diff --git a/DuckDB.NET.Test/DuckDB155CompatibilityTests.cs b/DuckDB.NET.Test/DuckDB155CompatibilityTests.cs new file mode 100644 index 0000000..7c0f8a6 --- /dev/null +++ b/DuckDB.NET.Test/DuckDB155CompatibilityTests.cs @@ -0,0 +1,60 @@ +namespace DuckDB.NET.Test; + +public class DuckDB155CompatibilityTests(DuckDBDatabaseFixture db) : DuckDBTestBase(db) +{ + [Fact] + public void MergeIntoReturnsManagedStatementType() + { + Command.CommandText = + """ + create table statement_type_target(id integer primary key, value varchar); + create table statement_type_source(id integer, value varchar); + insert into statement_type_target values (1, 'old'); + insert into statement_type_source values (1, 'new'), (2, 'added'); + """; + Command.ExecuteNonQuery(); + + var state = NativeMethods.Query.DuckDBQuery( + Connection.NativeConnection, + """ + merge into statement_type_target + using statement_type_source + on statement_type_target.id = statement_type_source.id + when matched then update set value = statement_type_source.value + when not matched then + insert (id, value) values (statement_type_source.id, statement_type_source.value) + """, + out var result); + + try + { + state.Should().Be(DuckDBState.Success); + NativeMethods.Query.DuckDBResultStatementType(result) + .Should().Be(DuckDBStatementType.MergeInto); + } + finally + { + NativeMethods.Query.DuckDBDestroyResult(ref result); + } + } + + [Fact] + public void ShowIsReportedAsSelect() + { + var state = NativeMethods.Query.DuckDBQuery( + Connection.NativeConnection, + "show tables", + out var result); + + try + { + state.Should().Be(DuckDBState.Success); + NativeMethods.Query.DuckDBResultStatementType(result) + .Should().Be(DuckDBStatementType.Select); + } + finally + { + NativeMethods.Query.DuckDBDestroyResult(ref result); + } + } +} diff --git a/README-FORK.md b/README-FORK.md index 4a2fa48..c4f1e67 100644 --- a/README-FORK.md +++ b/README-FORK.md @@ -2,13 +2,13 @@ This is an unofficial stable build from the [`skuirrels/DuckDB.NET`](https://github.com/skuirrels/DuckDB.NET) fork. It -packages the consolidated performance work for DuckDB v1.5.4 under distinct +packages the consolidated performance work for DuckDB v1.5.5 under distinct `Skuirrels.DuckDB.NET.*` package IDs. Install the bundled provider explicitly: ```shell -dotnet add package Skuirrels.DuckDB.NET.Data.Full --version 1.5.5 +dotnet add package Skuirrels.DuckDB.NET.Data.Full --version 1.5.5.2 ``` NuGet packages: @@ -21,7 +21,7 @@ so application source code does not need to change. Do not reference this fork package and the official `DuckDB.NET.Data.Full` package in the same dependency graph because they contain assemblies with the same identities. -This release bundles DuckDB v1.5.4 and includes the consolidated appender, +This release bundles DuckDB v1.5.5 and includes the consolidated appender, parameter binding, prepared-command, result materialisation, and scoped-writer optimisations from the fork. When equivalent upstream changes are released, move back to the official `DuckDB.NET.Data.Full` package. diff --git a/README.md b/README.md index b667f01..aec8043 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ the corresponding upstream pull requests are reviewed and released. ## Usage ```sh -dotnet add package Skuirrels.DuckDB.NET.Data.Full --version 1.5.5 +dotnet add package Skuirrels.DuckDB.NET.Data.Full --version 1.5.5.2 ``` The fork packages retain the official `DuckDB.NET.Data` namespaces and assembly diff --git a/scripts/validate-fork-packages.sh b/scripts/validate-fork-packages.sh index 269189c..019f8af 100755 --- a/scripts/validate-fork-packages.sh +++ b/scripts/validate-fork-packages.sh @@ -109,7 +109,7 @@ using (var appender = connection.CreateAppender("fork_package_smoke")) using var verification = connection.CreateCommand(); verification.CommandText = "SELECT version(), sum(value) FROM fork_package_smoke"; using var reader = verification.ExecuteReader(); -if (!reader.Read() || !reader.GetString(0).Contains("v1.5.4", StringComparison.Ordinal) || reader.GetInt64(1) != 42) +if (!reader.Read() || !reader.GetString(0).Contains("v1.5.5", StringComparison.Ordinal) || reader.GetInt64(1) != 42) { throw new InvalidOperationException("Fork package smoke test failed."); }