You are here

function DB_mysql::commit in Flickr API 5

Commits the current transaction

Return value

int DB_OK on success. A DB_Error object on failure.

Overrides DB_common::commit

File

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

Class

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

Code

function commit() {
  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('COMMIT', $this->connection);
    $result = @mysql_query('SET AUTOCOMMIT=1', $this->connection);
    $this->transaction_opcount = 0;
    if (!$result) {
      return $this
        ->mysqlRaiseError();
    }
  }
  return DB_OK;
}