diff options
Diffstat (limited to 'src/conn/conn.zig')
-rw-r--r-- | src/conn/conn.zig | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/conn/conn.zig b/src/conn/conn.zig index db5084c..9d5a8e1 100644 --- a/src/conn/conn.zig +++ b/src/conn/conn.zig @@ -184,21 +184,34 @@ pub const MultiResultIterator = struct { // returns the next result iterator, or null if we've reached the end of the results pub fn next_result(self: *MultiResultIterator) !?*ResultIterator { - if (self.cri != null) { - try self.cri.?.skip_to_end(); - } + _ = self; + // if (self.cri != null) { + // try self.cri.?.skip_to_end(); + // } + return error.NotImplemented; } fn receive_message(self: *MultiResultIterator) !BackendMessage { - var msg = try self.conn.receive_message(); - switch (msg) {} - return msg; + _ = self; + // var msg = try self.conn.receive_message(); + // switch (msg) {} + // return msg; + return error.NotImplemented; } }; -// pub fn exec(self: *Conn) { - -// } +// Execute some SQL using postgres' simple query protocol +pub fn exec(self: *Conn, query: []const u8) !ResultIterator { + const qr = proto.Query{ + .query = query, + }; + var writer = self.stream.writer(); + try qr.write(self.allocator, writer); + // TODO multi result iterator since query could contain multiple queries + return ResultIterator{ + .conn = self, + }; +} test "connect unix" { // must have a local postgres runnning |