I have the following code to create a database table if it does not already exist then check if the current user is in the database or not. I do this by selecting the user with id equal to their device id. The code right now should print hello world and then go to forms. However when I run the code nothing happens, no errors and no print statement. Any ideas why this might be happening?
local tablesetup = [[CREATE TABLE IF NOT EXISTS User (id VARCHAR(255) PRIMARY KEY, name);]]
db:exec(tablesetup)
--Check if the user is in the database already
for row in db:nrows("SELECT * FROM User WHERE id = " .. "'" .. system.getInfo("deviceID") .. "'") do
print("hello")
if(row.id == nil) then
print("world")
storyboard.gotoScene("forms")
end
end