in reply to Data format verification for insertion into a database
eval { local $dbh -> {RaiseError} = 1; local $dbh -> {PrintError} = 0; local $dbh -> {AutoCommit} = 0; my $sql = "INSERT INTO foo_table VALUES (?, ?)"; my $sth = $dbh -> prepare ($sql); $sth -> execute ($key, $date); }; if ($@) { # Some error occurred, for instance due to wrong dateformat. $dbh -> rollback; # Inspect $@ for error, take appropriate action. ... } else { $dbh -> commit; }
Abigail
|
|---|