Permalink
Browse files

API CHANGE Rename SQLQuery prepareSelect to prepareWhere

  • Loading branch information...
halkyon committed May 1, 2012
1 parent 2784891 commit c84254c5b1deb89840e7ffa9d3937b2b27f430b0
Showing with 9 additions and 13 deletions.
  1. +1 −1 model/Database.php
  2. +8 −12 model/SQLQuery.php
View
@@ -732,7 +732,7 @@ public function sqlQueryToString(SQLQuery $sqlQuery) {
$text = "SELECT $distinct" . implode(", ", $sqlQuery->select);
}
if($sqlQuery->from) $text .= " FROM " . implode(" ", $sqlQuery->from);
- if($sqlQuery->where) $text .= " WHERE (" . $sqlQuery->prepareSelect(). ")";
+ if($sqlQuery->where) $text .= " WHERE (" . $sqlQuery->prepareWhere(). ")";
if($sqlQuery->groupby) $text .= " GROUP BY " . $sqlQuery->prepareGroupBy();
if($sqlQuery->having) $text .= " HAVING ( " .$sqlQuery->prepareHaving() . " )";
if($sqlQuery->orderby) $text .= " ORDER BY " . $sqlQuery->prepareOrderBy();
View
@@ -539,28 +539,26 @@ function replaceText($old, $new) {
}
public function getFilter() {
- Deprecation::notice('3.0', 'Please use prepareSelect() instead of getFilter()');
- return $this->prepareSelect();
+ Deprecation::notice('3.0', 'Please use prepareWhere() instead of getFilter()');
+ return $this->prepareWhere();
}
/**
- * Return an SQL WHERE clause to filter a SELECT query.
- *
+ * Returns the WHERE clauses ready for inserting into a query.
* @return string
*/
- public function prepareSelect() {
+ public function prepareWhere() {
return ($this->where) ? implode(") {$this->connective} (" , $this->where) : '';
}
/**
- * Returns the ORDER BY columns ready for inserting into a query
- *
+ * Returns the ORDER BY clauses ready for inserting into a query.
* @return string
*/
public function prepareOrderBy() {
$statments = array();
- if($order = $this->getOrderBy()) {
+ if($order = $this->getOrderBy()) {
foreach($order as $clause => $dir) {
$statements[] = trim($clause . ' '. $dir);
}
@@ -570,17 +568,15 @@ public function prepareOrderBy() {
}
/**
- * Returns the GROUP by columns ready for inserting into a query.
- *
+ * Returns the GROUP BY clauses ready for inserting into a query.
* @return string
*/
public function prepareGroupBy() {
return implode(", ", $this->groupby);
}
/**
- * Returns the HAVING columns ready for inserting into a query.
- *
+ * Returns the HAVING clauses ready for inserting into a query.
* @return string
*/
public function prepareHaving() {

0 comments on commit c84254c

Please sign in to comment.