You are here

function DB_storage::store in Flickr API 5

Stores changes to this object in the database.

Return value

DB_OK or a DB error

1 call to DB_storage::store()
DB_storage::_DB_storage in phpFlickr/PEAR/DB/storage.php
Destructor, calls DB_storage::store() if there are changes that are to be kept.

File

phpFlickr/PEAR/DB/storage.php, line 445

Class

DB_storage
Provides an object interface to a table row

Code

function store() {
  foreach ($this->_changes as $name => $foo) {
    $params[] =& $this->{$name};
    $vars[] = $name . ' = ?';
  }
  if ($vars) {
    $query = 'UPDATE ' . $this->_table . ' SET ' . implode(', ', $vars) . ' WHERE ' . $this
      ->_makeWhere();
    $stmt = $this->_dbh
      ->prepare($query);
    $res = $this->_dbh
      ->execute($stmt, $params);
    if (DB::isError($res)) {
      return $res;
    }
    $this->_changes = array();
  }
  return DB_OK;
}