Класс PDOException

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

Введение

Представляет ошибку, вызванную PDO. Вам не следует выбрасывать исключения PDOException из своего кода. Для дополнительной информации об исключениях в PHP смотрите раздел Исключения.

Обзор классов

classPDOExceptionextendsRuntimeException {
protectedint|string$code;
public?array$errorInfo = null;
protectedstring$message = "";
privatestring$string = "";
protectedint$code;
protectedstring$file = "";
protectedint$line;
privatearray$trace = [];
private?Throwable$previous = null;
publicException::__construct(string$message = "", int$code = 0, ?Throwable$previous = null)
finalpublicException::getCode(): int
finalpublicException::getLine(): int
}

Свойства

errorInfo

Соответствует PDO::errorInfo() или PDOStatement::errorInfo()

code

Код ошибки SQLSTATE. Чтобы его получить, используйте Exception::getCode().

To Top