I would like to construct a SQLite database for one writer and one or more
reader connections.  The writer will be updating various data tables which
occasionally trigger one or more row inserts in a command table named
'cmd'.  This command table is being polled by the readers for new commands.

To make the example more concrete, suppose the following DDL defines the
command table:

CREATE TABLE cmd(opcode TEXT, params TEXT);

Also assume each reader is in a different process which maintains its own
open db connection over which it periodically executes the following
command retrieval query,

SELECT * FROM cmd WHERE rowid>=$lastCmdRowid;

where $lastCmdRowid is a variable managed by the reader to keep track of
the last command that was seen from its point of view.  [FYI yes, of course
there are other time stamp bookkeeping columns and variables that I've
omitted because they don't pertain this question.]

So finally, here is the question.  Is there a SQLite API way for reader
connections to block and wait for a meaningful change, like a new row, in
the 'cmd' table instead of madly polling and using up database concurrency
resources?  [Block with timeout would be even more desirable of course.]
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to