summaryrefslogtreecommitdiff
path: root/src/duckdb/Result.zig
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-08-01 23:56:10 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2024-08-01 23:56:36 +0200
commitf225c34d82cb6ea4133af64c34f977be00769afc (patch)
tree34408c454f00bf42463eb65866ec77f26f748050 /src/duckdb/Result.zig
parent7a1f944779d858a6e1b80cf391e03fbbbecb4a43 (diff)
Prepare for checking exhaustion
Diffstat (limited to 'src/duckdb/Result.zig')
-rw-r--r--src/duckdb/Result.zig9
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;
}