Permalink
Browse files

A bit of refactoring for clarity... Did I mention that all tests pass

for all implemented drivers? :)
  • Loading branch information...
lorenzo committed Jan 23, 2013
1 parent 01d4523 commit 86b579a96cc335e58f0920c1b9994bb7486b4309
Showing with 14 additions and 4 deletions.
  1. +14 −4 lib/Cake/Model/Datasource/Database/Query.php
@@ -116,10 +116,7 @@ public function sql() {
return $sql .= $this->{'_build' . ucFirst($name) . 'Part'}($parts, $sql);
};
// TODO: Should Query actually get the driver or just let the connection decide where
// to get the query translator?
$translator = $this->connection()->driver()->queryTranslator($this->_type);
$query = $translator($this);
$query = $this->_transformQuery();
$query->build($builder->bindTo($query));
return $sql;
}
@@ -472,6 +469,19 @@ protected function _bindParams($statement) {
$this->build($binder);
}
/**
* Returns a query object as returned by the connection object as a result of
* transforming this query instance to conform to any dialect specifics
*
* @return void
**/
protected function _transformQuery() {
// TODO: Should Query actually get the driver or just let the connection decide where
// to get the query translator?
$translator = $this->connection()->driver()->queryTranslator($this->_type);
return $translator($this);
}
/**
* Returns string representation of this query (complete SQL statement)
*

0 comments on commit 86b579a

Please sign in to comment.