ZF-5180: findParentRow with Zend_Db::CASE_LOWER

Description

When setting Zend_Db::CASE_FOLDING => Zend_Db::CASE_LOWER a call to getParentRow($table) fails with the following message


Exception information:

Message: Invalid bind-variable position '?'
Stack trace:

#0 /home/dev/ZendFramework-1.7.1-minimal/library/Zend/Db/Statement.php(108): Zend_Db_Statement->_parseParameters('SELECT z2.*?   ...')
#1 /home/dev/ZendFramework-1.7.1-minimal/library/Zend/Db/Adapter/Oracle.php(163): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Oracle), 'SELECT z2.*?   ...')
#2 /home/dev/ZendFramework-1.7.1-minimal/library/Zend/Db/Adapter/Abstract.php(429): Zend_Db_Adapter_Oracle->prepare('SELECT z2.*?   ...')
#3 /home/dev/ZendFramework-1.7.1-minimal/library/Zend/Db/Table/Abstract.php(1330): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select))
#4 /home/dev/ZendFramework-1.7.1-minimal/library/Zend/Db/Table/Abstract.php(1200): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Select))
#5 /home/dev/ZendFramework-1.7.1-minimal/library/Zend/Db/Table/Row/Abstract.php(954): Zend_Db_Table_Abstract->fetchRow(Object(Zend_Db_Table_Select))
#6 /home/dev/trunk/src/main/php/application/modules/admin/controllers/IndexController.php(20): Zend_Db_Table_Row_Abstract->findParentRow('Model_DbTable_E...', 'Details')
#7 /home/dev/ZendFramework-1.7.1-minimal/library/Zend/Controller/Action.php(503): Admin_IndexController->indexAction()
#8 /home/dev/ZendFramework-1.7.1-minimal/library/Zend/Controller/Dispatcher/Standard.php(285): Zend_Controller_Action->dispatch('indexAction')
#9 /home/dev/ZendFramework-1.7.1-minimal/library/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#10 /home/dev/trunk/src/main/php/public/index.php(49): Zend_Controller_Front->dispatch()
#11 {main}

This is because in Db/Table/Row/Abstract.php:937 the {{$dependentColumnName}} has been folded, but when it is used to reference {{$this->_data}} it fails because {{$this->_data}} represents the "physical names of columns in the table for which this row is defined", which are UPPERCASE in oracle.

Maybe I'm using foldCase wrong, but my intention is to have lowercase column and table names when using the oracle adapter.

Some more information...

When using db.adapter=Pdo_Oci with CASE_LOWER, I must set _name in my models to UPPERCASE, then I can access my columns with lowercase.

When using db.adapter=Oracle with CASE_LOWER, I must add {{$dependentColumnName = strToUpper($dependentColumnName);}} at line 938 in Zend/Db/Table/Row/Abstract.php and must still access my columns with UPPERCASE.

My conclusion is that it seems Pdo_Oci works OK with case folding, and Oracle is broken.

BTW, it'll be interesting to see if I'm allowed to comment on this issue if someone else does...

Comments

Zend_Db_Adapter_Oracle doesn't support case folding. Use the option autoQuoteIdentifier = false with this adapter. See http://framework.zend.com/manual/en/…

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.