本文整理汇总了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;
}