Hi, Is the locking states shown below for DB1 correct ? *Process A* *Process B* Begin Transaction Insert DB1 <-- Reserved lock Select DB1 <-- Shared lock Insert DB1 : after 10 Inserts and 10 Selects
Select DB1 <-- Shared lock : Continue Inserts and Selects : End Transaction <-- Pending to Exclusive Lock On Thu, Jan 28, 2010 at 7:42 PM, Max Vlasov <max.vla...@gmail.com> wrote: > > > > > SQLite allows multiple readers OR a single writer to access the > database > > simultaneously. > > From the SQLite doc, as long as no transaction is pending, other process > > can > > read or obtain reserved lock for write. > > > > the docs say: "Locks are not acquired until the first read or write > operation. The first read operation against a database creates a SHARED > lock > and the first write operation creates a RESERVED lock.". > > So your only chance to have concurrent access from both processes only if > the first one starts transaction and does something innocent like > preparations with selects, temp tables and so on. Any UPDATE or INSERT will > lead to RESERVED lock and process B suspension with db access. > > Max > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users