merlin2049er Well-Known Member Licensed User Longtime User Sep 20, 2014 #1 Just wondering if it's too much of a burden to insert records into a sqlite table, and after the insert do some cleanup and delete yesterday's records? (I'll have a time stamp in the table.)
Just wondering if it's too much of a burden to insert records into a sqlite table, and after the insert do some cleanup and delete yesterday's records? (I'll have a time stamp in the table.)
mangojack Expert Licensed User Longtime User Sep 20, 2014 #2 one possible solution .. create new table daily ,tablename = date. then delete previous days table. Code: SQL1.ExecNonQuery("DROP TABLE IF EXISTS YesterdaysTable") Upvote 0
one possible solution .. create new table daily ,tablename = date. then delete previous days table. Code: SQL1.ExecNonQuery("DROP TABLE IF EXISTS YesterdaysTable")
DonManfred Expert Licensed User Longtime User Sep 20, 2014 #3 asuming your timestamp is an unix-timestamp (seconds since 1.1.1070 0:00) Calculate the timestamps of yesterday. timestamp1: yesterday 0:00 AM (midnight) timestamp2 = timestamp1 + 86400 then in Database delete from mytable where timestamp>= timestamp1 and timestamp <= timestamp2 I´m not really familar with sqlite on Android so i can´t give you an concrete example. But my post should give you an suggestion on how to do it... Upvote 0
asuming your timestamp is an unix-timestamp (seconds since 1.1.1070 0:00) Calculate the timestamps of yesterday. timestamp1: yesterday 0:00 AM (midnight) timestamp2 = timestamp1 + 86400 then in Database delete from mytable where timestamp>= timestamp1 and timestamp <= timestamp2 I´m not really familar with sqlite on Android so i can´t give you an concrete example. But my post should give you an suggestion on how to do it...
S sorex Expert Licensed User Longtime User Sep 20, 2014 #4 this must be the easiest way (if it works ) Code: delete from logtable where date(timestamp)<>date(now) or even delete from logtable where date(timestamp)<date(now) Upvote 0
this must be the easiest way (if it works ) Code: delete from logtable where date(timestamp)<>date(now) or even delete from logtable where date(timestamp)<date(now)
DonManfred Expert Licensed User Longtime User Sep 20, 2014 #5 I´m not familar with sqlite like i said. and he was talking about timestamp. so i though on unixtime-stamp... If "timestamp" is like kind of "201409201706" then i would say that there must me "date-routines" inside sqlite. Upvote 0
I´m not familar with sqlite like i said. and he was talking about timestamp. so i though on unixtime-stamp... If "timestamp" is like kind of "201409201706" then i would say that there must me "date-routines" inside sqlite.
merlin2049er Well-Known Member Licensed User Longtime User Sep 20, 2014 #6 Ok, I'm using the Android system date & time and inserting that into a record. I should be able to use that, if not I'l swap it out. Upvote 0
Ok, I'm using the Android system date & time and inserting that into a record. I should be able to use that, if not I'l swap it out.