ZF-4613: Passing a Zend_Db_Select Object to Zend_Paginator when using Oracle results in an Error
Description
When using Zend_Paginator in Conjunction with a Zend_Db_Select Object on Oracle, an E_NOTICE is raised in Zend_Paginator_Adapter_DbSelect.
Output:
Notice: Undefined index: zend_paginator_row_count in C:\Web\lib\Zend\Paginator\Adapter\DbSelect.php on line 107
This happens when the Adapter attempts to retrieve the ROW_COUNT_COLUMN from the result array. The column name is defined in lower case, however Oracles default behavior is to return all column names in upper case, unless you explicitly wrap the column alias name in double quotes.
Possible fixes for this might be: 1. In Zend_Paginator_Adapter_DbSelect change value declared for ROW_COUNT_COLUMN to an upper case string. 2. Check that the array key exists in lower case, and if not use the upper case equivalent on line 107 of Zend_Paginator_Adapter_DbSelect 3. Change line 165 to wrap the column name in quotes. This would then change from:
$expression = new Zend_Db_Expr($countPart . ' AS ' . self::ROW_COUNT_COLUMN);
to:
$expression = new Zend_Db_Expr($countPart . ' AS "' . self::ROW_COUNT_COLUMN . '"');
Comments
Posted by Matthew Ratzloff (mratzloff) on 2008-10-28T17:36:02.000+0000
The fix for this will be option 3, but it should use quoteIdentifier() instead in the interest of portability.
Posted by Mickael Perraud (mikaelkael) on 2008-10-30T14:31:27.000+0000
Need to retrieve Adapter from Zend_Db_Select object
Posted by Mickael Perraud (mikaelkael) on 2008-10-30T14:36:50.000+0000
Fixed in SVN12209
Posted by Matthew Ratzloff (mratzloff) on 2008-11-03T09:11:28.000+0000
This cannot be considered completely resolved until there is a corresponding unit test.
Posted by Mickael Perraud (mikaelkael) on 2008-11-04T13:05:08.000+0000
All Zend_Paginator_DbSelect and Zend_Paginator_DbTableSelect are written for Oracle (SVN12285)
Posted by Wil Sinclair (wil) on 2008-11-13T14:10:20.000+0000
Changing issues in preparation for the 1.7.0 release.