From d4cd0e661898dde0e0e3c89984209c7e253b4c0d Mon Sep 17 00:00:00 2001 From: jaina heartles Date: Wed, 7 Dec 2022 01:57:07 -0800 Subject: [PATCH] Add execWithOptions --- src/sql/lib.zig | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/sql/lib.zig b/src/sql/lib.zig index 149e58a..0eaf206 100644 --- a/src/sql/lib.zig +++ b/src/sql/lib.zig @@ -543,7 +543,16 @@ fn Tx(comptime tx_level: u8) type { args: anytype, alloc: ?std.mem.Allocator, ) !void { - try self.execInternal(sql, args, alloc, true); + try self.execInternal(sql, args, .{ .allocator = alloc }, true); + } + + pub fn execWithOptions( + self: Self, + sql: [:0]const u8, + args: anytype, + options: QueryOptions, + ) !void { + try self.execInternal(sql, args, options, true); } pub fn queryWithOptions( @@ -699,17 +708,17 @@ fn Tx(comptime tx_level: u8) type { self: Self, sql: [:0]const u8, args: anytype, - alloc: ?std.mem.Allocator, + options: QueryOptions, comptime check_tx: bool, ) !void { - var results = try self.runSql(sql, args, .{ .allocator = alloc }, check_tx); + var results = try self.runSql(sql, args, options, check_tx); defer results.finish(); while (try results.row()) |_| {} } fn rollbackUnchecked(self: Self) !void { - try self.execInternal("ROLLBACK", {}, null, false); + try self.execInternal("ROLLBACK", {}, .{}, false); } }; }