Hi, I’m dealing with the same issue, did you find a solution? I want to check if a value exists for a column, but my function for select is always returning 0.
require "sqlite3" local path = system.pathForFile( "data2.db", system.DocumentsDirectory) local db = sqlite3.open( path ) local tablesetup = [[CREATE TABLE IF NOT EXISTS test (name);]] db:exec( tablesetup ) local people = {'John', 'Mark', 'Fred', 'Sam'} for i=1,#people do local q = [[INSERT INTO test VALUES (']] .. people[i] .. [[');]] db:exec( q ) end for row in db:nrows("SELECT \* FROM test") do print(row.name) end local result = db:exec("SELECT EXISTS(SELECT 1 FROM test WHERE name='John');") print("Select result is " .. result) local function onSystemEvent( event ) if event.type == "applicationExit" then if db and db:isopen() then db:close() end end end Runtime:addEventListener( "system", onSystemEvent )