mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-04 18:53:49 +00:00
Fix. LuaSQL db backend breaks loop only on positive numbers.
This commit is contained in:
@@ -85,6 +85,14 @@ local function new_database(backend)
|
||||
assert(x == 1, ("Got %d expected %d"):format(x, 1))
|
||||
end
|
||||
|
||||
do local x = 0
|
||||
db:query("select 1 as v union all select 2 as v", function(row)
|
||||
x = x + 1
|
||||
return -1
|
||||
end)
|
||||
assert(x == 1, ("Got %d expected %d"):format(x, 1))
|
||||
end
|
||||
|
||||
do local x = 0
|
||||
db:query("select 1 as v union all select 2 as v", function(row)
|
||||
x = x + 1
|
||||
|
||||
@@ -54,7 +54,7 @@ function LuaSQLDatabase:query(sql, fn)
|
||||
local row, err = cur:fetch({}, "a")
|
||||
if not row then break end
|
||||
local ok, ret = pcall(fn, apply_names(row, colnames, ""))
|
||||
if (not ok) or (type(ret) == 'number' and ret > 0) then
|
||||
if (not ok) or (type(ret) == 'number' and ret ~= 0) then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user