|
|
|
@ -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. |
|
|
|
|