Yup, fair enough.......what I think would be better is to have s variable set called something like "history_retain_time" (like Nico said)......and perhaps a "log_check_interval" in DAYS or HOURS or MINUTES....whatever suits the application.....
Then perhaps on each insert you get the code to get the current TIME, then if the time is >= "log_check_interval" then it is time to DELETE all records older than the "history_retain_time"..... I think that would be better..... Chat later Lynton On 10/05/2011 16:38, Stephan Beal wrote: > On Tue, May 10, 2011 at 4:32 PM, Lynton Grice > <lynton.gr...@logosworld.com>wrote: > >> I like the ON INSERT trigger.....good idea. So perhaps you have a >> "setLogMaxSize" type function in C that allows the client program to say >> "hey, I only want the log to hold a max of 10 000 records".....and then >> I do a select count(*) inside the ON INSERT type trigger and delete >> entries if "num records> max"...... >> > The problem i see with that is that once the log has overflowed one time, > further log calls will run a DELETE very often. Why? > > max_log_count=10 > current_log_count=9 > > log("foo"); > current_log_count=10 == clean up == > current_log_count=9 > > log("bar") > current_log_count=10 == clean up == > current_log_count=9 > ... > ad naseum > > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users