> For example: the INSERT inserts a row into table and invokes
> registered ON INSERT (AFTER) trigger.Would the state of database lock
> be RESERVED (presuming there is space in cache)?

Trigger is always executed inside the same transaction as the
statement causing trigger to execute. So, yes the lock will be
RESERVED if space in the cache permits.

> be RESERVED (presuming there is space in cache)? If trigger invokes an
> IPC that result in another process reading the INSERTED row, it should
> use the TRANSACTION IMMEDIATE. This way the later process would get
> SQLITE_BUSY until the first one commits the INSERT. Right?

How is it possible that trigger invokes IPC? Are you using a
user-defined function that tries to execute IPC? If yes I'd say it's a
very bad idea. Other than that another process will be able to read
database if first process holds RESERVED lock but it will unable to
execute BEGIN IMMEDIATE statement or any other writing to database,
also there's no way for it to read inserted row until transaction in
the first process is committed.


Pavel

On Tue, Dec 21, 2010 at 12:52 AM, Nishtiak <nishtia...@gmail.com> wrote:
> Hi,
>
> I was wondering about the lock state when one the TRIGGER are getting
> invoked? I would like to apologize, if I missed the explanation in the
> documentation or in previous thread.
>
> For example: the INSERT inserts a row into table and invokes
> registered ON INSERT (AFTER) trigger.Would the state of database lock
> be RESERVED (presuming there is space in cache)? If trigger invokes an
> IPC that result in another process reading the INSERTED row, it should
> use the TRANSACTION IMMEDIATE. This way the later process would get
> SQLITE_BUSY until the first one commits the INSERT. Right?
>
> Similarly ON UPDATE and ON DELETE..
>
> Thanks in advance,
> Mark
> _______________________________________________
> 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

Reply via email to