CakePHP受到影响的原始SQL语句行

时间:2013-10-30 13:43:09

标签: php cakephp cakephp-2.3

我在CakePHP应用程序中有一个操作,它通过模型中的方法运行一个简单的更新语句,如下所示:

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);
}

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

2 个答案:

答案 0 :(得分:7)

答案 1 :(得分:-1)

如果您使用i18n

,则getAffectedRow()会出现问题

尝试使用

$this->params['paging']

代替

相关问题