* エラー処理 [#wbebf52a]
** エラー判定 [#g8eb3cea]
 $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) [#m36160ee]
 $dbh->{ShowErrorStatement} = 1;
 $dbh->{PrintError} = 1;

** 例外発生(RaiseError) [#b6ae6b8d]
 $dbh->{RaiseError} = 1;
 eval {
   $sth->execute(time); # ERR!
 };
 die "ERR: $@\n" if $@;


トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS