ConstraintQueryException
extends QueryException
in package
Exception thrown when a database query fails due to an integrity constraint violation
These errors are reported as SQLSTATE 23xxx
Table of Contents
Properties
- $params : array<string|int, mixed>
- $query : string
- $state : string
- The SQLSTATE error code associated with the failed query.
- $key_name : string
- $key_value : string
Methods
- __construct() : mixed
- create() : static
- getKeyName() : string
- The name of the key that caused the constraint violation.
- getKeyValue() : string
- The key value that caused the constraint violation.
- setParams() : static
- setQuery() : static
- setState() : static
- getSubClass() : string
Properties
$params
public
array<string|int, mixed>
$params
= []
$query
public
string
$query
= ''
$state
The SQLSTATE error code associated with the failed query.
public
string
$state
= ''
See: https://en.wikipedia.org/wiki/SQLSTATE https://en.wikibooks.org/wiki/Structured_Query_Language/SQLSTATE https://dev.mysql.com/doc/refman/5.7/en/error-messages-server.html https://msdn.microsoft.com/en-us/library/ms714687.aspx
$key_name
protected
string
$key_name
= '(unknown)'
$key_value
protected
string
$key_value
= '(unknown)'
Methods
__construct()
public
__construct([string $message = '' ][, int $code = 0 ][, Throwable|null $previous = null ]) : mixed
Parameters
- $message : string = ''
- $code : int = 0
- $previous : Throwable|null = null
Tags
create()
public
static create(PDOException $exception) : static
Parameters
- $exception : PDOException
Return values
staticgetKeyName()
The name of the key that caused the constraint violation.
public
getKeyName() : string
Return values
stringgetKeyValue()
The key value that caused the constraint violation.
public
getKeyValue() : string
Return values
stringsetParams()
public
setParams(array<string|int, mixed> $params) : static
Parameters
- $params : array<string|int, mixed>
Return values
staticsetQuery()
public
setQuery(string $query) : static
Parameters
- $query : string
Return values
staticsetState()
public
setState(string|int $state) : static
Parameters
- $state : string|int
Return values
staticgetSubClass()
protected
static getSubClass(PDOException $exception) : string
Parameters
- $exception : PDOException
Return values
string —A subclass of QueryException