OPENBUS-3053 Correção da falta de verificação do retorno do statement SQL no método Database:exec

parent 9ad4c3ec
......@@ -388,14 +388,12 @@ end
function DataBase:exec(stmt)
local gsql = gsubSQL(stmt)
log:database(stmt)
local res, errmsg = herror(self.conn:exec(stmt))
errmsg = gsql.." "..emsgprefix..tostring(errcode)
if errcode == lsqlite.DONE then
local errcode = self.conn:exec(stmt)
local errmsg = gsql.." "..emsgprefix..tostring(errcode)
if errcode == lsqlite.DONE or errcode == lsqlite.OK then
return true
elseif errcode == lsqlite.ERROR then
return nil, errmsg.."; "..self.conn:errmsg()
end
return nil, errmsg
return nil, errmsg.."; "..self.conn:errmsg()
end
function DataBase:pexec(action, ...)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment