The problem is that apparently did not enter the record in the table of the database, since it fails to list all content
Curiously, a similar example if it works and I have nothing different
code gives no error, simply does not fit "print all the contents table. "
El problema es que aparentemente no introduce el registro en la tabla de la base de datos, ya que no llega a listar nada de contenidos
Es curioso, en un ejemplo similar si funciona y no tengo nada diferente
el código no da error, simplemente no entra por “print all the table contents”.
require “sqlite3”
local path = system.pathForFile(“data.db”, system.DocumentsDirectory)
db=sqlite3.open(path)
–Handle the applicationExit event to close the db
local function onSystemEvent( event )
if( event.type == “applicationExit” ) then
db:close()
end
end
local taboa_cabezas =[[CREATE TABLE IF NOT EXISTS tcabezas (id INTEGER PRIMARY KEY, arquivo, posx, posy);]]
db:exec(taboa_cabezas)
local cabeza0={}
cabeza0[1]=“baseCabeza.png”
cabeza0[2]=90
cabeza0[3]=120
local rexistro0=[[INSERT INTO tcabezas VALUES (NULL, ‘]]…cabeza0[1]…[[’,’]]…cabeza0[2]…[[’,’]]…cabeza0[3]…[[’);]]
db:exec(rexistro0)
–print all the table contents
for row in db:nrows(“SELECT * FROM tcabezas”) do
print(row.arquivo…" “…row.posx…” "…row.posy)
end
–setup the system listener to catch applicationExit
Runtime:addEventListener( “system”, onSystemEvent ) [import]uid: 13461 topic_id: 7151 reply_id: 307151[/import]