Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
21 changes: 4 additions & 17 deletions .github/workflows/preview-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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

Expand All @@ -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"
Expand All @@ -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" \
Expand Down
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

<ForkPackageBuild Condition="'$(ForkPreview)' == 'true' OR '$(ForkRelease)' == 'true'">true</ForkPackageBuild>
<ForkPackagePrefix Condition="'$(ForkPackageBuild)' == 'true' AND '$(ForkPackagePrefix)' == ''">Skuirrels.</ForkPackagePrefix>
<DuckDbNativeVersion Condition="'$(DuckDbNativeVersion)' == ''">1.5.5</DuckDbNativeVersion>
<Product>DuckDB.NET.$(MSBuildProjectName)</Product>
<PackageId>$(ForkPackagePrefix)DuckDB.NET.$(MSBuildProjectName)</PackageId>
<PackageTags>DuckDB;ADO.NET;Database;Olap;Embedded</PackageTags>
Expand Down
2 changes: 1 addition & 1 deletion DuckDB.NET.Benchmarks/PreparedCommandWorkload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions DuckDB.NET.Bindings/Bindings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<PropertyGroup>
<Description>DuckDB Bindings for C#.</Description>
<PackageReleaseNotes>
- Updated to DuckDB v1.5.4
- Updated to DuckDB v$(DuckDbNativeVersion)
</PackageReleaseNotes>
<Description Condition="'$(ForkPreview)' == 'true'">Unofficial preview build of the DuckDB native bindings from the skuirrels DuckDB.NET fork.</Description>
<PackageReleaseNotes Condition="'$(ForkPreview)' == 'true'">Unofficial preview bindings for the consolidated DuckDB.NET performance work, bundling DuckDB v1.5.4.</PackageReleaseNotes>
<Description Condition="'$(ForkRelease)' == 'true'">Unofficial stable build of the DuckDB native bindings from the skuirrels DuckDB.NET fork.</Description>
<PackageReleaseNotes Condition="'$(ForkRelease)' == 'true'">Stable fork bindings for the consolidated DuckDB.NET performance work, bundling DuckDB v1.5.4.</PackageReleaseNotes>
<PackageReleaseNotes Condition="'$(ForkRelease)' == 'true'">Stable fork bindings for the consolidated DuckDB.NET performance work, bundling DuckDB v$(DuckDbNativeVersion).</PackageReleaseNotes>
<RootNamespace>DuckDB.NET.Native</RootNamespace>
<RuntimeIdentifiers>win-x64;win-arm64;linux-x64;linux-arm64;osx</RuntimeIdentifiers>
<DuckDbArtifactRoot Condition=" '$(DuckDbArtifactRoot)' == '' ">https://github.com/duckdb/duckdb/releases/download/v1.5.4</DuckDbArtifactRoot>
<DuckDbArtifactRoot Condition=" '$(DuckDbArtifactRoot)' == '' ">https://github.com/duckdb/duckdb/releases/download/v$(DuckDbNativeVersion)</DuckDbArtifactRoot>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\keyPair.snk</AssemblyOriginatorKeyFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down
66 changes: 37 additions & 29 deletions DuckDB.NET.Bindings/DownloadNativeLibs.targets
Original file line number Diff line number Diff line change
@@ -1,47 +1,55 @@
<Project DefaultTargets="DownloadReleaseNatives;DownloadNightlyNatives">
<Project DefaultTargets="DownloadNativeLibrary">

