Пример #1
0
 public function build(Breakdown $bk, $tabs)
 {
     if (!$this->in) {
         $bk->append(" NOT");
     }
     $bk->append(" IN");
     $bk->append(" (");
     if ($this->values instanceof SQL) {
         $this->values->build($bk, $tabs);
     } else {
         $bk->append(explode(',', $this->values));
     }
     $bk->append(" )");
 }
Пример #2
0
 public function build(Breakdown $bk, $tabs)
 {
     if ($this->function != null) {
         $this->function->build($bk, $tabs);
     }
     if ($this->column !== null) {
         $bk->append(" " . $this->column);
     }
     if (count($this->values) > 1) {
         $bk->append(" (");
     }
     $doCommaValues = false;
     foreach ($this->values as $val) {
         /** @var Values $val */
         if ($doCommaValues) {
             $bk->append(",");
         } else {
             $doCommaValues = true;
         }
         $val->build($bk, $tabs);
     }
     if (count($this->values) > 1) {
         $bk->append(" )");
     }
     if ($this->fieldSql != null) {
         if ($this->fieldSql->hasType()) {
             //Don't put parenthesis when it is not a complex query like SELECT,INSERT.
             $bk->append(" (");
             //Non complex queries are just VALUES.. FUNCTIONS
         }
         $this->fieldSql->build($bk, $tabs);
         if ($this->fieldSql->hasType()) {
             $bk->append(" )");
         }
     }
     if ($this->condition != null) {
         $this->condition->build($bk, $tabs);
     }
     if ($this->case != null) {
         $this->case->build($bk, $tabs);
     }
     $bk->appendAs($this->as_());
 }