diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-08-01 23:56:10 +0200 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-08-01 23:56:36 +0200 |
commit | f225c34d82cb6ea4133af64c34f977be00769afc (patch) | |
tree | 34408c454f00bf42463eb65866ec77f26f748050 /src/duckdb | |
parent | 7a1f944779d858a6e1b80cf391e03fbbbecb4a43 (diff) |
Prepare for checking exhaustion
Diffstat (limited to 'src/duckdb')
-rw-r--r-- | src/duckdb/Result.zig | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/duckdb/Result.zig b/src/duckdb/Result.zig index 8e06b67..f399fb5 100644 --- a/src/duckdb/Result.zig +++ b/src/duckdb/Result.zig @@ -54,13 +54,12 @@ pub fn Result(comptime T: type) type{ /// There's not way to know how many total elements we have, but we can /// know how many we have in the current chunk. fn getCurrentChunkSize(self: Self) usize { - if (self._chunk == null) { - return 0; - } + std.debug.assert(self._chunk != null); return c.duckdb_data_chunk_get_size(self._chunk); } pub fn getColumnCount(self: Self) usize { + std.debug.assert(self._chunk != null); return c.duckdb_data_chunk_get_column_count(self._chunk); } @@ -70,8 +69,6 @@ pub fn Result(comptime T: type) type{ fn fetchDataChunk(self: *Self) void{ if (self._chunk != null){ c.duckdb_destroy_data_chunk(&self._chunk); - self._chunk = null; - self._current_row = 0; } self._chunk = c.duckdb_fetch_chunk(self._res); for (self._columns, 0..) |_, i| { @@ -81,10 +78,10 @@ pub fn Result(comptime T: type) type{ self._data[i] = c.duckdb_vector_get_data(col); } self._current_row = 0; - } pub fn exausted(self: Self) bool{ + // TODO: check exhaustion properly return self._chunk != null; } |