Introducción
PHP Manual
PHP Manual»PDO»PDOException

La clase PDOException

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

Representa un error emitido por PDO. No debe lanzarse una excepción PDOException desde el propio código. Ver el capítulo sobre las excepciones para obtener más información sobre las excepciones en PHP.

class PDOException extends RuntimeException {
/* Propiedades */
protected int|string $code;
public ?array $errorInfo = null;
/* Propiedades heredadas */
protected string $message = "";
private string $string = "";
protected string $file = "";
protected int $line;
private array $trace = [];
private ?Throwable $previous = null;
/* Métodos heredados */
public function Exception::__construct(string $message = "", int $code = 0, ?Throwable $previous = null)
final public function Exception::getMessage(): string
final public function Exception::getPrevious(): ?Throwable
final public function Exception::getCode(): int
final public function Exception::getFile(): string
final public function Exception::getLine(): int
final public function Exception::getTrace(): array
final public function Exception::getTraceAsString(): string
public function Exception::__toString(): string
private function Exception::__clone(): void
}
errorInfo

Corresponde a PDO::errorInfo() o PDOStatement::errorInfo()

code

Código de error SQLSTATE. Utilice el método Exception::getCode() para acceder a él.

To Top