If i consistently use a global called ‘db’ for all my database purposes, will i need to use the following code only once in the entire project, or will I need to add it every time I open a database
–Handle the applicationExit event to close the db
local function onSystemEvent( event )
if( event.type == “applicationExit” ) then
if (db and db:isopen()) then
db:close()
end
end
end
–setup the system listener to catch applicationExit
Runtime:addEventListener( “system”, onSystemEvent )