Try This:
local connection = nil
addEventHandler ( "onResourceStart", resourceRoot,
function ( )
connection = dbConnect( "sqlite", "database/database.db" )
if ( connection )then
outputDebugString ( "Successfully connected to database.db" )
else
outputDebugString ( "Failed to connect to database.db", 3 )
end
end
)
function dbQueryZA( ... )
if (not connection ) then
return false, "Couldn't connect to SQLite database."
else
local hadler = dbQuery( connection, ... )
return dbPoll( hadler, -1 )
end
end
function dbExecZA( monkey, ... )
if ( not connection ) then
return false, "Couldn't connect to SQLite database."
else
return dbExec( connection, monkey, ... )
end
end