From 2c5cf2d65bbf91cdba00f52dfe7624a7a3a97d6c Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Fri, 2 Aug 2024 20:47:27 +0200 Subject: Move queries to conn --- src/duckdb/Result.zig | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/duckdb/Result.zig') diff --git a/src/duckdb/Result.zig b/src/duckdb/Result.zig index 75f74fd..61a30ce 100644 --- a/src/duckdb/Result.zig +++ b/src/duckdb/Result.zig @@ -23,19 +23,15 @@ pub fn Result(comptime T: type) type{ const Self = @This(); - pub fn init(conn : c.duckdb_connection, query: [:0]const u8) !Self { + pub fn init(result: c.duckdb_result) !Self { var self : Self = .{ - ._res = undefined, + ._res = result, ._chunk = null, ._columns = undefined, ._validities = undefined, ._data = undefined, ._current_row = 0, }; - const state = c.duckdb_query(conn, query, &self._res); - if ( state == c.DuckDBError){ - return error.DuckDBError; - } self.fetchDataChunk(); if( column_count != 0 and column_count != self.getColumnCount() ){ -- cgit v1.2.3