From: Jan Lehnardt Date: Tue, 12 Feb 2002 18:29:27 +0000 (+0000) Subject: - added support for different error messages for the following cases: X-Git-Tag: php-4.2.0RC1~360 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9869854d476896c800d14e8244f91fec9b6b0586;p=php - added support for different error messages for the following cases: - - if a user with unsufficient permissions trys to select a database - PEAR::DB previously threw a "no database selected" error instead - of a more proper "insufficient permissions". This is fixed now. - - if a user selects a nonexistant database PEAR::DB threw a - "no database selected" error instead of "no such database". - This is fixed as well. - - I added two new constants to DB.php and a simple case construct to - DB/mysql.php which can be easily extended to achive the above. I - hope this is ok. - Thanks to Till Gerken for mentioning this. --- diff --git a/pear/DB.php b/pear/DB.php index cd89cf75d0..86125a2b60 100644 --- a/pear/DB.php +++ b/pear/DB.php @@ -58,6 +58,8 @@ define("DB_ERROR_VALUE_COUNT_ON_ROW", -22); define("DB_ERROR_INVALID_DSN", -23); define("DB_ERROR_CONNECT_FAILED", -24); define("DB_ERROR_EXTENSION_NOT_FOUND",-25); +define("DB_ERROR_NOSUCHDB", -25); +define("DB_ERROR_ACCESS_VIOLATION", -26); /* * Warnings are not detected as errors by DB::isError(), and are not @@ -385,7 +387,9 @@ class DB DB_WARNING => 'unknown warning', DB_WARNING_READ_ONLY => 'read only', DB_ERROR_NEED_MORE_DATA => 'insufficient data supplied', - DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found' + DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found', + DB_ERROR_NOSUCHDB => 'no such database', + DB_ERROR_ACCESS_VIOLATION => 'insufficient permissions' ); }