lithium\data\source\Database::update()

public method

Updates a record in the database based on the given Query.

Parameters

  • object $query

    A lithium\data\model\Query object

  • array $options

    none

Returns

boolean

Filter

This method can be filtered.

Source

	public function update($query, array $options = array()) {
		return $this->_filter(__METHOD__, compact('query', 'options'), function($self, $params) {
			$query = $params['query'];
			$params = $query->export($self);
			$sql = $self->renderCommand('update', $params, $query);
			$result = (boolean) $self->invokeMethod('_execute', array($sql));

			if ($result && is_object($query) && $query->entity()) {
				$query->entity()->sync();
			}
			return $result;
		});
	}