Re: Catching errors with Perl DBI

2020-07-02 Thread Francisco Olarte
Stan: On Thu, Jul 2, 2020 at 5:03 PM stan wrote: > How can I catch the errors generated whne I call an INSERT that violates a > constraint? I have coded like this: > > my $sth = $dbh->prepare($stmt); > my $rv = $sth->execute() or die $DBI::errstr; >

Re: Catching errors with Perl DBI

2020-07-02 Thread Gianni Ceccarelli
On Thu, 2 Jul 2020 11:03:37 -0400 stan wrote: > my $sth = $dbh->prepare($stmt); > my $rv = $sth->execute() or die $DBI::errstr; that ``or die`` means: if the result of the ``execute`` is false (which only happens on error), throw an exception (which, as you noticed, terminates the process unless

Catching errors with Perl DBI

2020-07-02 Thread stan
How can I catch the errors generated whne I call an INSERT that violates a constraint? I have coded like this: my $sth = $dbh->prepare($stmt); my $rv = $sth->execute() or die $DBI::errstr; if ( $rv < 0 ) {