]> granicus.if.org Git - php/commitdiff
- added support for different error messages for the following cases:
authorJan Lehnardt <jan@php.net>
Tue, 12 Feb 2002 18:29:27 +0000 (18:29 +0000)
committerJan Lehnardt <jan@php.net>
Tue, 12 Feb 2002 18:29:27 +0000 (18:29 +0000)
 -
 - 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.

pear/DB.php

index cd89cf75d060a96217a7a1ad73d1dbc0a1acdc45..86125a2b60b253a72223fa52be4abbf3a7d10c01 100644 (file)
@@ -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'                
             );
         }