Re: DB_ERROR constants update
| From: | Analysis & Solutions | Date: | Mon, 21 Oct 2002 05:29:22 +0000 |
| Subject: | Re: DB_ERROR constants update | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-10163@lists.php.net to get a copy of this message | ||
On Sun, Oct 20, 2002 at 03:11:45PM +0200, Martin Jansen wrote:
>
> IMO this is a pretty cool thing. Dan: Just go ahead with your patch.
Okay. Here are the first two rounds. They work on DB.php, version 1.14.
First one adds the new constants. Second one is an unrelated set of
changing double quoted strings to single quoted strings for a minor
efficiency upgrade.
I'll send along the update to mysql.php later. I'm tired and want to make
sure everything is straight, so now's not a good time to do it.
Enjoy,
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
--- DB.1.14.php 2002-10-21 00:07:54.000000000 -0400 +++ DB.new.constants.php 2002-10-21 00:56:28.000000000 -0400 @@ -60,6 +60,11 @@ define("DB_ERROR_EXTENSION_NOT_FOUND",-25); define("DB_ERROR_ACCESS_VIOLATION", -26); define("DB_ERROR_NOSUCHDB", -27); +define('DB_ERROR_COMMUNICATION', -28); +define('DB_ERROR_CAPACITY_EXCEEDED', -29); +define('DB_ERROR_CANNOT_LOCK', -30); +define('DB_ERROR_LOCKED', -31); +define('DB_ERROR_CORRUPTION', -32); /* * Warnings are not detected as errors by DB::isError(), and are not @@ -394,7 +399,12 @@ DB_ERROR_NEED_MORE_DATA => 'insufficient data supplied', DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found', DB_ERROR_NOSUCHDB => 'no such database', - DB_ERROR_ACCESS_VIOLATION => 'insufficient permissions' + DB_ERROR_ACCESS_VIOLATION => 'insufficient permissions', + DB_ERROR_COMMUNICATION => 'communication problem', + DB_ERROR_CAPACITY_EXCEEDED => 'capacity exceeded', + DB_ERROR_CANNOT_LOCK => 'can not obtain lock', + DB_ERROR_LOCKED => 'already locked by other process', + DB_ERROR_CORRUPTION => 'corrupted resource' ); } --- DB.new.constants.php 2002-10-21 00:56:28.000000000 -0400 +++ DB.single.quotes.php 2002-10-21 00:54:52.000000000 -0400 @@ -22,7 +22,7 @@ // Database independent query interface. // -require_once "PEAR.php"; +require_once 'PEAR.php'; /* * The method mapErrorCode in each DB_dbtype implementation maps @@ -32,34 +32,34 @@ * version of it in DB::errorMessage(). */ -define("DB_OK", 1); -define("DB_ERROR", -1); -define("DB_ERROR_SYNTAX", -2); -define("DB_ERROR_CONSTRAINT", -3); -define("DB_ERROR_NOT_FOUND", -4); -define("DB_ERROR_ALREADY_EXISTS", -5); -define("DB_ERROR_UNSUPPORTED", -6); -define("DB_ERROR_MISMATCH", -7); -define("DB_ERROR_INVALID", -8); -define("DB_ERROR_NOT_CAPABLE", -9); -define("DB_ERROR_TRUNCATED", -10); -define("DB_ERROR_INVALID_NUMBER", -11); -define("DB_ERROR_INVALID_DATE", -12); -define("DB_ERROR_DIVZERO", -13); -define("DB_ERROR_NODBSELECTED", -14); -define("DB_ERROR_CANNOT_CREATE", -15); -define("DB_ERROR_CANNOT_DELETE", -16); -define("DB_ERROR_CANNOT_DROP", -17); -define("DB_ERROR_NOSUCHTABLE", -18); -define("DB_ERROR_NOSUCHFIELD", -19); -define("DB_ERROR_NEED_MORE_DATA", -20); -define("DB_ERROR_NOT_LOCKED", -21); -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_ACCESS_VIOLATION", -26); -define("DB_ERROR_NOSUCHDB", -27); +define('DB_OK', 1); +define('DB_ERROR', -1); +define('DB_ERROR_SYNTAX', -2); +define('DB_ERROR_CONSTRAINT', -3); +define('DB_ERROR_NOT_FOUND', -4); +define('DB_ERROR_ALREADY_EXISTS', -5); +define('DB_ERROR_UNSUPPORTED', -6); +define('DB_ERROR_MISMATCH', -7); +define('DB_ERROR_INVALID', -8); +define('DB_ERROR_NOT_CAPABLE', -9); +define('DB_ERROR_TRUNCATED', -10); +define('DB_ERROR_INVALID_NUMBER', -11); +define('DB_ERROR_INVALID_DATE', -12); +define('DB_ERROR_DIVZERO', -13); +define('DB_ERROR_NODBSELECTED', -14); +define('DB_ERROR_CANNOT_CREATE', -15); +define('DB_ERROR_CANNOT_DELETE', -16); +define('DB_ERROR_CANNOT_DROP', -17); +define('DB_ERROR_NOSUCHTABLE', -18); +define('DB_ERROR_NOSUCHFIELD', -19); +define('DB_ERROR_NEED_MORE_DATA', -20); +define('DB_ERROR_NOT_LOCKED', -21); +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_ACCESS_VIOLATION', -26); +define('DB_ERROR_NOSUCHDB', -27); define('DB_ERROR_COMMUNICATION', -28); define('DB_ERROR_CAPACITY_EXCEEDED', -29); define('DB_ERROR_CANNOT_LOCK', -30); @@ -255,10 +255,10 @@ } else { $dsninfo = DB::parseDSN($dsn); } - $type = $dsninfo["phptype"]; + $type = $dsninfo['phptype']; - if (is_array($options) && isset($options["debug"]) && - $options["debug"] >= 2) { + if (is_array($options) && isset($options['debug']) && + $options['debug'] >= 2) { // expose php errors with sufficient debug level include_once "DB/${type}.php"; } else {
--- DB.1.14.php 2002-10-21 00:07:54.000000000 -0400 +++ DB.new.constants.php 2002-10-21 00:56:28.000000000 -0400 @@ -60,6 +60,11 @@ define("DB_ERROR_EXTENSION_NOT_FOUND",-25); define("DB_ERROR_ACCESS_VIOLATION", -26); define("DB_ERROR_NOSUCHDB", -27); +define('DB_ERROR_COMMUNICATION', -28); +define('DB_ERROR_CAPACITY_EXCEEDED', -29); +define('DB_ERROR_CANNOT_LOCK', -30); +define('DB_ERROR_LOCKED', -31); +define('DB_ERROR_CORRUPTION', -32); /* * Warnings are not detected as errors by DB::isError(), and are not @@ -394,7 +399,12 @@ DB_ERROR_NEED_MORE_DATA => 'insufficient data supplied', DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found', DB_ERROR_NOSUCHDB => 'no such database', - DB_ERROR_ACCESS_VIOLATION => 'insufficient permissions' + DB_ERROR_ACCESS_VIOLATION => 'insufficient permissions', + DB_ERROR_COMMUNICATION => 'communication problem', + DB_ERROR_CAPACITY_EXCEEDED => 'capacity exceeded', + DB_ERROR_CANNOT_LOCK => 'can not obtain lock', + DB_ERROR_LOCKED => 'already locked by other process', + DB_ERROR_CORRUPTION => 'corrupted resource' ); } --- DB.new.constants.php 2002-10-21 00:56:28.000000000 -0400 +++ DB.single.quotes.php 2002-10-21 00:54:52.000000000 -0400 @@ -22,7 +22,7 @@ // Database independent query interface. // -require_once "PEAR.php"; +require_once 'PEAR.php'; /* * The method mapErrorCode in each DB_dbtype implementation maps @@ -32,34 +32,34 @@ * version of it in DB::errorMessage(). */ -define("DB_OK", 1); -define("DB_ERROR", -1); -define("DB_ERROR_SYNTAX", -2); -define("DB_ERROR_CONSTRAINT", -3); -define("DB_ERROR_NOT_FOUND", -4); -define("DB_ERROR_ALREADY_EXISTS", -5); -define("DB_ERROR_UNSUPPORTED", -6); -define("DB_ERROR_MISMATCH", -7); -define("DB_ERROR_INVALID", -8); -define("DB_ERROR_NOT_CAPABLE", -9); -define("DB_ERROR_TRUNCATED", -10); -define("DB_ERROR_INVALID_NUMBER", -11); -define("DB_ERROR_INVALID_DATE", -12); -define("DB_ERROR_DIVZERO", -13); -define("DB_ERROR_NODBSELECTED", -14); -define("DB_ERROR_CANNOT_CREATE", -15); -define("DB_ERROR_CANNOT_DELETE", -16); -define("DB_ERROR_CANNOT_DROP", -17); -define("DB_ERROR_NOSUCHTABLE", -18); -define("DB_ERROR_NOSUCHFIELD", -19); -define("DB_ERROR_NEED_MORE_DATA", -20); -define("DB_ERROR_NOT_LOCKED", -21); -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_ACCESS_VIOLATION", -26); -define("DB_ERROR_NOSUCHDB", -27); +define('DB_OK', 1); +define('DB_ERROR', -1); +define('DB_ERROR_SYNTAX', -2); +define('DB_ERROR_CONSTRAINT', -3); +define('DB_ERROR_NOT_FOUND', -4); +define('DB_ERROR_ALREADY_EXISTS', -5); +define('DB_ERROR_UNSUPPORTED', -6); +define('DB_ERROR_MISMATCH', -7); +define('DB_ERROR_INVALID', -8); +define('DB_ERROR_NOT_CAPABLE', -9); +define('DB_ERROR_TRUNCATED', -10); +define('DB_ERROR_INVALID_NUMBER', -11); +define('DB_ERROR_INVALID_DATE', -12); +define('DB_ERROR_DIVZERO', -13); +define('DB_ERROR_NODBSELECTED', -14); +define('DB_ERROR_CANNOT_CREATE', -15); +define('DB_ERROR_CANNOT_DELETE', -16); +define('DB_ERROR_CANNOT_DROP', -17); +define('DB_ERROR_NOSUCHTABLE', -18); +define('DB_ERROR_NOSUCHFIELD', -19); +define('DB_ERROR_NEED_MORE_DATA', -20); +define('DB_ERROR_NOT_LOCKED', -21); +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_ACCESS_VIOLATION', -26); +define('DB_ERROR_NOSUCHDB', -27); define('DB_ERROR_COMMUNICATION', -28); define('DB_ERROR_CAPACITY_EXCEEDED', -29); define('DB_ERROR_CANNOT_LOCK', -30); @@ -255,10 +255,10 @@ } else { $dsninfo = DB::parseDSN($dsn); } - $type = $dsninfo["phptype"]; + $type = $dsninfo['phptype']; - if (is_array($options) && isset($options["debug"]) && - $options["debug"] >= 2) { + if (is_array($options) && isset($options['debug']) && + $options['debug'] >= 2) { // expose php errors with sufficient debug level include_once "DB/${type}.php"; } else {