ZF-12458: CLONE - DB2 on i5 fails because of table and column names quoting

Description

The following script was used:


echo 'Version:- '.Zend_Version::VERSION.'

'; $stmt = $db->select()->from('psvf.STOCK')->where( 'VIN = ?' , 'ZZZ'); var_dump($stmt->__toString()); echo '
'; $test = $db->fetchAll($stmt,2);

It fails with the following result:


Version:- 1.11.10

string(73) "SELECT "HYOLABR".* FROM "psvf"."HYOLABR" AS "HYOLABR" WHERE (VIN = 'ZZZ')" 

Fatal error: Uncaught exception 'Zend_Db_Statement_Db2_Exception' with message 'HYOLABR in "psvf" type *FILE not found. SQLCODE=-204' in /usr/local/zendsvr/share/ZendFramework/library/Zend/Db/Statement/Db2.php:69 Stack trace: #0 /usr/local/zendsvr/share/ZendFramework/library/Zend/Db/Statement.php(115): Zend_Db_Statement_Db2->_prepare('SELECT "HYOLABR...') #1 /usr/local/zendsvr/share/ZendFramework/library/Zend/Db/Adapter/Db2.php(238): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Db2), 'SELECT "HYOLABR...') #2 /usr/local/zendsvr/share/ZendFramework/library/Zend/Db/Adapter/Abstract.php(478): Zend_Db_Adapter_Db2->prepare('SELECT "HYOLABR...') #3 /usr/local/zendsvr/share/ZendFramework/library/Zend/Db/Adapter/Abstract.php(736): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Select), 2) #4 /www/zendsvr/htdocs/PSIwarranty/zendtest.php(24): Zend_Db_Adapter_Abstract->fetchAll(Object(Zend_Db_Select), 2) #5 {main} thrown in /usr/local/zendsvr/share/ZendFramework/library/Zend/Db/Statement/Db2.php on line 69

The following script works OK:


$stmt = "select * from psvf.STOCK where VIN = 'ZZZ'";

$prepare = $db->query($stmt);

$result = $db->fetchAll($stmt);

Comments

This error appears to be related to ZF-3011 but not quite the same. Happens with ZendServer CE running on iSeries

Setting Zend_Db::AUTO_QUOTE_IDENTIFIERS => false fixes issue, seems likely that DB2 doesn't like aggressive quoting of tables. Maybe extend the DB2 class to overwrite to false.

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf1/issues/29