On Mon Feb 23 2015 at 1:41:31 PM Simon Slavin <slavins at bigfraud.org> wrote:
> > On 22 Feb 2015, at 11:15pm, Donald Shepherd <donald.shepherd at gmail.com> > wrote: > > > If I use the backup API to create a copy of an SQLite database that uses > > Write-Ahead Logging, will the resulting copy reflect the contents of both > > the base database file and the -wal file? > > Until a transaction is COMMITted, it's not part of the database. Because > the program could decide to ROLLBACK instead. > My understanding of WAL is that even if a transaction is COMMITted it will sit in the -wal file until a checkpoint occurs, i.e. by default when the -wal file reaches 4 MB. As a result that transaction will only be present in the copied SQLite database if the backup API takes into account the contents of both files. Further reading led me to a reference stating that under the covers the backup API is treated the same as any other reader, so I take that to mean that it looks at both files and compiles the copy from the two.

