Skip to content

Commit

Permalink
Reducing the number of calls to queryTranslator
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Jul 2, 2013
1 parent 5b6e5e3 commit 7b19512
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/Cake/Database/Query.php
Expand Up @@ -1528,14 +1528,15 @@ protected function _bindStatement($statement) {
* @return Query
*/
protected function _transformQuery() {
if (isset($this->_transformedQuery) && !$this->_dirty) {
if (!empty($this->_transformedQuery) && !$this->_dirty) {
return $this->_transformedQuery;
}
// TODO: Should Query actually get the driver or just let the connection decide where
// to get the query translator?
if ($this->_transformedQuery === false) {
return $this;
}
$translator = $this->connection()->driver()->queryTranslator($this->_type);
$transformed = $this->_transformedQuery = $translator($this);
$transformed->_dirty = false;
$transformed->_transformedQuery = $transformed->_dirty = false;
return $transformed;
}

Expand Down

0 comments on commit 7b19512

Please sign in to comment.