Issues

ZF-2231: Zend_Db_Table_Select does not utilise schema for find/fetch methods

Description

Reported by Luiz Vitor:-

I add the incubator library to my inclute path to start testing the Zend_Layout component. After I did this, all my fetchAll() calls stopped.

After digging a little in the code, I realized that Zend_Db_Table_Select::__toString() method was not adding the schema to the query construction.


Original code:
$fields  = $this->getPart(Zend_Db_Table_Select::COLUMNS);
$primary = $this->_info[Zend_Db_Table_Abstract::NAME];

// If no fields are specified we assume all fields from primary table 
if (!count($fields)) {
    $this->from($primary, '*');
    $fields = $this->getPart(Zend_Db_Table_Select::COLUMNS);
}

New code:
$fields  = $this->getPart(Zend_Db_Table_Select::COLUMNS); 
$primary = $this->_info[Zend_Db_Table_Abstract::NAME];
$schema  = $this->_info[Zend_Db_Table_Abstract::SCHEMA];

// If no fields are specified we assume all fields from primary table
if (!count($fields)) { 
    $this->from($primary, '*', $schema);
    $fields = $this->getPart(Zend_Db_Table_Select::COLUMNS);
}

Comments

Resolved in incubator (r6923)