Skip to content

Instantly share code, notes, and snippets.

@alexdioso
Created September 18, 2011 19:42
Show Gist options
  • Save alexdioso/1225466 to your computer and use it in GitHub Desktop.
Save alexdioso/1225466 to your computer and use it in GitHub Desktop.
Perl eval db error
my $dbh = DBI->connect(
'dbi:Pg:dbname=DATABASE_NAME',
q{},
q{},
{
RaiseError => 1,
AutoCommit => 0,
PrintError => 0,
ShowErrorStatement => 1
}
);
eval {
$sth->execute;
1;
} or do {
$dbh->rollback;
confess "Insert failed.\n";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment