# HG changeset patch # User Kim Alvefur # Date 1541899869 -3600 # Node ID 655b8d36a8a4ab3f22b6d95930c4f241edcfc08f # Parent 66c6edf563970e97788a13755e9f6e947a015637# Parent 61376a3c0c1d1b2c5851f3f24f538463a4bc47a0 Merge 0.11->trunk diff -r 66c6edf56397 -r 655b8d36a8a4 util/sql.lua --- a/util/sql.lua Sat Nov 10 15:50:32 2018 +0100 +++ b/util/sql.lua Sun Nov 11 02:31:09 2018 +0100 @@ -1,9 +1,10 @@ local setmetatable, getmetatable = setmetatable, getmetatable; -local ipairs, unpack, select = ipairs, table.unpack or unpack, select; --luacheck: ignore 113 143 +local ipairs = ipairs; local tostring = tostring; local type = type; -local assert, pcall, xpcall, debug_traceback = assert, pcall, xpcall, debug.traceback; +local assert, pcall, debug_traceback = assert, pcall, debug.traceback; +local xpcall = require "util.xpcall".xpcall; local t_concat = table.concat; local log = require "util.logger".init("sql"); @@ -200,11 +201,9 @@ if not ok then return ok, err; end end --assert(not self.__transaction, "Recursive transactions not allowed"); - local args, n_args = {...}, select("#", ...); - local function f() return func(unpack(args, 1, n_args)); end log("debug", "SQL transaction begin [%s]", tostring(func)); self.__transaction = true; - local success, a, b, c = xpcall(f, handleerr); + local success, a, b, c = xpcall(func, handleerr, ...); self.__transaction = nil; if success then log("debug", "SQL transaction success [%s]", tostring(func));