I'm trying to create global for deleting expired records. I'v almost made it, but ..
When visitor add his record in my database, he must enter number of days during which the record remains in database ("ExpirePeriod" field = some amount of days, e.g. "7", or "14", or "129", etc., defined by user).
So, each record can have it's own unique ExpirePeriod. At the end of this period the record are automatically removed from the database. So should be.
Now, I have this:
my $cond = GT::SQL::Condition->new( 'CreationDay', '<', (time - ( 10 * 86400)) );
$DB->table('MyTable')->delete( $cond );
(The CreationDay field contains value of "time" in seconds at a point in time when record were created)
It works, but deletes records independently of the ExpirePeriod value (after 10 days in this case).
I need something like this (this one not works):
my $cond = GT::SQL::Condition->new( 'CreationDay', '<', (time - ( 'ExpirePeriod' * 86400)) );
Probably, this is simply syntax question. I have read many threads, but haven't found something similar :(
How I can put ExpirePeriod variable in this Condition statement?
Thank you in advance,