douchang6770 2012-05-14 03:27
浏览 24
已采纳

PDO驱动程序特定的错误代码

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'
)
  • 写回答

1条回答 默认 最新

  • 啊啊啊小孔 2012-05-14 03:42
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部