protected function update() {
		if (!static::$_primaryKeys) {
			throw new RuntimeException('This table has no primary keys');
		}

		$column_values = array();
		foreach ($this->getModifiedColumns() as $column) {
			$column_values[$column] = $this->$column;
		}

		// If array is empty there is nothing to update
		if (empty($column_values)) {
			return 0;
		}

		$q = static::getQuery();

		foreach (static::$_primaryKeys as $pk) {
			if ($this->$pk === null) {
				throw new RuntimeException('Cannot update with NULL primary key.');
			}
			$q->add($pk, $this->$pk);
		}

		$row_count = $this->doUpdate($column_values, $q);
		$this->resetModified();
		return $row_count;
	}
protected function update() {
		if (!static::$_primaryKeys) {
			throw new RuntimeException('This table has no primary keys');
		}

		$column_values = array();
		foreach ($this->getModifiedColumns() as $column) {
			$column_values[$column] = $this->$column;
		}

		// If array is empty there is nothing to update
		if (empty($column_values)) {
			return 0;
		}

		$q = static::getQuery();

		foreach (static::$_primaryKeys as $pk) {
			if ($this->$pk === null) {
				throw new RuntimeException('Cannot update with NULL primary key.');
			}
			$q->add($pk, $this->$pk);
		}

		$row_count = $this->doUpdate($column_values, $q);
		$this->resetModified();
		return $row_count;
	}
protected function update ( ) { if ( ! static :: $ _primaryKeys ) { throw new RuntimeException ( 'This table has no primary keys' ) ; } $ column_values = array ( ) ; foreach ( $ this -> getModifiedColumns ( ) as $ column ) { $ column_values [ $ column ] = $ this -> $ column ; } // If array is empty there is nothing to update if ( empty ( $ column_values ) ) { return 0 ; } $ q = static :: getQuery ( ) ; foreach ( static :: $ _primaryKeys as $ pk ) { if ( $ this -> $ pk === null ) { throw new RuntimeException ( 'Cannot update with NULL primary key.' ) ; } $ q -> add ( $ pk , $ this -> $ pk ) ; } $ row_count = $ this -> doUpdate ( $ column_values , $ q ) ; $ this -> resetModified ( ) ; return $ row_count ; }
Creates and executes UPDATE query string for this object.  Returns
the number of affected rows.
@return Int
Creates and executes UPDATE query string for this object . Returns the number of affected rows .