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

CakePHP获取原始SQL语句的受影响行,php,cakephp,cakephp-2.3,Php,Cakephp,Cakephp 2.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";'; r

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

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

模型方法:
getAffectedRows()


如果使用i18n,getAffectedRow()会出现问题

试用

$this->params['paging']

相反

(请始终提供您正在使用的框架版本)