One thing to watch out for - using SQLITE for a FIFO will have limited 
throughput, because commits will have to be done after inserting or removing 
each entry. This might not be an issue in some situations - I have actually 
implemented a FIFO to communicate between two tasks where the work-per-entry 
was significant, the transaction rate was low, and the protection against 
accidental loss was paramount.

*** Doug F.


-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Christopher Taylor
Sent: Monday, May 18, 2009 9:13 AM
To: Allen Fowler; General Discussion of SQLite Database
Subject: Re: [sqlite] Sqlite as a FIFO buffer?

The way this table works is that when an insert is made, the trigger is 
activated.  The trigger looks to see if there are more than a set number of 
records.  If so, the oldest record(s) are deleted by the trigger.  This is 
accomplished using an auto increment field.  This number increases by one on 
each insert.  Therefore I know that if the key field is greater than my 
limit I can safely delete any record whose key field is less than the max 
key minus the limit.  Hope this helps.

Chris 

_______________________________________________
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