zendframework / zf1

This project reached its end-of-life on 2016-09-28. Contains conversion of ZF1 subversion repo to git, from version 15234 forward, and only containing master and release-1.12 branches and 1.12 tags.
https://framework.zend.com/blog/2016-06-28-zf1-eol.html
BSD 3-Clause "New" or "Revised" License
357 stars 800 forks source link

CLONE - DB2 on i5 fails because of table and column names quoting #29

Open zfbot opened 11 years ago

zfbot commented 11 years ago

Jira Information

Original Issue:ZF-12458
Issue Type:Bug
Reporter:Stephen McMahon
Created:10/30/12
Assignee:Ralph Schindler
Components:Zend_Db_Adapter_Db2

Description

The following script was used:

echo 'Version:- '.Zend_Version::VERSION.'<br /><br />';

$stmt = $db->select()->from('psvf.STOCK')->where( 'VIN = ?' , 'ZZZ');

var_dump($stmt->__toString());

echo '<br />';

$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);
zfbot commented 11 years ago

(Originally posted by: Stephen McMahon on 10/30/12)

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

zfbot commented 11 years ago

(Originally posted by: Stephen McMahon on 10/30/12)

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.

zfbot commented 11 years ago

This issue was ported from the ZF2 Jira Issue Tracker at http://framework.zend.com/issues/browse/ZF-12458

Known GitHub users mentioned in the original message or comment: