| List: | MySQL and Perl | « Previous MessageNext Message » | |
| From: | Jochen Wiedmann | Date: | June 11 1999 9:41am |
| Subject: | Re: Trapping mSQL errors with Perl | ||
| View as plain text | |||
Joe Robuck wrote: > I'm trying to error trap mSQL errors in Perl with the following block of > code: > > $sql = "select * from table where field = value"; > eval{ > $sth = $dbh->prepare($sql); > $sth->execute; > }; > if ($@){ > print "Error"; > } > else{ > print "Success"; > } > } You need to set the RaiseError attribute when connecting, as in $dbh = DBI->connect("DBI:mSQL:test", undef, undef, {RaiseError => 1});
| Thread | ||
|---|---|---|
| • Trapping mSQL errors with Perl | Joe Robuck | 11 Jun |
| • Re: Trapping mSQL errors with Perl | Jochen Wiedmann | 11 Jun |
| • RE: Trapping mSQL errors with Perl | Joe Robuck | 11 Jun |
