I am writing a new Windows Form 2.0 application. This app is going to be a data file. The user will be able to open the data file, do some work and save on disk. Then he will be able to open it later, Microsoft Word and continue to work. Same as dock files
I want to use SQLite for the data file. However, I do not want to change the data in the data file immediately. I want the user to change the data, but the file on the disc is left unchanged. The data file will change on the disk only when the user clicks "Save".
In your opinion, what is the best way to do this?
Should I load the content of SQLite DB in memory, it may be mapping the object, and when the user clicks on "save", then writing it back
Or ... is there a way to work out data files with SQL commands (no objects), but only by saving changes in memory, unless "Save" is clicked?
I'm a little confused, I appreciate any idea about a best practice for this.
Cheers
1) At startup, create a temporary copy of the SQLite file. This will be your "working file".
2) Run all INSERTs / UPDATE / DELETE against the working file. When the user clicks on "Save", copy the working file to the original.
3) Delete working file and goto step # 1.
Comments
Post a Comment