Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Return empty string from SQLQuery->sql() if SELECT is the defau…

…lt value, and no FROM is set (moved logic from DB-specific implementations)
  • Loading branch information...
commit 1704e42d5188cd4a2940250e12d1374d70ba6169 1 parent 01f5b3d
@chillu chillu authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 core/model/SQLQuery.php
View
4 core/model/SQLQuery.php
@@ -378,6 +378,10 @@ function getFilter() {
* @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;
Please sign in to comment.
Something went wrong with that request. Please try again.