本文整理匯總了PHP中DibiConnection::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP DibiConnection::update方法的具體用法?PHP DibiConnection::update怎麽用?PHP DibiConnection::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DibiConnection
的用法示例。
在下文中一共展示了DibiConnection::update方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: save
/**
* @param array|\DibiRow $article
* @return bool
*/
public function save(&$article)
{
if (!isset($article['id'])) {
$this->database->insert(self::TABLE, $article)->execute();
$article['id'] = $this->database->getInsertId();
} else {
$this->database->update(self::TABLE, $article)->where(self::TABLE, '.id = %i', $article['id'])->execute();
}
return $this->database->getAffectedRows() == 1;
}
示例2: update
public function update($user)
{
try {
$this->database->update(self::TABLE_NAME, $user)->where(self::COLUMN_ID . " = ?", $user->id)->execute();
} catch (Nette\Database\DriverException $e) {
throw new \Nette\Database\DriverException();
}
}
示例3: createUpdateOne
public function createUpdateOne($table, $primaryColumn, $primaryValue, array $values)
{
$type = is_object($primaryValue) ? get_class($primaryValue) : gettype($primaryValue);
$query = new Query($this->connection->update($table, $values));
$query->fluent->where("%n = " . $query->getModificators()[$type], $primaryColumn, $primaryValue);
$query->resultCallback = function (Query $query) {
$query->fluent->execute();
return $this->connection->getAffectedRows() === 0 ? false : true;
};
return $query;
}
示例4: updateItem
/**
* @param object $instance
* @param ClassMetadata $entityAttributes
* @param string $originValueHash
* @return bool
*/
private function updateItem($instance, ClassMetadata $entityAttributes, $originValueHash)
{
if ($originValueHash == $this->getInstanceValuesHash($instance, $entityAttributes)) {
return FALSE;
}
if ($entityAttributes->hasBeforeUpdateEvent()) {
$instance->beforeUpdateEvent($this);
}
$values = $this->getInstanceValueMap($instance, $entityAttributes);
return $this->dibiConnection->update($entityAttributes->getTable(), $values)->where($this->buildPrimaryKey($instance, $entityAttributes))->execute(\dibi::AFFECTED_ROWS) == 1;
}
示例5: update
public function update($id, array $data)
{
return $this->connection->update($this->table, $data)->where('id=%i', $id)->execute();
}