Hi,
I have this code to test corona with sql and the problem it is i have always “nil” in the print.
Corona simulator creates the test.db file in the sandbox.
Can someone put this code to work?
require “sqlite3”
local value;
local path = system.pathForFile( “test.db”, system.DocumentsDirectory )
local db = sqlite3.open( path )
local tablesetup = “CREATE TABLE settings (maxScore);”
db:exec( tablesetup )
local insertQuery = “INSERT INTO settings (maxScore) VALUES (‘1000’);”
db:exec( insertQuery )
local sql= “SELECT * FROM settings”;
db:exec( sql )
for row in db:nrows(sql) do
value = row.value;
end
print( value )