Created
September 18, 2011 19:54
-
-
Save alexdioso/1225484 to your computer and use it in GitHub Desktop.
Perl disable DBI HandleError
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $previous_handler = $dbh->{'HandleError'}; | |
$dbh->{'HandleError'} = undef; | |
eval { | |
$sth_insert->execute; | |
$dbh->{'HandleError'} = $previous_handler; | |
1; | |
} or do { | |
$dbh->rollback; | |
# Insert failed, try an update | |
# No check needed because HandleError was restored | |
$sth_update->execute; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment