Friday, 15 January 2010

sql - sqlite, triggers and concurrency -



sql - sqlite, triggers and concurrency -

i developing application uses sqlite trigger in form

create trigger bar_to_foo after insert on bar begin delete * foo; insert foo select bar; end;

multiple users using application @ same time , potentially inserting bar @ same time.

my question is: there chance triggers execute in parallel? if so, 2 deletes may happen before inserts, result in foo contains bar twice over. not want - ideally, i'd entirety of trigger execute before reruns. if not default behavior in sqlite, there way specify should happen?

sqlite serializes transactions. (and when not using explicit transaction, each top-level statement wrapped in automatic transaction.)

no 2 transactions can write same database @ same time, whether within trigger or in other way.

sql sqlite

No comments:

Post a Comment