diff options
author | Kim Alvefur <zash@zash.se> | 2017-11-07 09:26:48 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-11-07 09:26:48 +0100 |
commit | eb07e55b143ffada5d2bf2b697996ee0bab4d2b5 (patch) | |
tree | f83ba9ea6ff57ee16bfbff4ae520125edccd2bdc /util | |
parent | 7cd68eaac1feb8b9d06d872c76bc781da1e3e400 (diff) | |
download | prosody-eb07e55b143ffada5d2bf2b697996ee0bab4d2b5.tar.gz prosody-eb07e55b143ffada5d2bf2b697996ee0bab4d2b5.zip |
util.sql: Return an error message when a SQL commit fails (LuaDBI doesn't) (Thanks Ge0rG)
Diffstat (limited to 'util')
-rw-r--r-- | util/sql.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/util/sql.lua b/util/sql.lua index 71158d4c..d964025e 100644 --- a/util/sql.lua +++ b/util/sql.lua @@ -236,7 +236,8 @@ function engine:_transaction(func, ...) if success then log("debug", "SQL transaction success [%s]", tostring(func)); local ok, err = self.conn:commit(); - if not ok then return ok, err; end -- commit failed + -- 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); |