Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #10748 Failed connections don't return native error code
Submitted: 2007-04-16 18:21 UTC
From: urkle Assigned: quipo
Status: Closed Package: MDB2_Driver_mysqli (version 1.4.0)
PHP Version: 5.1.6 OS: Fedora Core 6 x86_64
Roadmaps: (Not assigned)    
Subscription  


 [2007-04-16 18:21 UTC] urkle (Edward Rudd)
Description: ------------ I have a connection DSN that connects to a mysql5 server, but the actually database that is being connected to does not exist. The Error object that I get back has no native error code and only has the MDB2_ERROR_CONNECT_FAILED MDB2 error code. This makes detecting the correct cause for the failed connect hard or impossible so my code can not "know" if it needs to attempt to create the database first. Also my error log gets filled with attempts to call mysqli_error and mysqli_errno with no arguments. The attached patch changes the mysqli.php driver to call mysqli_connect_error and mysqli_connect_errono in the errorInfo() method so that correct error codes will be fetched. Also the patch modifies the connect method to pass null as the first arg to raiseError() so that errorInfo() will re-map the native code to MDB2_ERROR_NOSUCHDB.

Comments

 [2007-04-17 15:54 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.