Android Question log file...

merlin2049er

Well-Known Member
Licensed User
Longtime User
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
one possible solution .. create new table daily ,tablename = date.
then delete previous days table.
B4X:
SQL1.ExecNonQuery("DROP TABLE IF EXISTS YesterdaysTable")
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
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

sorex

Expert
Licensed User
Longtime User
this must be the easiest way (if it works )

B4X:
delete from logtable where date(timestamp)<>date(now)

or even

delete from logtable where date(timestamp)<date(now)
 
Upvote 0

merlin2049er

Well-Known Member
Licensed User
Longtime User
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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…