Issue Details (XML | Word | Printable)

Key: ZF-5970
Type: Performance Improvement Performance Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Trivial Trivial
Assignee: Satoru Yoshida
Reporter: Florent PELLET
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Optimize Zend_Db_Table::find();

Created: 09/Mar/09 03:49 AM   Updated: 20/May/09 09:41 PM   Resolved: 20/May/09 09:41 PM
Return to search "Fixed in 1.5.1"
Component/s: Zend_Db_Table
Affects Version/s: 1.7.6
Fix Version/s: 1.8.2

Time Tracking:
Not Specified


 Description  « Hide

Hi

Although $tableName don't change, it compute in every iteration.

Unable to find source-code formatter for language: php. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
$whereClause = null;
        if (count($whereList)) {
            $whereOrTerms = array();
            foreach ($whereList as $keyValueSets) {
                $whereAndTerms = array();
                foreach ($keyValueSets as $keyPosition => $keyValue) {
                    $type = $this->_metadata[$keyNames[$keyPosition]]['DATA_TYPE'];
                    $tableName = $this->_db->quoteTableAs($this->_name, null, true);
                    $columnName = $this->_db->quoteIdentifier($keyNames[$keyPosition], true);
                    $whereAndTerms[] = $this->_db->quoteInto(
                        $tableName . '.' . $columnName . ' = ?',
                        $keyValue, $type);
                }
                $whereOrTerms[] = '(' . implode(' AND ', $whereAndTerms) . ')';
            }
            $whereClause = '(' . implode(' OR ', $whereOrTerms) . ')';
        }

to

Unable to find source-code formatter for language: php. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
$whereClause = null;
        if (count($whereList)) {
            $whereOrTerms = array();
            $tableName = $this->_db->quoteTableAs($this->_name, null, true);
            foreach ($whereList as $keyValueSets) {
                $whereAndTerms = array();
                foreach ($keyValueSets as $keyPosition => $keyValue) {
                    $type = $this->_metadata[$keyNames[$keyPosition]]['DATA_TYPE'];
                    
                    $columnName = $this->_db->quoteIdentifier($keyNames[$keyPosition], true);
                    $whereAndTerms[] = $this->_db->quoteInto(
                        $tableName . '.' . $columnName . ' = ?',
                        $keyValue, $type);
                }
                $whereOrTerms[] = '(' . implode(' AND ', $whereAndTerms) . ')';
            }
            $whereClause = '(' . implode(' OR ', $whereOrTerms) . ')';
        }


Satoru Yoshida added a comment - 20/May/09 09:41 PM

Solved in SVN r15658