aboutsummaryrefslogtreecommitdiffstats
path: root/util/sql.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-11-11 02:31:09 +0100
committerKim Alvefur <zash@zash.se>2018-11-11 02:31:09 +0100
commit928d5d54ec1cf5f7d785985ebffdc72a1c5a09b3 (patch)
treecc02fe9ca7663885ef356effad62927c5cea8d08 /util/sql.lua
parenteb0947ba4f77172073a21be7c20e17e5f016c203 (diff)
parent1086a1325d81d6cc6a49d2bf2e6bc81e984a2bd0 (diff)
downloadprosody-928d5d54ec1cf5f7d785985ebffdc72a1c5a09b3.tar.gz
prosody-928d5d54ec1cf5f7d785985ebffdc72a1c5a09b3.zip
Merge 0.11->trunk
Diffstat (limited to 'util/sql.lua')
-rw-r--r--util/sql.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/util/sql.lua b/util/sql.lua
index 67a5d683..47900102 100644
--- a/util/sql.lua
+++ b/util/sql.lua
@@ -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 @@ function engine:_transaction(func, ...)
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));