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.

Reply via email to