DB newbie question:
Why is necessary to close database on application exit?
What can happen if I forget to close?
Thanks
DB newbie question:
Why is necessary to close database on application exit?
What can happen if I forget to close?
Thanks
Databases cache data that is written for performance and your actual data may not be completely written out and you could loose data or end up with a corrupted database.
So, if I use DB just for reading of data and not to store or alter the existing data in database then it doesn’t mater if db is properly closed? Or it does?
If the DB is in your folder with your main.lua (i.e. system.ResourcesDirectory) and you are on iOS, then that file will be read only and you probably won’t need to close it. But if it’s in system.DocumentsDirectory (or possibly on Android since those files are actually unzipped out of the APK and while you shouldn’t be able to write to it, just to be safe), then I would think closing it would still be a “just to be safe” thing.
Yes, it’s in the same dir as my main.lua file.
But I’ll close it on exit anyway…
I was confused about that closing thing but now I know why it is necessary…
Thank you
Databases cache data that is written for performance and your actual data may not be completely written out and you could loose data or end up with a corrupted database.
So, if I use DB just for reading of data and not to store or alter the existing data in database then it doesn’t mater if db is properly closed? Or it does?
If the DB is in your folder with your main.lua (i.e. system.ResourcesDirectory) and you are on iOS, then that file will be read only and you probably won’t need to close it. But if it’s in system.DocumentsDirectory (or possibly on Android since those files are actually unzipped out of the APK and while you shouldn’t be able to write to it, just to be safe), then I would think closing it would still be a “just to be safe” thing.
Yes, it’s in the same dir as my main.lua file.
But I’ll close it on exit anyway…
I was confused about that closing thing but now I know why it is necessary…
Thank you