mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Return empty string from SQLQuery->sql() if SELECT is the default value, and no FROM is set (moved logic from DB-specific implementations)
This commit is contained in:
parent
11b409aac8
commit
ced7d6db7a
@ -378,6 +378,10 @@ class SQLQuery {
|
||||
* @return string
|
||||
*/
|
||||
function sql() {
|
||||
// Don't process empty queries
|
||||
$select = is_array($this->select) ? $this->select[0] : $this->select;
|
||||
if($select == '*' && !$this->from) return '';
|
||||
|
||||
$sql = DB::getConn()->sqlQueryToString($this);
|
||||
if($this->replacementsOld) $sql = str_replace($this->replacementsOld, $this->replacementsNew, $sql);
|
||||
return $sql;
|
||||
|
Loading…
Reference in New Issue
Block a user