Angus March <an...@uducat.com> wrote:
> Igor Tandetnik wrote:
>> Angus March <an...@uducat.com> wrote:
>>
>>> I want to copy a db file while it is still open, and I'm wondering
>>> how safe that is. It would go something like this:
>>>
>>>   1. Lock exclusively with PRAGMA locking_mode=EXCLUSIVE; Many
>>>      process are accessing the db afterall
>>>   2. UPDATE a_table SET a_column=0;
>>>   3. After finalizing (I'm using the C API) the queries in 1 and 2,
>>>      but before closing the connection to the db, I would copy the
>>> db file.
>>>
>>
>> Why not just run BEGIN EXCLUSIVE before copying, and ROLLBACK (or
>> COMMIT, doesn't matter since you made no changes) afterward?
>>
>
>    Who knows? SQLite might cache things in userspace, or making
> important changes that only a connection close would call.

If BEGIN EXCLUSIVE succeeds, it means there are no outstanding 
transcations on any other connection and all changes are committed to 
the disk surface. I'm not sure I understand the scenario you are 
concerned about.

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to