Skip to content

Commit

Permalink
Implicit conversion between DuckDBResult and DuckDBResultStruct
Browse files Browse the repository at this point in the history
  • Loading branch information
Giorgi committed Sep 9, 2023
1 parent 10bd1b9 commit 298fff1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion DuckDB.NET.Bindings/DuckDBNativeObjects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ public class DuckDBResult : IDisposable

private IntPtr internal_data;

public DuckDBResultStruct ToStruct()
public static implicit operator DuckDBResultStruct(DuckDBResult d) => d.ToStruct();

private DuckDBResultStruct ToStruct()
{
return new DuckDBResultStruct()
{
Expand Down
4 changes: 2 additions & 2 deletions DuckDB.NET.Data/DuckDBDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ internal DuckDBDataReader(DuckDbCommand command, List<DuckDBResult> queryResults

private void InitReaderData()
{
var chunkCount = NativeMethods.Types.DuckDBResultChunkCount(currentResult.ToStruct());
var chunk = NativeMethods.Types.DuckDBResultGetChunk(currentResult.ToStruct(), 0);
var chunkCount = NativeMethods.Types.DuckDBResultChunkCount(currentResult);
var chunk = NativeMethods.Types.DuckDBResultGetChunk(currentResult, 0);

var columnCount = NativeMethods.DataChunks.DuckDBDataChunkGetColumnCount(chunk);

Expand Down

0 comments on commit 298fff1

Please sign in to comment.