エラー処理エラー判定 $sth = $dbh->prepare('update t12 set num = 1 where num > 0');
if (!$sth->execute()){
print $sth->err,"\n"; #=> 7
print $sth->errstr,"\n"; #=> ERROR: relation "t12" does not exist
}
エラーメッセージ表示(PrintError) $dbh->{ShowErrorStatement} = 1;
$dbh->{PrintError} = 1;
例外発生(RaiseError) $dbh->{RaiseError} = 1;
eval {
$sth->execute(time); # ERR!
};
die "ERR: $@\n" if $@;
|
|