-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Tito Ciuro
Sent: Wednesday, February 25, 2009 6:36 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] Transactions and attached databases

Hello,

If I attach one or more databases and wrap a series of operations which
affect some/all of them, would ROLLBACK or COMMIT treat these operations
atomically?  For example:

Open database 'foo';
Attach database 'bar' as a1;

BEGIN TRANSACTION;
      INSERT INTO main.some_table ... ;
      DELETE FROM main.some_table WHERE ... ;
      INSERT INTO a1.another_table ... ; COMMIT/ROLLBACK TRANSACTION;

Would the insertions and deletions be either committed or rolled back
atomically? Is this supported?

Thanks,

-- Tito


===================
===================

Greetings, Tito,

Did you see page:
    http://www.sqlite.org/lang_attach.html


Transactions involving multiple attached databases are atomic, assuming
that the main database is not ":memory:". 

It then goes on to say:

If the main database is ":memory:" then transactions continue to be
atomic within each individual database file. But if the host computer
crashes in the middle of a COMMIT where two or more database files are
updated, some of those files might get the changes where others might
not. 

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

Reply via email to