withmy $iface_result = $dbh->prepare("UPDATE device_iface_cache SET interf +ace_status='$stat', lastcheck='$date', hostname='$host' WHERE hostnam +e='$host' AND interface_name='$int_table{$key}';"); $iface_result->execute();
(no need to set hostname again where you select on it) or even easier, using DBIx::Simple with SQL::Abstract:my $iface_result = $dbh->prepare("UPDATE device_iface_cache SET interf +ace_status=?, lastcheck=? WHERE hostname=? AND interface_name=?"); $iface_result->execute($stat, $date, $host, $int_table{$key});
(DBIx::Simple uses a database handle that replaces DBI's $dbh, but is not exactly the same thing. Hence the different name $db. You get it by connecting through DBIx::Simple->connect instead of DBI->connect.)$db->update('device_iface_cache', { interface_status => $stat, lastcheck => $date }, { hostname => $host, interface_name => $int_table{$key} } );
In reply to Re: Interface flap detection in Perl
by bart
in thread Interface flap detection in Perl
by sunnyfedora99
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |