I have two issues in the Zend_Paginator_Adapter_DbSelect class :
1- The class checks if (!isset($result[self::ROW_COUNT_COLUMN])) then throw excpetion, why? some databases like MySQL when inner joining empty tables returns empty record set which makes the adapter fails. It should not throw exception just set the row count to zero is fair enough.
Example: SELECT COUNT(*) FROM ANY_EMPTY_TABLE GROUP BY TABLE_PRIMARY_KEY; // this will return empty record set
2- The class fetch the count by reseting Zend_Db_Select::COLUMNS, Zend_Db_Select::ORDER and Zend_Db_Select::LIMIT_OFFSET. Also should clear the Zend_Db_Select::GROUP, Because some databases or all! return a count of each group as a recordset. The count function mainly effected by the GROUP BY modifier.
Example: SELECT COUNT(*) from NONE_EMPTY_TABLE GROUP BY TABLE_PRIMARY_KEY; //a count for each pk group
For more information http://dev.mysql.com/doc/refman/…
Unfortunately, Removing the GROUP BY modifier in most cases will give invalid count of rows.
Benjamin Gonzales solution is PERFECT.
Between I HAVE NO COMMENT OPTION :( I only have (Edit, Convert, Vote, Worklog and Google) in the left nav, Its really wired positioning ;)
PS: There is no way to comment on the issue just editing it? :)