My solution was as follows (this limits to specific size on disk):

Every time I insert stuff I do the following:

ReadSizeOfDBFile
If ( size > MAXDBSIZE ){
        If ( freeDBPages < 10 ){
                RemoveSomeRecords
        }       
}

Jardar

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kees Nuyt
Sent: 7. august 2008 20:07
To: General Discussion of SQLite Database
Subject: Re: [sqlite] about sqlite database

On Wed, 6 Aug 2008 23:57:51 -0700 (PDT), you wrote:

>
>In sqlite whether can we rotate content in database .
>That means i want to restirct my database to some size,if it exceeds that
>size it has to replace first entry.
>Can anybody help.Thanks in advance

I had a similar requirement some time ago.
This was my solution (it limits the number of rows in the
table, not the size on disk, but in many implementations
that is more or less equivalent):

CREATE TABLE jobs (
        jobid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
        jobprio   INTEGER  DEFAULT 9 
                CONSTRAINT jobs_valid_prio
                CHECK (jobprio > 0 AND jobprio < 10),
        status    CHAR(1)  DEFAULT 'W' 
                CONSTRAINT jobs_valid_status 
                CHECK (status IN ('W','I','R','T','A','C')),
        userid    VARCHAR(8) NOT NULL,
        :
        :
);
CREATE INDEX idx_jobs_tsn ON jobs(TSN);

CREATE TRIGGER jobs_ins AFTER INSERT ON jobs
FOR EACH ROW BEGIN
        DELETE FROM jobs WHERE jobid < (NEW.jobid - 9999);
END;
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.5.12/1596 - Release Date: 8/6/2008
16:55


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

Reply via email to