You are here

function DB_mysql::rollback in Flickr API 5

Reverts the current transaction

Return value

int DB_OK on success. A DB_Error object on failure.

Overrides DB_common::rollback

File

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

Class

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

Code

function rollback() {
  if ($this->transaction_opcount > 0) {
    if ($this->_db) {
      if (!@mysql_select_db($this->_db, $this->connection)) {
        return $this
          ->mysqlRaiseError(DB_ERROR_NODBSELECTED);
      }
    }
    $result = @mysql_query('ROLLBACK', $this->connection);
    $result = @mysql_query('SET AUTOCOMMIT=1', $this->connection);
    $this->transaction_opcount = 0;
    if (!$result) {
      return $this
        ->mysqlRaiseError();
    }
  }
  return DB_OK;
}