PDOException クラス

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

はじめに

PDO が発するエラーを表します。あなた自身が書いたコードから PDOException をスローしてはいけません。 PHP の例外についての詳細な情報は、 例外 を参照ください。

クラス概要

class PDOException extends RuntimeException {
/* プロパティ */
protected int|string $code;
public ?array $errorInfo = null;
/* 継承したプロパティ */
protected string $message = "";
private string $string = "";
protected int $code;
protected string $file = "";
protected int $line;
private array $trace = [];
private ?Throwable $previous = null;
/* 継承したメソッド */
public Exception::__construct(string $message = "", int $code = 0, ?Throwable $previous = null)
final public Exception::getCode(): int
final public Exception::getFile(): string
final public Exception::getLine(): int
final public Exception::getTrace(): array
}

プロパティ

errorInfo

PDO::errorInfo() あるいは PDOStatement::errorInfo() に対応します。

code

SQLSTATE エラーコード。 Exception::getCode() でアクセスします。