Comparison

util/sql.lua @ 6805:c37633feaece

util.sql: Log when transactions begin
author Kim Alvefur <zash@zash.se>
date Sun, 30 Aug 2015 13:45:36 +0200
parent 6777:5de6b93d0190
child 6806:f824057189ed
comparison
equal deleted inserted replaced
6804:9f40ae38f0de 6805:c37633feaece
178 if not ok then return ok, err; end 178 if not ok then return ok, err; end
179 end 179 end
180 --assert(not self.__transaction, "Recursive transactions not allowed"); 180 --assert(not self.__transaction, "Recursive transactions not allowed");
181 local args, n_args = {...}, select("#", ...); 181 local args, n_args = {...}, select("#", ...);
182 local function f() return func(unpack(args, 1, n_args)); end 182 local function f() return func(unpack(args, 1, n_args)); end
183 log("debug", "SQL transaction begin [%s]", tostring(func));
183 self.__transaction = true; 184 self.__transaction = true;
184 local success, a, b, c = xpcall(f, debug_traceback); 185 local success, a, b, c = xpcall(f, debug_traceback);
185 self.__transaction = nil; 186 self.__transaction = nil;
186 if success then 187 if success then
187 log("debug", "SQL transaction success [%s]", tostring(func)); 188 log("debug", "SQL transaction success [%s]", tostring(func));