On Jun 3, 2004, at 1:52 AM, Darren Duncan wrote:

At 1:43 AM +0200 6/3/04, David Costa wrote:
thanks for your reply, few more questions

1. Obtain a file system read lock on the SQLite database file.
this shouldn't be a problem but I will need to do it from php. How would you do it in console ?

You are asking a PHP-specific question. Look at the PHP manual about file locking. This is a very generic task that any programming language worth its salt can do. In Perl the function name is "flock". (You also don't need SQLite itself to do this backup, which hopefully was implied before.)

right, if you mean the normal file locking I know how to handle that, I wasn't sure if it was something different for an sqlite file, my bad.



2. Check if a corresponding rollback log exists.

how ? :D

See if there is another file in the same directory as the database file, and that has the same file name plus an extension. I forget the extension characters off the top of my head, though it may be ".journal". This file is maintained during an active write transaction on the database; if it still exists when you get your read lock, then the last process to use the file didn't close or commit or rollback the database properly. SQLite itself will perform an auto-rollback when it next sees the file, after your backup. Meanwhile, your backup needs to include the journal file, so that the same correction can be done on the database restored from your backup.

Thanks a lot. This is very helpful.

Regards
David Costa


-- Darren Duncan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to