diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-07-29 23:27:00 +0200 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-07-29 23:27:00 +0200 |
commit | f9b8c864f19ce70cbc1b9a978e69f77f8356726a (patch) | |
tree | 56c87bca87adb6968b4cb552089a1fea5bafa9e1 | |
parent | a205a7ce6c65ead2b489800bf7e9faf3802b46d1 (diff) |
Add Column count functionality
-rw-r--r-- | src/db.zig | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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()); } |