Surprisingly this simple question is not well answered on the web, so here you are
RaiseError => 0,
PrintError => 0
Then when an error occurs during any DBI operation, you won't see any error on screen. When an error occurs, the appropriate error message will also be populated in $DBI::errstr. So you can use the following code to know whether an error has occurred:
if($DBI::errstr) {
# an error has occurred; do something here like print out the sql statement that has just been executed
So that you can do something without printing the generic error message. If you get a handle out of executing some operation, then you can also use that handle to detect an error:
$dbh = DBI->connect( "dbi:Oracle:archaeo", "username", "password", %attr);
if($dbh) {
### connect success!
} else {
### connect failed..
}
Hope it helps!
0 komentar:
Posting Komentar