ZF-7259: problem method getCountSelect()
Description
i am find an problem using Zend_Paginator_Adapter_DbSelect, my object is used the WHERE and launched an exception
added to the method getCountSelect
$rowCount->reset(Zend_Db_Select::WHERE)
i am find an problem using Zend_Paginator_Adapter_DbSelect, my object is used the WHERE and launched an exception
added to the method getCountSelect
$rowCount->reset(Zend_Db_Select::WHERE)
Comments
Posted by Jurrien Stutterheim (norm2782) on 2009-07-14T12:23:34.000+0000
Could you give more information? What's the exception? What's your query? Could you try and reproduce this with the latest version from SVN?
Posted by Ramon Henrique Ornelas (ramon) on 2009-07-14T21:22:00.000+0000
exception launched Zend_Db_Statement_Exception,
i am with the latest version,
problem query generated by getCountSelect
query passed object select
SELECT d.id,number_document ,type_document ,date_publication ,link FROM "key_word" AS "kw" INNER JOIN "word_document" AS "wd" ON kw.id = wd.key_word_id INNER JOIN "document" AS "d" ON d.id = wd.document_id INNER JOIN "type_document" AS "td" ON td.id = d.type_document_id WHERE (wd.id IN( 48, 21, 56, 47 )) GROUP BY "d"."id", "number_document", "type_document", "date_publication", "link") AS "wd"
query generated
SELECT COUNT(1) AS "zend_paginator_row_count" FROM (SELECT d.id,number_document ,type_document ,date_publication ,link FROM "key_word" AS "kw" INNER JOIN "word_document" AS "wd" ON kw.id = wd.key_word_id INNER JOIN "document" AS "d" ON d.id = wd.document_id INNER JOIN "type_document" AS "td" ON td.id = d.type_document_id WHERE (wd.id IN( 48, 21, 56, 47 )) GROUP BY "d"."id", "number_document", "type_document", "date_publication", "link") AS "wd" WHERE (wd.id IN( 48, 21, 56, 47 ))
if this ($isDistinct && count($columnParts) > 1) || count($groupParts) > 1 || !empty($havingParts)
resolved added $rowCount->reset(Zend_Db_Select::WHERE)
Posted by Jurrien Stutterheim (norm2782) on 2009-07-14T21:29:05.000+0000
What is the exception message? What is the stack trace? Did you try and reproduce this with the latest version from SVN?
Posted by Ramon Henrique Ornelas (ramon) on 2009-07-15T12:29:26.000+0000
Message SQLSTATE[42703]: Undefined column: 7 ERROR: column wd.id does not exist LINE 9:"link") AS "wd" WHERE (wd.id IN( 48, 21, 56, 47 ))
tested with the latest version from SVN, version used 1.8.4
problem code generated SELECT COUNT(1) AS "zend_paginator_row_count" FROM ( SELECT id FROM test AS t WHERE test_id = 10 ) AS t WHERE test_id = 10
Note the last condition is duplicated, is necessary reset object select where.
the correct in my opine would
SELECT COUNT(1) AS "zend_paginator_row_count" FROM ( SELECT id FROM test AS t WHERE test_id = 10 ) AS t
Posted by Ramon Henrique Ornelas (ramon) on 2009-07-18T07:46:54.000+0000
sorry please, problem version used, with this if
if (($isDistinct && count($columnParts) > 1) || count($groupParts) > 1 || !empty($havingParts)) { $rowCount->reset(Zend_Db_Select::FROM);
}
in version of the svn, creates a new object Zend_Db_Select
if (($isDistinct && count($columnParts) > 1) || count($groupParts) > 1 || !empty($havingParts)) { $rowCount = $db->select()->from($this->_select); }
Posted by Jurrien Stutterheim (norm2782) on 2009-07-18T21:39:14.000+0000
Did that solve the problem?
Posted by Ramon Henrique Ornelas (ramon) on 2009-07-19T07:46:16.000+0000
resolved problem, version used was the problem
please, close issue
Posted by Jurrien Stutterheim (norm2782) on 2009-07-19T12:46:10.000+0000
Thanks : )