I am trying to figure out what is the safest strategy to protect the SQLite database from files (file-based) from corruption (in this case I work with Adobe Air, but this can apply to any webkit browser that uses SQLite, including Mobile Safari).
I am thinking of creating a database connection, saving it for only 5 or 10 seconds, and then closing it if it has not been used during this period. My thinking is that when the machine crashes or when the application exits, the chances are that the file is already closed and therefore less likely to get corrupted. But I know that the more often you open and close the file database, the more likely you are to have a critical error.
I'm sure I think about it too much, but it is very important for my application that in the event of a system crash, the application can recover clean and fast, which means that I should try to protect the database as much as I can.
Does anyone know which strategy could be safer?
source
share