diff options
Diffstat (limited to 'src/duckdb')
-rw-r--r-- | src/duckdb/Result.zig | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/duckdb/Result.zig b/src/duckdb/Result.zig index b49f704..2b5b992 100644 --- a/src/duckdb/Result.zig +++ b/src/duckdb/Result.zig @@ -22,6 +22,21 @@ pub fn Result(comptime T: type) type{ return error.DuckDBError; } self.fetchDataChunk(); + + // Get column vectors + switch (@typeInfo(T)) { + .Struct => |v| { + const column_count = v.fields.len; + var columns : [column_count]c.duckdb_vector = undefined; + for (columns, 0..) |_, i| { + columns[i] = c.duckdb_data_chunk_get_vector(self._chunk, i); + } + std.debug.print("{any}", .{columns}); + }, + .Void => {}, + else => @compileError("Expecting struct or void in query result type"), + } + return self; } pub fn deinit(self: *Self) void { @@ -59,12 +74,8 @@ pub fn Result(comptime T: type) type{ /// We need some comptime magic to create the output structures from /// the T. pub fn next(self: *Self) T{ - _ = self; const result: T = undefined; - switch (@typeInfo(T)) { - .Struct => std.debug.print("GOOOD: ", .{}), - else => null, - } + _ = self; return result; } }; |