Hi Simon,

Thanks for the feedback below, I will write some "delete logic" to run 
from time to time.......;-)

Lynton

On 10/05/2011 13:34, Simon Slavin wrote:
> On 10 May 2011, at 11:42am, Lynton Grice wrote:
>
>> BTW: if I am using SQLIte as a logger, what PRAGMA statement can I use
>> to say FIX the sqlite database size to say "5 MB"?
> There isn't one.  SQLite would not know which records to delete.
>
>> Also, lets say I have a AUTOINCREMENT INTEGER PRIMARY KEY, what will
>> happen when it reaches 5 MB? Will it just keep returning SQLITE_FULL or
>> similar? I guess I am looking for a "round robin queue" here?
> A round robin queue is fine.  Every so often, to kill off old records do
>
> SELECT max(rowid) FROM myTable
>
> then in your code subtract from it however many rows you want to keep, then do
>
> DELETE FROM myTable WHERE rowid<  firstToRetain
>
> It won't work perfectly but it's simple and fast.
>
>> While I'm on it, if I have an AUTOINCREMENT INTEGER PRIMARY KEY with a
>> LOGGER implementation, and the integer reaches it's limit (even though I
>> am deleting previous records), will the sqlite database assign "un-used
>> primary keys" (previously deleted) to any NEW inserts?
> A SQLite integer can get /really/ big: 2^63.  There's no way you could ever 
> write enough records to push it  over the limit.  Your hardware will 
> disintegrate first.
>
> Simon.
> _______________________________________________
> 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