This decorator opens & closes the connection to SQLite DB in order to minimize the chances of the file getting corrupted, and wraps most of the functions.
There are situations when a lot of time passes between operations on DB.
However, wrapped functions call other wrapped functions, inside functions return and call other wrapped functions, and, sometimes, a DB operation fails just because the database is closed by some wrapped functions.
What should I do?
close only when the script exits
open and close the db for every DB operation, not for every function that contains a connection to db.
This decorator opens & closes the connection to SQLite DB in order to minimize the chances of the file getting corrupted, and wraps most of the functions. There are situations when a lot of time passes between operations on DB.
How To Corrupt An SQLite Database File - https://www.sqlite.org/howtocorrupt.html
However, wrapped functions call other wrapped functions, inside functions return and call other wrapped functions, and, sometimes, a DB operation fails just because the database is closed by some wrapped functions.
What should I do?