any reason why I'm getting this error ?
"SQLite error: unable to close due to unfinalized statements or unfinished backups"
using the following code:
function dump_button:onClick()
local db_filename = 'my_dump.db'
local db
local file = sys.File(db_filename)
local db_ref
if not file.exists then
db_ref = 1
db = sqlite.Database(db_filename)
db:exec([[CREATE TABLE dump (
ref integer not null,
grp text not null,
field text not null,
value integer not null)]])
else
db = sqlite.Database(db_filename)
for row in db:query("SELECT MAX(ref) AS max_ref FROM dump;") do
db_ref = math.tointeger(row.max_ref) + 1
break
end
end
print('DB REF = ', db_ref)
for grp_name, grp in pairs(MAP) do
for _, fld in ipairs(grp) do
db:exec("INSERT INTO dump (ref, grp, field, value) VALUES(?, ?, ?, ?);", db_ref, grp_name, fld.name, 0)
end
end
db:close()
end
end