That's how it originally worked. There were reasons that it changed. -Matt
On Tue, Nov 18, 2008 at 11:26 PM, Iulian M <[EMAIL PROTECTED]> wrote: > > > Yes, but it should be noted that it will not accept ANY Zend_Db_Select > object. The object passed to the setRowCount() must contain the > ROW_COUNT_COLUMN = 'zend_paginator_row_count', or else it will throw an > exception. > > In my opinion count function, that actually performs the count operation, > should wrap the Zend_Db_Select object that is passed to the > Zend_Paginator_Adapter_DbSelect with a select statement like : > > "SELECT count(*) as count from ( ...pased select) as select; " > > > > > > Matthew Ratzloff wrote: > > > > I just want to be clear that setRowCount() accepts either an integer or > > Zend_Db_Select object for the TOTAL row count. > > -Matt > > > > On Tue, Nov 18, 2008 at 12:06 PM, Iulian M <[EMAIL PROTECTED]> > > wrote: > > > >> > >> > >> > >> Thank you for your answer. > >> > >> I will consider the situation in which i will pass the calculated > >> rowCount. > >> > >> > >> Iulian > >> > >> > >> Matthew Ratzloff wrote: > >> > > >> > The easiest way to solve this is to pass in your own Zend_Db_Select > >> COUNT > >> > query to Zend_Paginator_Adapter_DbSelect::setRowCount(). > >> > > >> > http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Paginator/Adapter/DbSelect.php > >> > > >> > Hope that helps, > >> > > >> > -Matt > >> > > >> > On Tue, Nov 18, 2008 at 7:32 AM, Iulian M <[EMAIL PROTECTED]> > >> wrote: > >> > > >> >> > >> >> I am creating a Zend_Db_Select statement for this SQL : > >> >> SELECT table1.a AS a > >> >> table1.b AS b > >> >> COUNT(table2.a) -1 as c > >> >> FROM table1 > >> >> INNER JOIN table2 ON table1.a = table2.a > >> >> HAVING c = 1 > >> >> > >> >> The select is tested and it worked as expected. > >> >> > >> >> The Zend_Db_Select will be used to paginate the result using > >> >> Zend_Paginator_Adapter_DbSelect. > >> >> > >> >> > >> >> Problem: > >> >> When Zend_Paginator_Adapter_DbSelect::count() method is executed, to > >> >> determine the total number of rows that the select will return, an > >> error > >> >> will be thrown: > >> >> > >> >> [message:protected] => SQLSTATE[42S22]: Column not found: 1054 > Unknown > >> >> column 'c' in 'having clause' > >> >> > >> >> This is caused by Zend_Db_Select::setRowCount() that creates an > >> special > >> >> select based on the select defined in > Zend_Paginator_Adapter_DbSelect. > >> >> setRowCount() alters the columns that will be used to run the select > >> and > >> >> when the fetch is issued the above error will be thrown. > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> -- > >> >> View this message in context: > >> >> > >> > http://www.nabble.com/-Zend_Paginator--Bug-when-using-complex-Zend_Db_Select-tp20561842p20561842.html > >> >> Sent from the Zend Framework mailing list archive at Nabble.com. > >> >> > >> >> > >> > > >> > > >> > >> -- > >> View this message in context: > >> > http://www.nabble.com/-Zend_Paginator--Bug-when-using-complex-Zend_Db_Select-tp20561842p20567204.html > >> Sent from the Zend Framework mailing list archive at Nabble.com. > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/-Zend_Paginator--Bug-when-using-complex-Zend_Db_Select-tp20561842p20574556.html > Sent from the Zend Framework mailing list archive at Nabble.com. > >