API CHANGE Rename SQLQuery prepareSelect to prepareWhere

This commit is contained in:
Sean Harvey 2012-05-01 12:04:11 +12:00
parent 2784891bd4
commit c84254c5b1
2 changed files with 9 additions and 13 deletions

View File

@ -732,7 +732,7 @@ abstract class SS_Database {
$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 File

@ -539,28 +539,26 @@ class SQLQuery {
}
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,8 +568,7 @@ class SQLQuery {
}
/**
* 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() {
@ -579,8 +576,7 @@ class SQLQuery {
}
/**
* 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() {