本文整理匯總了PHP中DibiConnection::getAffectedRows方法的典型用法代碼示例。如果您正苦於以下問題:PHP DibiConnection::getAffectedRows方法的具體用法?PHP DibiConnection::getAffectedRows怎麽用?PHP DibiConnection::getAffectedRows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DibiConnection
的用法示例。
在下文中一共展示了DibiConnection::getAffectedRows方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}
示例2: execute
/**
* Generates and executes SQL query.
* @param mixed what to return?
* @return DibiResult|int result set object (if any)
* @throws DibiException
*/
public function execute($return = NULL)
{
$res = $this->query($this->_export());
switch ($return) {
case dibi::IDENTIFIER:
return $this->connection->getInsertId();
case dibi::AFFECTED_ROWS:
return $this->connection->getAffectedRows();
default:
return $res;
}
}
示例3: deleteBetweenField
public function deleteBetweenField($field, $left, $right)
{
$sql = 'DELETE FROM %n WHERE %n BETWEEN %i AND %i';
$this->dibi->query($sql, $this->table_name, $field, $left, $right);
return $this->dibi->getAffectedRows();
}
示例4: delete
/**
* @param int $id
* @return bool
*/
public function delete($id)
{
$this->database->delete(self::TABLE)->where(self::TABLE . '.id = %i', $id)->execute();
return $this->database->getAffectedRows() == 1;
}
示例5: invalidateToken
/**
* @inheritDoc
*/
function invalidateToken($token)
{
$this->dbConnection->query('DELETE FROM %n', $this->tableName, 'WHERE [token] = %s', $token);
return $this->dbConnection->getAffectedRows() > 0;
}