diff --git a/src/sql/lib.zig b/src/sql/lib.zig index a3a900c..776b159 100644 --- a/src/sql/lib.zig +++ b/src/sql/lib.zig @@ -420,7 +420,7 @@ fn Tx(comptime tx_level: u8) type { if (tx_level != 0) @compileError("close must be called on root db"); if (self.conn.current_tx_level != 0) { std.log.warn("Database released while transaction in progress!", .{}); - self.rollbackUnchecked() catch {}; + self.rollbackUnchecked() catch {}; // TODO: Burn database connection } if (!self.conn.in_use.swap(false, .AcqRel)) @panic("Double close on db conection"); @@ -719,6 +719,7 @@ fn Tx(comptime tx_level: u8) type { fn rollbackUnchecked(self: Self) !void { try self.execInternal("ROLLBACK", {}, .{}, false); + self.conn.current_tx_level = 0; } }; }