Hi,
just recently our team decided to upgrade our Zend Framework from 0.7.0 to
1.0.0 and there have been many changes; one part more troubling than others
- Zend_DB.
We use a database helper class to obtain Zend_Db objects:
$params = array( 'dbname' => _DATABASE,
'username' => _USER,
'password' => _PASSWORD,
'host' => _HOSTNAME,
'port' => _PORT,
'persistent'=> false );
$db = Zend_Db::factory( 'Db2', $params );
and retrieves Select object by:
function select () {
$db = Zend_Registry::get('DBConn');
return $db->select();
}
In the past, a piece of code was like this:
$select = database::select();
$select->from('users.users', '*');
$result = database::query($select);
return $result[0];
Now, I've changed it to
$select = database::select();
$select->from('USERS.USERS', '*');
$result = database::query($select);
and even tried
$select = database::select();
$select->from('USERS', '*', 'USERS');
$result = database::query($select);
or just
$select = database::select();
$select->from('USERS.USERS');
$result = database::query($select);
but it leads to an error (SQL0204N) saying that "USER" is an undefined name
- leading me to check the SQL being produced. The SQL statement that gets
run is:
SELECT "USERS".* FROM "USERS"."USERS"
Correct me if I'm wrong, but the bold part of the statement SELECT "USERS".*
FROM "USERS"."USERS" is invalid when selecting all columns in a query.
Digging a bit deeper in the code, it seems like the $correlationName in
__toString() in Zend/Db/Select.php seems to be 'USER' and adds it to '*'
there. I doubt this is a Zend_framework bug as it's such a simple db2 query
so I must be missing something here.
Thanks for any insights that could be provided!
--
View this message in context:
http://www.nabble.com/Incorrect-SQL-produced-using-Zend_DB-tf4096318s16154.html#a11647662
Sent from the Zend Framework mailing list archive at Nabble.com.