-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/08/2010 09:17 PM, David Barrett wrote:
> Right now I'm just doing a copy of the live file and then running .dump on 
> the copy,

I suggest you use the backup API which will handle all your issues.  The way
it works is that you start the backup with sqlite3_backup_init.  Then
repeatedly call the sqlite3_backup_step function to copy the specified
number of pages.  The database is locked while copying those pages so the
smaller the number you specify the less time it will be locked at once.  The
step function can also return busy, so you can wait a bit and try again.
Once complete there is a sqlite3_backup_finish function.

BTW one thing to watch out for with WAL is that changes go to the WAL
journal first which is a separate file.  Consequently if you copy the main
database then you will be missing out on those changes, until WAL does a
checkpoint.  (This has already caught out one of my users who was directly
copying files instead of using the backup API.)

In short, using the backup is guaranteed to work correctly including in the
future.  Other solutions will be caught out as SQLite gets enhanced over time.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxfkacACgkQmOOfHg372QRCzACcDSbtpL0/JWppzRD0pti/hsI3
OjoAniGI0j0+DDAAoMnEZ9fUjQZx8SEZ
=PgFb
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to