-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<TargetFrameworks>net8.0</TargetFrameworks> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<PublishAot>true</PublishAot> | ||
<InvariantGlobalization>true</InvariantGlobalization> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<BuildType>Full</BuildType> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="DuckDB.NET.Bindings.Full" Version="1.1.3" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\DuckDB.NET.Data\Data.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<TrimmerRootAssembly Include="DuckDB.NET.Data" /> | ||
<TrimmerRootAssembly Include="DuckDB.NET.Bindings" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using DuckDB.NET.Data; | ||
|
||
namespace AotTestApp; | ||
|
||
internal class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
using (var cn = new DuckDBConnection(DuckDBConnectionStringBuilder.InMemoryConnectionString)) | ||
{ | ||
cn.Open(); | ||
using var duckDBCommand = cn.CreateCommand(); | ||
duckDBCommand.CommandText = "Select struct from test_all_types()"; | ||
|
||
using var reader = duckDBCommand.ExecuteReader(); | ||
while (reader.Read()) | ||
{ | ||
if (!reader.IsDBNull(0)) | ||
{ | ||
var structTest = reader.GetFieldValue<StructTest>(0); | ||
Console.WriteLine($"A: {structTest.A}, B: {structTest.B?.Length}"); | ||
} | ||
} | ||
} | ||
|
||
Console.ReadKey(); | ||
} | ||
} | ||
|
||
class StructTest | ||
{ | ||
public int? A { get; set; } | ||
public string B { get; set; } | ||
} |
This file contains 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