### ----------------------------------------------------
### -- Duckie
### -- Licenses: MIT
### -- Authors: Brian Duggan
### -- File: t/02-chunks.rakutest
### ----------------------------------------------------
use Test;
use Duckie::DuckDB::Native;
use NativeCall;

my $db-file will leave { .unlink if .IO.e } = $*TMPDIR.child('test.db');
my DuckDB::Native::Database $dbh .= new;
my DuckDB::Native::Connection $conn .= new;
my DuckDB::Native::Result $res .= new;

is duckdb_open($db-file.Str, $dbh), +DUCKDB_SUCCESS, 'open';
is duckdb_connect($dbh, $conn) , +DUCKDB_SUCCESS, 'connect';

is duckdb_query($conn, 'select 99 as first, 10.22 as second', $res), +DUCKDB_SUCCESS, 'select';
diag "checking to see if chunk_count works";
diag "chunk count is " ~ duckdb_result_chunk_count($res);

duckdb_disconnect($conn);
duckdb_close($dbh);

done-testing;


