--- Yves Goergen <[EMAIL PROTECTED]> wrote:
> in a scenario when multiple operations need to be transactionally
> synchronised, I have a file that must be deleted when the database
> records are added successfully, but the database operations must be
> rolled back, if the file cannot be deleted.
> 
> I'm currently using a transaction for this on the database side and
> rolling it back if the file cannot be deleted. But what if the file is
> gone and then SQLite says it doesn't accept my records? Since we're
> inside a transaction, integrity checks should be deferred until a
> COMMIT. Is there a way to tell whether the COMMIT will succeed under the
> current conditions so that I can safely delete the file?
> 
> Would that work with nested transactions or are integrity checks also
> deferred to the most outer transaction? I never used nested transactions
> so I have no experience with it.

There's no nested transaction support at this time, although it's on 
the to do list: http://www.sqlite.org/cvstrac/wiki?p=ToDo

But you will always have trouble with external synchronization with 
resources that do not support 2PC anyway.

http://en.wikipedia.org/wiki/Two-phase_commit

Are you able to store this file in the database itself as a BLOB?
You might be able to use Libsqlfs, a POSIX style file system on top 
of an SQLite database. (I've never tried to use it).

  http://www.nongnu.org/libsqlfs/

Assuming this library works, your users can always be guaranteed the files
are valid, and are erased in concert with your database transactions.


      
____________________________________________________________________________________
Park yourself in front of a world of choices in alternative vehicles. Visit the 
Yahoo! Auto Green Center.
http://autos.yahoo.com/green_center/ 

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to