Prepare sql in advance


/ Published in: SQL
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # --------------------------
  2. # PREPARE the SQL
  3. my $sqlq= "insert into interesting_interfaces ".
  4. "(datetime_created, datetime_last_update, device, interface_id, interface, auto_interesting) ".
  5. "values (now(), now(),?,?,?,?) ".
  6. "on duplicate key update datetime_last_update = now(), interface_id = ?, ".
  7. "auto_interesting=?";
  8.  
  9. my $insert = $dbh->PREPARE($sqlq);
  10.  
  11. $insert->EXECUTE($dev,$num,$name,$auto,$num,$auto);
  12. IF ($insert->errstr ne '')
  13. {
  14. print "$dev,$name - ($dev,$num,$name,$auto,$num,$auto) caused the following error:\n";
  15. print $insert->errstr."\n"
  16. }
  17. ELSE { print "$dev,$name - ($dev,$num,$name,$auto,$num,$auto) successful:\n"; }
  18.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.