You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public function count_all()
{
// remembering select columns
...
$this->_build(Database::SELECT);
...
// Add back in selected columns
$this->_db_pending += $selects;
$this->reset();
// Return the total number of records in a table
return (int) $records;
}
$this->reset(); looks wrong:
we are counting not all records in the table, but those matching the conditions set earlier,
eg. if we have 100 records in total, but only 55 of them do have ref_id = 55 then following code will return 55
Hi,
original code of ORM::count_all() looks as:
$this->reset(); looks wrong:
we are counting not all records in the table, but those matching the conditions set earlier,
eg. if we have 100 records in total, but only 55 of them do have ref_id = 55 then following code will return 55
so why do we reset builder entirely? Should not we do
$this->reset(FALSE);
instead?thanks
The text was updated successfully, but these errors were encountered: