When do I open and close a sqlite DB when using Storyboard?

Hey all, what is the best practice to open and close a sqlite db when using storyboard?

I have a VERY large database of resources to access and only want to open it and close it when required by a specific scene.

Do I open it in the function “scene:enterScene( event )”  or just put it in the “scene:createScene( event )” function?

I’ve tried putting the close db function in the “scene:exitScene()” and the “scene:destroyScene( event )” and I’m not sure it’s right. 

Any advice as to when to open and close the db so that it is not in memory when I switch back and forth between scenes?

Are there other best-practices that I’m overlooking?

Thanks!

enterScene and exitScene are always called in pairs.  So that’s a good point to open and close things.  If your createScene() doesn’t need to access the database, enterScene and exitScene are the best.  It also would not hurt to open it in main.lua and close it on a suspend Event and re-open it on a resume event.

Rob

enterScene and exitScene are always called in pairs.  So that’s a good point to open and close things.  If your createScene() doesn’t need to access the database, enterScene and exitScene are the best.  It also would not hurt to open it in main.lua and close it on a suspend Event and re-open it on a resume event.

Rob