Each database driver converts the error codes or error messages from the DBMS to a DB error code. These codes are represented as PHP constants. Here is a list of supported error codes given by examples of situations that causes them:
☞ DB_ERROR_ACCESS_VIOLATION. Missing privileges for a table, no read access
to file referenced by opaque parameters, or bad username or password.
☞ DB_ERROR_ALREADY_EXISTS. Table, sequence, procedure, view, trigger, or some
other condition already exists.
☞ DB_ERROR_CANNOT_CREATE. Cannot create table or file; the cause of problem
is outside the DBMS.
☞ DB_ERROR_CANNOT_DROP. Cannot drop table or delete file; the cause of problem
is outside the DBMS.
☞ DB_ERROR_CONNECT_FAILED. Could not establish database connection.
☞ DB_ERROR_CONSTRAINT. Foreign key does not exist, row contains foreign key
referenced by another table, and field constraints violated.
☞ DB_ERROR_CONSTRAINT_NOT_NULL. Field may not be NULL.
☞ DB_ERROR_DIVZERO. Division by zero error.
☞ DB_ERROR_INVALID. Catch-all "invalid input" error.
☞ DB_ERROR_INVALID_DATE. Bad date format or nonsensical date.
☞ DB_ERROR_INVALID_NUMBER. Trying to use a non-number in a number field.
☞ DB_ERROR_MISMATCH. Number of parameters do not match up (also prepare/
execute).
☞ DB_ERROR_NODBSELECTED. Database connection has no database selected.
☞ DB_ERROR_NOSUCHDB. Trying to access a non-existing database.
☞ DB_ERROR_NOSUCHFIELD. Trying to query a non-existing column.
☞ DB_ERROR_NOSUCHTABLE. Trying to query a non-existing table.
☞ DB_ERROR_NOT_CAPABLE. Database back-end cannot do that.
☞ DB_ERROR_NOT_FOUND. Trying to drop a non-existing index.
☞ DB_ERROR_NOT_LOCKED. Trying to unlock something that is not locked.
☞ DB_ERROR_SYNTAX. SQL syntax error.
☞ DB_ERROR_TRUNCATED. Returned data was truncated.
☞ DB_ERROR_UNSUPPORTED. Performing an operation not supported by DB or
the DBMS client.
☞ DB_ERROR_VALUE_COUNT_ON_ROW. See DB_ERROR_MISMATCH.
- Kiran's blog
- 305 reads













Post new comment