I want to have an application that has a permanent database file(on a hard drive) and every time I run my application it needs to create another database file(temporary file in RAM) that will store certain information. This temporary file will be flushed to permanent storage(permanent database file) one time at the end of execution. I was advised to use “SQLite Online Backup API” http://www.sqlite.org/backup.html but got a question. Will temporary file(one in memory) update my backup file every time I exit application or will it erase all old data contained in backup file and save only information that is in memory?
Is it something like this?
char zFilename[] = "permanent.db";
char *db_name= ":memory:";
rc = sqlite3_open(db_name, &db);
//write some data to db
.........
//end of application flush db(memory) to permanent.db file
loadOrSaveDb( db, zFilename, 1);
I.e. I need to have one permanent database file that will be updated after every run of my application.(it should contain data from old runs and update data from new runs)
Thanks in advance.
From the SQLite Online Backup API documentation:
As far as I can tell, any data from previous runs will be lost, unless, of course, you load it to the in-memory database when your program starts, so that it will be copied back at the end.