php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53909 PDOException needs info about PDO object or driver that triggered exception.
Submitted: 2011-02-02 14:22 UTC Modified: -
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: cmanley at xs4all dot nl Assigned:
Status: Open Package: PDO related
PHP Version: 5.3.5 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-02-02 14:22 UTC] cmanley at xs4all dot nl
Description:
------------
Please add a getPDODriver() and a getPDOObject() method to PDOException.

I want to create a custom subclass of PDOException that handles duplicate key violations and has an accessor method to get the offending field(s).

To do this, I need to parse the database driver specific error message for the field names. This can only be done if PDOException knows which database driver is being used. Unfortunately it does not know this.

I can imagine more scenarios where PDOException needs information about the PDO object or driver (in case PDO object couldn't even be instantiated) that triggered it.



Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Dec 12 17:01:24 2019 UTC