On Fri, 18 Mar 2005, Lothar [unknown-8bit] Märkle wrote:
sqlite3_exec(db, "BEGIN EXCLUSIVE TRANSACTION", NULL, NULL, error); copyFiles(); sqlite3_exec(db, "COMMIT", NULL, NULL, error);
i think you have to use sqlite3_close to be shure all data is written. then copy.
Also are you sure it is completely safe to replace a read only database while reads are currently being done?
I'm using this with cdb, which is a read-only constant-dbm like thingy with put and get only(cr.yp.to/cdb.html)
on unix, this is save for read only one shot processes reading file a and one updating process. fd = open( a.tmp) print( fd, "some new stuff") close( fd ) rename( a.tmp, a)
no process reading file a will see a broken file and no locking is used, because rename is atomic as long you stay in the same filesystem.
this is not always true - on nfs for example. the only atomic ops on nfs are mkdir and symlink.
If you have only readers, i see no reason why an app using sqlite should break. But the readers have to reopen the db.
well - on nfs it will break...
cheers.
-a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | When you do something, you should burn yourself completely, like a good | bonfire, leaving no trace of yourself. --Shunryu Suzuki ===============================================================================