We recently added a patch to disable full group by before some queries that were not
compliant with that standard. That patch broke the report pager because later code relied on the
last issued query ALWAYS being the one that determined how many rows are retrived by the main query,
however, we were doing a query to check sql mode after the main query.
I could make a case for storing sql mode data somewhere sensible at the start of the session.
However, I think this fix is the right fix for the bug as it calculates the rows retrieved
/ retrievable immediately after the retrieval query, rather than 'at some later date when
we hope no other queries have run'. If is in the same function as the enableFullGroupBy so
only reports that ALSO run that will hit the line (ie. not reports that override buildRows)
CRM_Core_DAO::disableFullGroupByMode();
}
$dao = CRM_Core_DAO::executeQuery($sql);
+ if (stristr($this->_select, 'SQL_CALC_FOUND_ROWS')) {
+ $this->_rowsFound = CRM_Core_DAO::singleValueQuery('SELECT FOUND_ROWS()');
+ }
CRM_Core_DAO::reenableFullGroupByMode();
if (!is_array($rows)) {
$rows = array();