mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE Rename SQLQuery prepareSelect to prepareWhere
This commit is contained in:
parent
2784891bd4
commit
c84254c5b1
@ -732,7 +732,7 @@ abstract class SS_Database {
|
|||||||
$text = "SELECT $distinct" . implode(", ", $sqlQuery->select);
|
$text = "SELECT $distinct" . implode(", ", $sqlQuery->select);
|
||||||
}
|
}
|
||||||
if($sqlQuery->from) $text .= " FROM " . implode(" ", $sqlQuery->from);
|
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->groupby) $text .= " GROUP BY " . $sqlQuery->prepareGroupBy();
|
||||||
if($sqlQuery->having) $text .= " HAVING ( " .$sqlQuery->prepareHaving() . " )";
|
if($sqlQuery->having) $text .= " HAVING ( " .$sqlQuery->prepareHaving() . " )";
|
||||||
if($sqlQuery->orderby) $text .= " ORDER BY " . $sqlQuery->prepareOrderBy();
|
if($sqlQuery->orderby) $text .= " ORDER BY " . $sqlQuery->prepareOrderBy();
|
||||||
|
@ -539,28 +539,26 @@ class SQLQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getFilter() {
|
public function getFilter() {
|
||||||
Deprecation::notice('3.0', 'Please use prepareSelect() instead of getFilter()');
|
Deprecation::notice('3.0', 'Please use prepareWhere() instead of getFilter()');
|
||||||
return $this->prepareSelect();
|
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
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function prepareSelect() {
|
public function prepareWhere() {
|
||||||
return ($this->where) ? implode(") {$this->connective} (" , $this->where) : '';
|
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
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function prepareOrderBy() {
|
public function prepareOrderBy() {
|
||||||
$statments = array();
|
$statments = array();
|
||||||
|
|
||||||
if($order = $this->getOrderBy()) {
|
if($order = $this->getOrderBy()) {
|
||||||
foreach($order as $clause => $dir) {
|
foreach($order as $clause => $dir) {
|
||||||
$statements[] = trim($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
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function prepareGroupBy() {
|
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
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function prepareHaving() {
|
public function prepareHaving() {
|
||||||
|
Loading…
Reference in New Issue
Block a user