class DatabaseException extends Exception (View source)

Error class for database exceptions

Properties

protected string $sql

The SQL that generated this error

protected array $parameters

The parameters given for this query, if any

Methods

public
string
getSQL()

Returns the SQL that generated this error

public
array
getParameters()

The parameters given for this query, if any

public
__construct(string $message = '', int $code = 0, Exception $previous = null, string $sql = null, array $parameters = [])

Constructs the database exception

Details

string getSQL()

Returns the SQL that generated this error

Return Value

string

array getParameters()

The parameters given for this query, if any

Return Value

array

__construct(string $message = '', int $code = 0, Exception $previous = null, string $sql = null, array $parameters = [])

Constructs the database exception

Parameters

string $message

The Exception message to throw.

int $code

The Exception code.

Exception $previous

The previous exception used for the exception chaining.

string $sql

The SQL executed for this query

array $parameters

The parameters given for this query, if any