From f9b8c864f19ce70cbc1b9a978e69f77f8356726a Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Mon, 29 Jul 2024 23:27:00 +0200 Subject: Add Column count functionality --- src/db.zig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/db.zig b/src/db.zig index 9f9e22e..1b9f653 100644 --- a/src/db.zig +++ b/src/db.zig @@ -13,10 +13,14 @@ const Result = struct { c.duckdb_destroy_data_chunk(&self._chunk); } - pub fn getSize(self: Result) usize { + pub fn getRowCount(self: Result) usize { return c.duckdb_data_chunk_get_size(self._chunk); } + pub fn getColumnCount(self: Result) usize { + return c.duckdb_data_chunk_get_column_count(self._chunk); + } + pub fn fetchDataChunk(self: *Result) void{ self._chunk = c.duckdb_fetch_chunk(self._res); } @@ -92,5 +96,6 @@ test "Query size" { var result = try connection.query("SELECT * FROM integers;"); defer result.deinit(); - try std.testing.expect(3 == result.getSize()); + try std.testing.expect(3 == result.getRowCount()); + try std.testing.expect(2 == result.getColumnCount()); } -- cgit v1.2.3