douchang6770 2012-05-14 11: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 11: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

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

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?