Re: [sqlite] ring buffer table

2006-01-09 Thread Jay Sprenkle
> > That works but what do you sort by to get the entries in order? > > You can either just use a simple sequence and then delete where sequence > mod = 0 (hrm... does sqlite support > functional indexes?), or just add a timestamp to the table. most people that implement a ring buffer are wanting

Re: [sqlite] ring buffer table

2006-01-09 Thread Jim C. Nasby
On Mon, Jan 09, 2006 at 09:19:00AM -0600, Jay Sprenkle wrote: > > A guy on this end had a suggestion that I kicked myself for not > > thinking of earlier: Use a simple numeric ID that you mod by the number > > of records you want, automatically overwriting the oldest record when a > > new one com

Re: [sqlite] ring buffer table

2006-01-09 Thread Jay Sprenkle
> A guy on this end had a suggestion that I kicked myself for not > thinking of earlier: Use a simple numeric ID that you mod by the number > of records you want, automatically overwriting the oldest record when a > new one comes along.. I may have to put together a smallish trigger to > keep th

Re: [sqlite] ring buffer table

2006-01-09 Thread Paul Bohme
Julien LEFORT wrote: Hi, I would like to implement a log table with a finite dimension, for exemple a table with 500 records, and when the last record is set in the table I would like to come back at the first tuplet and write over the previous value recorded. I think it's the way SQLite jour

RE: [sqlite] ring buffer table

2005-12-24 Thread Richard B. Boulton
|Stuff 11 12|Stuff 12 13|Stuff 13 14|Stuff 15 15|Stuff 16 16|Stuff 17 17|Stuff 18 18|Stuff 19 19|Stuff 20 20|Stuff 21 > -Original Message- > From: Richard B. Boulton [mailto:[EMAIL PROTECTED] > Sent: 24 December 2005 10:44 > To: sqlite-users@sqlite.org > Subject: RE: [sqlit

RE: [sqlite] ring buffer table

2005-12-24 Thread Richard B. Boulton
oops, just realised that doesn't work when you get further than 10. > -Original Message- > From: Richard B. Boulton [mailto:[EMAIL PROTECTED] > Sent: 24 December 2005 10:37 > To: sqlite-users@sqlite.org > Subject: RE: [sqlite] ring buffer table > > > If yo

RE: [sqlite] ring buffer table

2005-12-24 Thread Richard B. Boulton
If you used an INTEGER PRIMARY KEY AUTOINCREMENT could you use a simple trigger and a modulus of the newly inserted rowid? e.g. for a dimension of 10: CREATE TABLE ring_buffer (key INTEGER PRIMARY KEY AUTOINCREMENT, stuff TEXT); CREATE TRIGGER delete_tail AFTER INSERT ON ring_buffer BEGIN DELE

RE: [sqlite] ring buffer table

2005-12-23 Thread Griggs, Donald
-Original Message- From: Paul Bohme [mailto:[EMAIL PROTECTED] Sent: Friday, December 23, 2005 2:10 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] ring buffer table Cory Nelson wrote: >afaik, sqlite doesn't store row counts so count(*) causes a full table scan. > &

Re: [sqlite] ring buffer table

2005-12-23 Thread Paul Bohme
r other entities, thus I didn't really expect SQLite to have it. -Original Message- From: Paul Bohme [mailto:[EMAIL PROTECTED] Sent: Viernes, 23 de Diciembre de 2005 02:52 p.m. To: sqlite-users@sqlite.org Subject: Re: [sqlite] ring buffer table Julien LEFORT wrote: Hi, I woul

Re: [sqlite] ring buffer table

2005-12-23 Thread Cory Nelson
than maintaning a > separate table for the counters. > > -Original Message- > From: Paul Bohme [mailto:[EMAIL PROTECTED] > Sent: Viernes, 23 de Diciembre de 2005 02:52 p.m. > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] ring buffer table > > Julien LEFORT wrote:

RE: [sqlite] ring buffer table

2005-12-23 Thread Axel Mammes \(gmail\)
p.m. To: sqlite-users@sqlite.org Subject: Re: [sqlite] ring buffer table Julien LEFORT wrote: >Hi, >I would like to implement a log table with a finite dimension, for exemple a >table with 500 records, and when the last record is set in the table I would >like to come back at the

Re: [sqlite] ring buffer table

2005-12-23 Thread Paul Bohme
Julien LEFORT wrote: Hi, I would like to implement a log table with a finite dimension, for exemple a table with 500 records, and when the last record is set in the table I would like to come back at the first tuplet and write over the previous value recorded. I think it's the way SQLite jour

Re: [sqlite] ring buffer table

2005-12-22 Thread Cyril Scetbon
implement a trigger that count the number of rows : if count(rows) = 500 then delete the first row Julien LEFORT wrote: Hi, I would like to implement a log table with a finite dimension, for exemple a table with 500 records, and when the last record is set in the table I would like to come b