Hi all I have a quick question regarding when to close your DB connection.
I have a profile window that I have multiple methods for as you would expect. SQLConnect, SQLSelect, SQLUpdate, SQLInsert, SQLRemove, SQLSchemaSetup etc. This is the normal flow right now (very high level omitting error checks etc).
- I open my DB connection
- I check for Schema Setup / Create if not there
- Wait for User to do something. Ie. add new row (SQLInsert), modify a row (SQLUpdate), remove a row (SQL remove) etc.
- Run method which performs SQL transaction
- Keep DB connection open for future transactions
Since my user will possibly be making many modifications at this Window at once my question is when do you Close the Database Connection? Does it put a huge load on the SQLite DB opening/closing the connection after every transaction? Is that best practice?
My db size forecasting is about 7 columns and probably max 2k-3k entries.
Any advice would be appreciated. Thank you.