From be60fcb11a4c91790b2417f62dcc7f8134f71283 Mon Sep 17 00:00:00 2001 From: Stig Bakken Date: Sun, 15 Oct 2000 02:22:25 +0000 Subject: [PATCH] PEAR DB: added DB_ERROR_NOT_LOCKED, gave DB_common::raiseError an optional "nativecode" parameter. --- pear/DB.php | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/pear/DB.php b/pear/DB.php index 37c1ed0b16..3a409e87dc 100644 --- a/pear/DB.php +++ b/pear/DB.php @@ -52,6 +52,7 @@ 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); /* @@ -242,25 +243,26 @@ class DB { function errorMessage($value) { if (!isset($errorMessages)) { $errorMessages = array( - DB_OK => "no error", DB_ERROR => "unknown error", - DB_ERROR_SYNTAX => "syntax error", - DB_ERROR_CONSTRAINT => "constraint violation", - DB_ERROR_NOT_FOUND => "not found", DB_ERROR_ALREADY_EXISTS => "already exists", - DB_ERROR_UNSUPPORTED => "not supported", - DB_ERROR_MISMATCH => "mismatch", - DB_ERROR_INVALID => "invalid", - DB_ERROR_NOT_CAPABLE => "DB backend not capable", - DB_ERROR_INVALID_NUMBER => "invalid number", - DB_ERROR_INVALID_DATE => "invalid date or time", - DB_ERROR_DIVZERO => "division by zero", - DB_ERROR_NODBSELECTED => "no database selected", DB_ERROR_CANNOT_CREATE => "can not create", DB_ERROR_CANNOT_DELETE => "can not delete", DB_ERROR_CANNOT_DROP => "can not drop", - DB_ERROR_NOSUCHTABLE => "no such table", + DB_ERROR_CONSTRAINT => "constraint violation", + DB_ERROR_DIVZERO => "division by zero", + DB_ERROR_INVALID => "invalid", + DB_ERROR_INVALID_DATE => "invalid date or time", + DB_ERROR_INVALID_NUMBER => "invalid number", + DB_ERROR_MISMATCH => "mismatch", + DB_ERROR_NODBSELECTED => "no database selected", DB_ERROR_NOSUCHFIELD => "no such field", + DB_ERROR_NOSUCHTABLE => "no such table", + DB_ERROR_NOT_CAPABLE => "DB backend not capable", + DB_ERROR_NOT_FOUND => "not found", + DB_ERROR_NOT_LOCKED => "not locked", + DB_ERROR_SYNTAX => "syntax error", + DB_ERROR_UNSUPPORTED => "not supported", + DB_OK => "no error", DB_WARNING => "unknown warning", DB_WARNING_READ_ONLY => "read only" ); @@ -359,7 +361,7 @@ class DB { $dsn = $arr[3]; } elseif (preg_match('|^([^:]+)@(.*)$|', $dsn, $arr)) { $parsed['username'] = $arr[1]; - $dsn = $arr[3]; + $dsn = $arr[2]; } if (preg_match('|^([^\+]+)\+(.*)$|', $dsn, $arr)) { @@ -449,14 +451,6 @@ class DB_result { } } -/* - * DB_Error TODO: - * - * - needs a way of storing queries (useful for debugging query syntax - * errors) - * - */ - /** * DB_Error implements a class for reporting portable database error * messages. -- 2.50.1