Hi,
I’m currently having problems with SQLite and the Kindle Fire HD.
I’m trying to get my finished game running (which runs fine on iOS) on the Kindle.
I open the database like this:
function openDB()
print("OpenDB")
local path = system.pathForFile("game1.db", system.DocumentsDirectory)
db = sqlite3.open( path )
end
I pinpointed the problem when i try to update a record in the database like this:
function UnlockArea(ItemName)
if db and db:isopen() then
print("DB is open")
else
print("DB is closed")
end
print ("Unlock area: "..ItemName)
local sql =[[UPDATE Doors SET Locked = 0 WHERE ItemName = (']]..ItemName..[[');]]
db:exec( sql )
print("sql: "..sql)
print("db result: "..db:errcode())
So i’m trying to set Locked to 1 in the Doors table, where ItemName = xxx
Works perfectly on iOS, simulator, etc. On the Kindle Fire, it gives an error 14:
SQLITE_CANTOPEN 14 /* Unable to open the database file */
Sometimes, when i try to update other elements in the database, i get:
SQLITE_ERROR 1 /* SQL error or missing database */
The database IS open, thats not the problem. The SQL string is valid, too.
I am able to write to the database in an earlier stage of the game, too.
Strange thing is, when I exit to the main menu of the game, and return to the game, it works flawlessly.
Do I need to open and close the db everytime I write to it?
Anybody any idea how to solve this problem? [import]uid: 50459 topic_id: 31388 reply_id: 331388[/import]