You are here

function DB_common::errorCode in Flickr API 5

Maps native error codes to DB's portable ones

Uses the <var>$errorcode_map</var> property defined in each driver.

Parameters

string|int $nativecode the error code returned by the DBMS:

Return value

int the portable DB error code. Return DB_ERROR if the current driver doesn't have a mapping for the $nativecode submitted.

1 call to DB_common::errorCode()
DB_mysql::mysqlRaiseError in phpFlickr/PEAR/DB/mysql.php
Produces a DB_Error object regarding the current problem
1 method overrides DB_common::errorCode()
DB_pgsql::errorCode in phpFlickr/PEAR/DB/pgsql.php
Determines PEAR::DB error code from the database's text error message.

File

phpFlickr/PEAR/DB/common.php, line 1879

Class

DB_common
DB_common is the base class from which each database driver class extends

Code

function errorCode($nativecode) {
  if (isset($this->errorcode_map[$nativecode])) {
    return $this->errorcode_map[$nativecode];
  }

  // Fall back to DB_ERROR if there was no mapping.
  return DB_ERROR;
}