Software /
code /
prosody
Diff
util/sql.lua @ 8378:6a098961bc00
util.sql: Return an error message when a SQL commit fails (LuaDBI doesn't) (Thanks Ge0rG)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 07 Nov 2017 09:26:48 +0100 |
parent | 8288:e9ac2d93de18 |
child | 8380:a597ff326758 |
line wrap: on
line diff
--- a/util/sql.lua Fri Nov 03 01:17:39 2017 +0100 +++ b/util/sql.lua Tue Nov 07 09:26:48 2017 +0100 @@ -236,7 +236,8 @@ 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);