<!-- Release: download lib zip directly -->
<Target Name="DownloadReleaseNatives"
Condition="!Exists('$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native') AND '$(InnerZipName)' == ''">
<Target Name="DownloadNativeLibrary">
<PropertyGroup>
<NativeDirectory>$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native</NativeDirectory>
<NativeZipPath>$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native.zip</NativeZipPath>
<NativeSourceStampPath>$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\source-url.txt</NativeSourceStampPath>
<TempExtractPath>$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\temp</TempExtractPath>
</PropertyGroup>
<ReadLinesFromFile File="$(NativeSourceStampPath)"
Condition="Exists('$(NativeSourceStampPath)')">
<Output TaskParameter="Lines" ItemName="_CachedNativeSourceUrl" />
</ReadLinesFromFile>
<PropertyGroup>
<NativeCacheIsCurrent Condition="Exists('$(NativeDirectory)') AND '@(_CachedNativeSourceUrl)' == '$(LibUrl)'">true</NativeCacheIsCurrent>
<DownloadNative Condition="'$(NativeCacheIsCurrent)' != 'true'">true</DownloadNative>
</PropertyGroup>
<MakeDir Directories="$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native" />
<RemoveDir Directories="$(NativeDirectory)"
Condition="'$(DownloadNative)' == 'true' AND Exists('$(NativeDirectory)')" />
<RemoveDir Directories="$(TempExtractPath)"
Condition="'$(DownloadNative)' == 'true' AND Exists('$(TempExtractPath)')" />
<MakeDir Directories="$(NativeDirectory)"
Condition="'$(DownloadNative)' == 'true'" />
<Delete Files="$(NativeZipPath)"
Condition="Exists('$(NativeZipPath)')"
Condition="'$(DownloadNative)' == 'true' AND Exists('$(NativeZipPath)')"
ContinueOnError="true"/>
<DownloadFile
Condition="'$(DownloadNative)' == 'true'"
DestinationFolder="$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)"
SourceUrl="$(LibUrl)"
Retries="5"
RetryDelayMilliseconds="1000"
DestinationFileName="native.zip"/>
<Unzip DestinationFolder="$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native"
<!-- Release archives contain the native library directly. -->
<Unzip Condition="'$(DownloadNative)' == 'true' AND '$(InnerZipName)' == ''"
DestinationFolder="$(NativeDirectory)"
SourceFiles="$(NativeZipPath)"/>
<Delete Files="$(NativeZipPath)"/>
</Target>

<!-- Nightly: download outer zip, extract inner lib zip -->
<Target Name="DownloadNightlyNatives"
Condition="!Exists('$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native') AND '$(InnerZipName)' != ''">
<PropertyGroup>
<NativeZipPath>$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native.zip</NativeZipPath>
<TempExtractPath>$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\temp</TempExtractPath>
</PropertyGroup>
<MakeDir Directories="$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native" />
<Delete Files="$(NativeZipPath)" Condition="Exists('$(NativeZipPath)')" ContinueOnError="true"/>
<DownloadFile
DestinationFolder="$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)"
SourceUrl="$(LibUrl)"
Retries="5"
RetryDelayMilliseconds="1000"
DestinationFileName="native.zip"/>
<Unzip DestinationFolder="$(TempExtractPath)"
<!-- Nightly artifacts wrap the native archive in an outer platform zip. -->
<Unzip Condition="'$(DownloadNative)' == 'true' AND '$(InnerZipName)' != ''"
DestinationFolder="$(TempExtractPath)"
SourceFiles="$(NativeZipPath)"/>
<Unzip DestinationFolder="$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native"
<Unzip Condition="'$(DownloadNative)' == 'true' AND '$(InnerZipName)' != ''"
DestinationFolder="$(NativeDirectory)"
SourceFiles="$(TempExtractPath)\$(InnerZipName)"/>
<RemoveDir Directories="$(TempExtractPath)" />
<Delete Files="$(NativeZipPath)"/>
<RemoveDir Directories="$(TempExtractPath)"
Condition="'$(DownloadNative)' == 'true' AND '$(InnerZipName)' != ''" />
<Delete Files="$(NativeZipPath)"
Condition="'$(DownloadNative)' == 'true'"/>
<WriteLinesToFile File="$(NativeSourceStampPath)"
Lines="$(LibUrl)"
Overwrite="true"
Condition="'$(DownloadNative)' == 'true'"/>
</Target>

</Project>
62 changes: 33 additions & 29 deletions DuckDB.NET.Bindings/DuckDBStatementType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
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,
}
2 changes: 1 addition & 1 deletion DuckDB.NET.Data/Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Fixes:
<Description Condition="'$(ForkPreview)' == 'true'">Unofficial preview build of the DuckDB ADO.NET provider from the skuirrels DuckDB.NET fork.</Description>
<PackageReleaseNotes Condition="'$(ForkPreview)' == 'true'">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.</PackageReleaseNotes>
<Description Condition="'$(ForkRelease)' == 'true'">Unofficial stable build of the DuckDB ADO.NET provider from the skuirrels DuckDB.NET fork.</Description>
<PackageReleaseNotes Condition="'$(ForkRelease)' == 'true'">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.</PackageReleaseNotes>
<PackageReleaseNotes Condition="'$(ForkRelease)' == 'true'">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.</PackageReleaseNotes>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\keyPair.snk</AssemblyOriginatorKeyFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down
60 changes: 60 additions & 0 deletions DuckDB.NET.Test/DuckDB155CompatibilityTests.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
6 changes: 3 additions & 3 deletions README-FORK.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/validate-fork-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand Down
Loading