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

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

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

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

RE: [sqlite] ring buffer table

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

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 you use

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

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. > >On

Re: [sqlite] ring buffer table

2005-12-23 Thread Paul Bohme
tities, 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 would like to imp

Re: [sqlite] ring buffer table

2005-12-23 Thread Cory Nelson
n 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

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

[sqlite] ring buffer table

2005-12-22 Thread Julien LEFORT
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 journal is implmented. Is