| ... | @@ -27,7 +27,7 @@ pub fn close(self: *Self) void { | ... | @@ -27,7 +27,7 @@ pub fn close(self: *Self) void { |
| 27 | pub fn collect(self: *Self, alloc: *std.mem.Allocator, comptime T: type, comptime query: []const u8, args: anytype) ![]const T { | 27 | pub fn collect(self: *Self, alloc: *std.mem.Allocator, comptime T: type, comptime query: []const u8, args: anytype) ![]const T { |
| 28 | var stmt = try self.db.prepare(query); | 28 | var stmt = try self.db.prepare(query); |
| 29 | defer stmt.deinit(); | 29 | defer stmt.deinit(); |
| 30 | var iter = try stmt.iterator(T, args); | 30 | var iter = try stmt.iteratorAlloc(T, alloc, args); |
| 31 | var list = std.ArrayList(T).init(alloc); | 31 | var list = std.ArrayList(T).init(alloc); |
| 32 | while (try iter.nextAlloc(alloc, .{})) |row| { | 32 | while (try iter.nextAlloc(alloc, .{})) |row| { |
| 33 | try list.append(row); | 33 | try list.append(row); |
| ... | @@ -35,10 +35,10 @@ pub fn collect(self: *Self, alloc: *std.mem.Allocator, comptime T: type, comptim | ... | @@ -35,10 +35,10 @@ pub fn collect(self: *Self, alloc: *std.mem.Allocator, comptime T: type, comptim |
| 35 | return list.toOwnedSlice(); | 35 | return list.toOwnedSlice(); |
| 36 | } | 36 | } |
| 37 | | 37 | |
| 38 | pub fn exec(self: *Self, comptime query: []const u8, args: anytype) !void { | 38 | pub fn exec(self: *Self, alloc: *std.mem.Allocator, comptime query: []const u8, args: anytype) !void { |
| 39 | var stmt = try self.db.prepare(query); | 39 | var stmt = try self.db.prepare(query); |
| 40 | defer stmt.deinit(); | 40 | defer stmt.deinit(); |
| 41 | try stmt.exec(args); | 41 | try stmt.execAlloc(.{ .allocator = alloc }, args); |
| 42 | } | 42 | } |
| 43 | | 43 | |
| 44 | pub fn first(self: *Self, alloc: *std.mem.Allocator, comptime T: type, comptime query: []const u8, args: anytype) !?T { | 44 | pub fn first(self: *Self, alloc: *std.mem.Allocator, comptime T: type, comptime query: []const u8, args: anytype) !?T { |