MINOR Fixed the SQLQuery to return empty query in only certain cases

This commit is contained in:
Stig Lindqvist 2011-09-27 13:28:19 +13:00 committed by Stig Lindqvist
parent b6f88036eb
commit 73c249128b

View File

@ -458,10 +458,6 @@ class SQLQuery {
// TODO: Don't require this internal-state manipulate-and-preserve - let sqlQueryToString() handle the new syntax
$origFrom = $this->from;
if(!$this->from) {
return '';
}
// Build from clauses
foreach($this->from as $alias => $join) {
// $join can be something like this array structure
@ -476,10 +472,17 @@ class SQLQuery {
}
$sql = DB::getConn()->sqlQueryToString($this);
if($this->replacementsOld) $sql = str_replace($this->replacementsOld, $this->replacementsNew, $sql);
if($this->replacementsOld) {
$sql = str_replace($this->replacementsOld, $this->replacementsNew, $sql);
}
$this->from = $origFrom;
// The query was most likely just created and then exectued.
if($sql === 'SELECT *') {
return '';
}
return $sql;
}