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 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程