I have a function which performs a test on a DB element, and performs an
addition of the NOW() + INTERVAL $auth_life_secs SECOND for a Table
update. I would like to set a variable equal to this amount so that I
can test the value of the DB Field to see if the update should be performed.
I am attempting to modify the following SQL statement:
my $query = "SELECT id FROM table WHERE relay_ip = ? and origin_type =
'MANUAL' and mail_from is NULL and rcpt_to is NULL";
to something like the following:
my $query = "SELECT id FROM table WHERE relay_ip = ? and origin_type =
'MANUAL' and mail_from is NULL and rcpt_to is NULL and record_expires <
( NOW () + INTERVAL )";
Of course the above is not the correct syntax (I got an error from it),
however it is able to perform the following:
my $rows = $dbh->do("UPDATE table SET record_expires = NOW() + INTERVAL
$auth_life_secs SECOND, last_update=current_timestamp"
I need to modify the Select statement to ignore records which have a
record_expires field which is past the quantity of DATE() + INTERVAL.
I can keep the original Select statement, but how can I test the value
of the record_expires field?
--
Albert E. Whale, CHS CISA CISSP
Sr. Security, Network, Risk Assessment and Systems Consultant
-------------------------------------------------------------------
ABS Computer Technology, Inc. - www.ABS-CompTech.com
SPAM Zapper - No-JunkMail.com - Spam-Zapper.com - SPAM Stops Here.
President of the Pittsburgh InfraGard Alliance