Skip to content

Commit

Permalink
Added project for testing Aot
Browse files Browse the repository at this point in the history
  • Loading branch information
Giorgi committed Nov 19, 2024
1 parent 893a30e commit 87c1ee2
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
30 changes: 30 additions & 0 deletions AotTestApp/AotTestApp.csproj
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>
34 changes: 34 additions & 0 deletions AotTestApp/Program.cs
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; }
}
6 changes: 6 additions & 0 deletions DuckDB.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Data", "DuckDB.NET.Data\Dat
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test", "DuckDB.NET.Test\Test.csproj", "{56C63520-26F9-4230-9AD1-04457E5EBF57}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AotTestApp", "AotTestApp\AotTestApp.csproj", "{3A004ADD-6393-4099-A582-72E25269CA92}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -33,6 +35,10 @@ Global
{56C63520-26F9-4230-9AD1-04457E5EBF57}.Debug|Any CPU.Build.0 = Debug|Any CPU
{56C63520-26F9-4230-9AD1-04457E5EBF57}.Release|Any CPU.ActiveCfg = Release|Any CPU
{56C63520-26F9-4230-9AD1-04457E5EBF57}.Release|Any CPU.Build.0 = Release|Any CPU
{3A004ADD-6393-4099-A582-72E25269CA92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3A004ADD-6393-4099-A582-72E25269CA92}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A004ADD-6393-4099-A582-72E25269CA92}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A004ADD-6393-4099-A582-72E25269CA92}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit 87c1ee2

Please sign in to comment.