authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-07 19:17:10 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-07 19:17:10 -07:00
logcaaf5d24b97c2f016c5c44131cd5b8507d1d5082
treee8fc459b7a13b4668994a93c36872c0d815b25b1
parent38a255e5698796eb13a171a6ce6f33b98d65cfe2

sqlite: use the alloc versions of more methods


1 files changed, 3 insertions(+), 3 deletions(-)

src/sqlite3.zig+3-3
......@@ -27,7 +27,7 @@ pub fn close(self: *Self) void {
2727pub fn collect(self: *Self, alloc: *std.mem.Allocator, comptime T: type, comptime query: []const u8, args: anytype) ![]const T {
2828 var stmt = try self.db.prepare(query);
2929 defer stmt.deinit();
30 var iter = try stmt.iterator(T, args);
30 var iter = try stmt.iteratorAlloc(T, alloc, args);
3131 var list = std.ArrayList(T).init(alloc);
3232 while (try iter.nextAlloc(alloc, .{})) |row| {
3333 try list.append(row);
......@@ -35,10 +35,10 @@ pub fn collect(self: *Self, alloc: *std.mem.Allocator, comptime T: type, comptim
3535 return list.toOwnedSlice();
3636}
3737
38pub fn exec(self: *Self, comptime query: []const u8, args: anytype) !void {
38pub fn exec(self: *Self, alloc: *std.mem.Allocator, comptime query: []const u8, args: anytype) !void {
3939 var stmt = try self.db.prepare(query);
4040 defer stmt.deinit();
41 try stmt.exec(args);
41 try stmt.execAlloc(.{ .allocator = alloc }, args);
4242}
4343
4444pub fn first(self: *Self, alloc: *std.mem.Allocator, comptime T: type, comptime query: []const u8, args: anytype) !?T {