CakePHP获取原始SQL语句受影响的行数

3

我在我的CakePHP应用程序中有一个动作,通过模型中的一个方法运行简单的update语句,例如:

public function remove_nasties(){
    $query = 'UPDATE holdings 
    SET holdings.account_id = CONCAT(account_id, "n")
    WHERE holdings.nasty = 1 AND Right(holdings.account_id,1) != "n";';

    return $this->query($query);
}

查询运行正常,但我该如何获取受影响的行数?返回的仅是一个空数组。

1
(请始终提供您正在使用的框架版本) - Dave
2个回答


-2

如果您使用i18n,getAffectedRow()存在问题。

请尝试使用以下方法:

$this->params['paging']

而不是


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接