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

Bug #12920 add new error info and fix escape method if connection not exist
Submitted: 2008-01-17 08:43 UTC Modified: 2008-01-17 15:17 UTC
From: afz Assigned: quipo
Status: Closed Package: MDB2_Driver_pgsql
PHP Version: 5.2.5 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2008-01-17 08:43 UTC] afz (Ali Fazelzade)
Description: ------------ hi, 1. when we use createDatabase method then escape method return empty for charset because caonnection not exist. 2. add new error info MDB2_ERROR_ALREADY_EXISTS, for "* already exists", this error needed when we try createDatabase that already exist. path for both above bug:

Comments

 [2008-01-17 08:43 UTC] afz (Ali Fazelzade)
Index: pgsql.php =================================================================== RCS file: /repository/pear/MDB2/MDB2/Driver/pgsql.php,v retrieving revision 1.188 diff -u -r1.188 pgsql.php --- pgsql.php 11 Jan 2008 18:48:29 -0000 1.188 +++ pgsql.php 18 Jan 2008 13:31:41 -0000 @@ -119,6 +119,8 @@ $native_msg = 'Database connection has been lost.'; $error_code = MDB2_ERROR_CONNECT_FAILED; } + } else { + $native_msg = @pg_last_error(); } static $error_regexps; @@ -130,6 +132,8 @@ => MDB2_ERROR_NOSUCHTABLE, '/index .* does not exist/' => MDB2_ERROR_NOT_FOUND, + '/database .* already exists/i' + => MDB2_ERROR_ALREADY_EXISTS, '/relation .* already exists/i' => MDB2_ERROR_ALREADY_EXISTS, '/(divide|division) by zero$/i' @@ -202,7 +206,7 @@ if (PEAR::isError($connection)) { return $connection; } - if (version_compare(PHP_VERSION, '5.2.0RC5', '>=')) { + if (is_resource($connection) && version_compare(PHP_VERSION, '5.2.0RC5', '>=')) { $text = @pg_escape_string($connection, $text); } else { $text = @pg_escape_string($text); @@ -1467,4 +1471,4 @@ return $result; } } -?> \ No newline at end of file +?>
 [2008-01-17 15:17 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.