03.02.2014, 15:16
Is this still in beta stage or what?
Hi there!
BUD::Setting( opt.Asynchronous, true); I heard, this will make it faster, however if something happens-database will be corrupted, can anyone explain about this? What if I want to keep it on, how do I prevent getting the database corrupted are there any possible ways? |
Synchronous OFF mode basically writes the data without any sort of backup. If your program terminates or computer shuts down unexpectedly, you will have data loss and your db file will get corrupted if your have it OFF.
There are 3 types of syncs: 0 = OFF | 1 = NORMAL | 2 = FULL (default is always FULL (2)) To avoid chances of corrupting database file, we use timers or close the database after some time to write changes to the .db file. * If you trust your server, it will never crash, then use sync off without any worries and save data after good time intervals. |
db_exec(db, "PRAGMA synchronous = NORMAL");
db_exec(db, "PRAGMA journal_mode = WAL");