I used PDO::errorInfo
to fetch extended error information. This does return an array which includes Driver-specific error code.
On my mind, I am planning to get the specific returned driver error code ([1]
in array return)then associate it with my own custom error description. What matters me is that I can't seem to have a list of all the driver specific error codes on this. Any ideas?
MySQL version 5.5.21, InnoDB engine.
Sample of errorInfo()
returns:
Array
(
[0] => 23000
[1] => 1452
[2] => Cannot add or update a child row; a foreign key constraint fails...
)
Array
(
[0] => 23000
[1] => 1062
[2] => Duplicate entry 'Ovjsuy2' for key 'column_name'
)
By driver specific errors, they mean errors specific to the database you're using, like MySQL.
Go to the documentation for your specific database and look it up there.
For MySQL you can find it here: http://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html