You are here

function DB_common::raiseError in Flickr API 5

Communicates an error and invoke error callbacks, etc

Basically a wrapper for PEAR::raiseError without the message string.

Parameters

mixed integer error code, or a PEAR error object (all: other parameters are ignored if this parameter is an object

int error mode, see PEAR_Error docs:

mixed if error mode is PEAR_ERROR_TRIGGER, this is the: error level (E_USER_NOTICE etc). If error mode is PEAR_ERROR_CALLBACK, this is the callback function, either as a function name, or as an array of an object and method name. For other error modes this parameter is ignored.

string extra debug information. Defaults to the last: query and native error code.

mixed native error code, integer or string depending the: backend

Return value

object the PEAR_Error object

Overrides PEAR::raiseError

See also

PEAR_Error

26 calls to DB_common::raiseError()
DB_common::affectedRows in phpFlickr/PEAR/DB/common.php
Determines the number of rows affected by a data maniuplation query
DB_common::autoCommit in phpFlickr/PEAR/DB/common.php
Enables or disables automatic commits
DB_common::buildManipSQL in phpFlickr/PEAR/DB/common.php
Produces an SQL query string for autoPrepare()
DB_common::commit in phpFlickr/PEAR/DB/common.php
Commits the current transaction
DB_common::createSequence in phpFlickr/PEAR/DB/common.php
Creates a new sequence

... See full list

File

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

Class

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

Code

function &raiseError($code = DB_ERROR, $mode = null, $options = null, $userinfo = null, $nativecode = null) {

  // The error is yet a DB error object
  if (is_object($code)) {

    // because we the static PEAR::raiseError, our global
    // handler should be used if it is set
    if ($mode === null && !empty($this->_default_error_mode)) {
      $mode = $this->_default_error_mode;
      $options = $this->_default_error_options;
    }
    $tmp = PEAR::raiseError($code, null, $mode, $options, null, null, true);
    return $tmp;
  }
  if ($userinfo === null) {
    $userinfo = $this->last_query;
  }
  if ($nativecode) {
    $userinfo .= ' [nativecode=' . trim($nativecode) . ']';
  }
  else {
    $userinfo .= ' [DB Error: ' . DB::errorMessage($code) . ']';
  }
  $tmp = PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'DB_Error', true);
  return $tmp;
}