diff options
author | Kim Alvefur <zash@zash.se> | 2019-11-23 23:12:01 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-11-23 23:12:01 +0100 |
commit | 72f1544f6d7301d1313c333f1147b27e242063df (patch) | |
tree | 1a5b57117c8c88f05ebb8b67a0d2848988b7620c /util/sql.lua | |
parent | 7ac5e467baa7ebc557ed3a07bdca7dc9ade0c1db (diff) | |
parent | dfa2bdffc083faa597509d7f35125c41f6ffbc9d (diff) | |
download | prosody-72f1544f6d7301d1313c333f1147b27e242063df.tar.gz prosody-72f1544f6d7301d1313c333f1147b27e242063df.zip |
Merge 0.11->trunk
Diffstat (limited to 'util/sql.lua')
-rw-r--r-- | util/sql.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/util/sql.lua b/util/sql.lua index 00c7b57f..86740b1c 100644 --- a/util/sql.lua +++ b/util/sql.lua @@ -201,31 +201,31 @@ function engine:_transaction(func, ...) if not ok then return ok, err; end end --assert(not self.__transaction, "Recursive transactions not allowed"); - log("debug", "SQL transaction begin [%s]", tostring(func)); + log("debug", "SQL transaction begin [%s]", func); self.__transaction = true; local success, a, b, c = xpcall(func, handleerr, ...); self.__transaction = nil; if success then - log("debug", "SQL transaction success [%s]", tostring(func)); + log("debug", "SQL transaction success [%s]", func); local ok, err = self.conn:commit(); -- LuaDBI doesn't actually return an error message here, just a boolean if not ok then return ok, err or "commit failed"; end return success, a, b, c; else - log("debug", "SQL transaction failure [%s]: %s", tostring(func), a.err); + log("debug", "SQL transaction failure [%s]: %s", func, a.err); if self.conn then self.conn:rollback(); end return success, a.err; end end function engine:transaction(...) - local ok, ret = self:_transaction(...); + local ok, ret, b, c = self:_transaction(...); if not ok then local conn = self.conn; if not conn or not conn:ping() then log("debug", "Database connection was closed. Will reconnect and retry."); self.conn = nil; - log("debug", "Retrying SQL transaction [%s]", tostring((...))); - ok, ret = self:_transaction(...); + log("debug", "Retrying SQL transaction [%s]", (...)); + ok, ret, b, c = self:_transaction(...); log("debug", "SQL transaction retry %s", ok and "succeeded" or "failed"); else log("debug", "SQL connection is up, so not retrying"); @@ -234,7 +234,7 @@ function engine:transaction(...) log("error", "Error in SQL transaction: %s", ret); end end - return ok, ret; + return ok, ret, b, c; end function engine:_create_index(index) local sql = "CREATE INDEX \""..index.name.."\" ON \""..index.table.."\" ("; |