From 7b19512964d224e93d3a781122cdfc876b303a5d Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Tue, 2 Jul 2013 16:14:21 -0430 Subject: [PATCH] Reducing the number of calls to queryTranslator --- lib/Cake/Database/Query.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Database/Query.php b/lib/Cake/Database/Query.php index 279e7484df2..37bccaa89ae 100644 --- a/lib/Cake/Database/Query.php +++ b/lib/Cake/Database/Query.php @@ -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; }