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
01f5b3d212
commit
1704e42d51
@ -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