util.sql: Rename some variable to match conventions

This commit is contained in:
Matthew Wild 2015-06-03 15:54:52 +01:00
parent 424d93cdac
commit 15e84d4ec5

View file

@ -163,8 +163,8 @@ engine.delete = engine.execute_update;
engine.update = engine.execute_update; engine.update = engine.execute_update;
function engine:_transaction(func, ...) function engine:_transaction(func, ...)
if not self.conn then if not self.conn then
local a,b = self:connect(); local ok, err = self:connect();
if not a then return a,b; end if not ok then return ok, err; end
end end
--assert(not self.__transaction, "Recursive transactions not allowed"); --assert(not self.__transaction, "Recursive transactions not allowed");
local args, n_args = {...}, select("#", ...); local args, n_args = {...}, select("#", ...);
@ -184,15 +184,15 @@ function engine:_transaction(func, ...)
end end
end end
function engine:transaction(...) function engine:transaction(...)
local a,b = self:_transaction(...); local ok, ret = self:_transaction(...);
if not a then if not ok then
local conn = self.conn; local conn = self.conn;
if not conn or not conn:ping() then if not conn or not conn:ping() then
self.conn = nil; self.conn = nil;
a,b = self:_transaction(...); ok, ret = self:_transaction(...);
end end
end end
return a,b; return ok, ret;
end end
function engine:_create_index(index) function engine:_create_index(index)
local sql = "CREATE INDEX `"..index.name.."` ON `"..index.table.."` ("; local sql = "CREATE INDEX `"..index.name.."` ON `"..index.table.."` (";