On Tue, May 10, 2011 at 12:00 PM, Jay A. Kreibich <j...@kreibi.ch> wrote:
>> I guess I am looking for a "round robin queue" here?
>
>  I'd do something like this.  This keeps a constant number of messages
>  in the log.  The "msg_id" provides a message counter, while the
>  "msg_seq" is used to keep the round-robin offset.  The use of a view
>  is required to enable a INSTEAD OF trigger.  There might be a way to
>  do this directly against the a table, but I'm not all that
>  experienced with SQLite triggers.

You can get the effect of INSTEAD OF triggers on actual tables by
using a BEFORE INSERT trigger that ends with a SELECT RAISE(IGNORE):

CREATE TABLE t1(a);
CREATE TABLE t2(a);
CREATE TRIGGER t BEFORE INSERT ON t1 BEGIN
 INSERT INTO t2 SELECT NEW.a;
 SELECT RAISE(IGNORE);
END;

Thanks for the tip about the max_page_count pragma!

And, thinking about the way SQLite3 works today, re-using rowids --
using rowids as a circular list -- should help keep the page count
down, particularly if there's a maximum size for the rows being added
into that table.

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

Reply via email to