[sqlite] Copying an open DB file (iOS)

2015-05-08 Thread Simon Slavin
On 8 May 2015, at 6:54pm, Scott Perry wrote: > If you're using wal mode journalling (which I'd recommend for running on iOS > devices), you'll want to execute `PRAGMA wal_checkpoint(TRUNCATE);` before > closing your last connection to ensure you don't leave any data behind in the > journal

[sqlite] Copying an open DB file (iOS)

2015-05-08 Thread Simon Slavin
On 8 May 2015, at 8:09am, Jeff M wrote: > For a restore, the current DB is closed, then a backup file is copied in and > opened. > I've been using this scheme for years without a problem. But, should I > flush, or close, or lock before the copy? You need to close your connection, take the

[sqlite] Copying an open DB file (iOS)

2015-05-08 Thread Scott Perry
On May 8, 2015, at 4:47 AM, Simon Slavin wrote: > On 8 May 2015, at 8:09am, Jeff M wrote: > >> For a restore, the current DB is closed, then a backup file is copied in and >> opened. > >> I've been using this scheme for years without a problem. But, should I >> flush, or close, or lock

[sqlite] Copying an open DB file (iOS)

2015-05-08 Thread Jeff M
I'm using SQLite (via FMDB) with an on-disk database in several iOS apps. In each case, the DB file is only used by the one app and there's no DB activity on background threads. The apps have a backup feature (initiated by the user) that simply copies the database file. There is no other