Changeset

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
parents 8368:3629639d5fa9
children 8379:2a0915aa6131 8388:9ee56e9ad47a
files util/sql.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
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);