Changeset

10275:a247fa8df7df

util.sql: Preserve 3rd and 4th return values from transaction (fixes #1434) (thanks mrdoctorwho)
author Kim Alvefur <zash@zash.se>
date Sat, 28 Sep 2019 18:24:28 +0200
parents 10274:b4596a056a4c
children 10276:4e4ce7400b39
files util/sql.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/util/sql.lua	Sat Sep 28 00:09:29 2019 +0200
+++ b/util/sql.lua	Sat Sep 28 18:24:28 2019 +0200
@@ -218,14 +218,14 @@
 	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]", (...));
-			ok, ret = self:_transaction(...);
+			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 @@
 			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.."\" (";