Return to Snippet

Revision: 41445
at February 18, 2011 04:21 by markbenfield


Initial Code
   # --------------------------
   # prepare the SQL
   my $sqlq= "insert into interesting_interfaces ".
             "(datetime_created, datetime_last_update, device, interface_id, interface, auto_interesting) ".
             "values (now(), now(),?,?,?,?) ".
             "on duplicate key update datetime_last_update = now(), interface_id = ?,  ".
             "auto_interesting=?";

   my $insert = $dbh->prepare($sqlq);
 
   $insert->execute($dev,$num,$name,$auto,$num,$auto);
   if ($insert->errstr ne '')
   {
      print "$dev,$name - ($dev,$num,$name,$auto,$num,$auto) caused the following error:\n";
      print $insert->errstr."\n"
   }
   else {  print "$dev,$name - ($dev,$num,$name,$auto,$num,$auto) successful:\n"; }

Initial URL

                                

Initial Description

                                

Initial Title
Prepare sql in advance

Initial Tags
mysql

Initial Language
SQL