Исправление ошибки в SqlCriteria.count()
This commit is contained in:
@ -226,13 +226,12 @@ abstract class SqlModel extends Model
|
||||
return new SqlResultProvider($result);
|
||||
}
|
||||
|
||||
public function count($select = 'x', $distinct, $where,$heaving = null, $group_by = null, $sql_expression = null, $sql_expression_params = array(), $cache_key = null)
|
||||
public function count($where, $heaving = null, $group_by = null, $sql_expression = null, $sql_expression_params = array(), $cache_key = null)
|
||||
{
|
||||
$select = $this->db->selectExpr($select, $distinct);
|
||||
$where = $this->db->whereExpr($where);
|
||||
$group_by = $this->db->groupByExpr($group_by);
|
||||
$result = $this->query(
|
||||
'SELECT COUNT(*) as count FROM (' .
|
||||
'SELECT x.count FROM (' .
|
||||
(($sql_expression) ? $sql_expression : ('SELECT * FROM ' . $this->identify($this->table())))
|
||||
. (($where) ? (' WHERE ' . $where) : '')
|
||||
. (($group_by) ? (' GROUP BY ' . $group_by) : '') . ') AS x',
|
||||
|
Reference in New Issue
Block a user