From caaf5d24b97c2f016c5c44131cd5b8507d1d5082 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Thu, 7 Oct 2021 19:17:10 -0700 Subject: [PATCH] sqlite: use the alloc versions of more methods --- src/sqlite3.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sqlite3.zig b/src/sqlite3.zig index 76342ce20e80f47ee4c87d92b0423e5693d82e7f..ad3d730b5742dece0893a16e4063649bb35f2658 100644 --- a/src/sqlite3.zig +++ b/src/sqlite3.zig @@ -27,7 +27,7 @@ pub fn close(self: *Self) void { pub fn collect(self: *Self, alloc: *std.mem.Allocator, comptime T: type, comptime query: []const u8, args: anytype) ![]const T { var stmt = try self.db.prepare(query); defer stmt.deinit(); - var iter = try stmt.iterator(T, args); + var iter = try stmt.iteratorAlloc(T, alloc, args); var list = std.ArrayList(T).init(alloc); while (try iter.nextAlloc(alloc, .{})) |row| { try list.append(row); @@ -35,10 +35,10 @@ pub fn collect(self: *Self, alloc: *std.mem.Allocator, comptime T: type, comptim return list.toOwnedSlice(); } -pub fn exec(self: *Self, comptime query: []const u8, args: anytype) !void { +pub fn exec(self: *Self, alloc: *std.mem.Allocator, comptime query: []const u8, args: anytype) !void { var stmt = try self.db.prepare(query); defer stmt.deinit(); - try stmt.exec(args); + try stmt.execAlloc(.{ .allocator = alloc }, args); } pub fn first(self: *Self, alloc: *std.mem.Allocator, comptime T: type, comptime query: []const u8, args: anytype) !?T { -- 2.54.0