01-15-2016, 05:27 AM
Sorry for the really, really late response. I just gave up on it basically.
Current code:
I'm 100% sure that the SELECT query I'm running should return at least 1 row. However, it doesn't go into the loop even once. It doesn't break, it just doesn't run properly.
I've tried urows, nrows and rows, but none of them seem to do anything.
Current code:
function ExecuteStatement(sql, parameters)
local db = sqlite3.open(PLUGIN:GetLocalFolder() .. "/database.sqlite3");
local stmt = db:prepare(sql);
if not (parameters == nil) then
for key, value in pairs(parameters) do
stmt:bind(key, value)
stmt:step();
end
--stmt:bind_names(parameters);
--stmt:step();
end
local result;
if (sql:match("SELECT")) then
local x = 1;
for row in stmt:urows() do
result = row;
x = x + 1;
LOG("TEST");
end
--LOG(stmt);
elseif (sql:match("INSERT")) then
--result = stmt:last_insert_rowid();
LOG("INSERT");
else
LOG("NOTHING");
end
stmt:finalize();
db:close();
if not (result == nil) then
return result;
else
return 0;
end
end
I'm 100% sure that the SELECT query I'm running should return at least 1 row. However, it doesn't go into the loop even once. It doesn't break, it just doesn't run properly.
I've tried urows, nrows and rows, but none of them seem to do anything.

