You are here

function DB_mysql::mysqlRaiseError in Flickr API 5

Produces a DB_Error object regarding the current problem

DB_mysql::errorNative(), DB_common::errorCode()

Parameters

int $errno if the error is being manually raised pass a: DB_ERROR* constant here. If this isn't passed the error information gathered from the DBMS.

Return value

object the DB_Error object

See also

DB_common::raiseError(),

9 calls to DB_mysql::mysqlRaiseError()
DB_mysql::commit in phpFlickr/PEAR/DB/mysql.php
Commits the current transaction
DB_mysql::connect in phpFlickr/PEAR/DB/mysql.php
Connect to the database server, log in and open the database
DB_mysql::nextId in phpFlickr/PEAR/DB/mysql.php
Returns the next free id in a sequence
DB_mysql::numCols in phpFlickr/PEAR/DB/mysql.php
Gets the number of columns in a result set
DB_mysql::numRows in phpFlickr/PEAR/DB/mysql.php
Gets the number of rows in a result set

... See full list

File

phpFlickr/PEAR/DB/mysql.php, line 876

Class

DB_mysql
The methods PEAR DB uses to interact with PHP's mysql extension for interacting with MySQL databases

Code

function mysqlRaiseError($errno = null) {
  if ($errno === null) {
    if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
      $this->errorcode_map[1022] = DB_ERROR_CONSTRAINT;
      $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT_NOT_NULL;
      $this->errorcode_map[1062] = DB_ERROR_CONSTRAINT;
    }
    else {

      // Doing this in case mode changes during runtime.
      $this->errorcode_map[1022] = DB_ERROR_ALREADY_EXISTS;
      $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT;
      $this->errorcode_map[1062] = DB_ERROR_ALREADY_EXISTS;
    }
    $errno = $this
      ->errorCode(mysql_errno($this->connection));
  }
  return $this
    ->raiseError($errno, null, null, null, @mysql_errno($this->connection) . ' ** ' . @mysql_error($this->connection));
}