Permalink
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...
1 parent 11b409a commit ced7d6db7a05e3a4e570b21b5f24b8f8fecedea8 @chillu chillu committed May 19, 2011
Showing with 4 additions and 0 deletions.
  1. +4 −0 model/SQLQuery.php
View
@@ -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;

0 comments on commit ced7d6d

Please sign in to comment.