build() 공개 정적인 메소드

public static build ( Expression[] $component, array $options = [] ) : string
$component Expression[] The component to be built.
$options array Parameters for building.
리턴 string
예제 #1
0
 /**
  * @return string
  */
 public function build()
 {
     $ret = 'DELETE ' . OptionsArray::build($this->options);
     if ($this->columns != NULL && count($this->columns) > 0) {
         $ret .= ' ' . ExpressionArray::build($this->columns);
     }
     if ($this->from != NULL && count($this->from) > 0) {
         $ret .= ' FROM ' . ExpressionArray::build($this->from);
     }
     if ($this->using != NULL && count($this->using) > 0) {
         $ret .= ' USING ' . ExpressionArray::build($this->using);
     }
     if ($this->where != NULL && count($this->where) > 0) {
         $ret .= ' WHERE ' . Condition::build($this->where);
     }
     if ($this->order != NULL && count($this->order) > 0) {
         $ret .= ' ORDER BY ' . ExpressionArray::build($this->order);
     }
     if ($this->limit != NULL && count($this->limit) > 0) {
         $ret .= ' LIMIT ' . Limit::build($this->limit);
     }
     return $ret;
 }
예제 #2
0
 /**
  * @param IntoKeyword $component The component to be built.
  * @param array       $options   Parameters for building.
  *
  * @return string
  */
 public static function build($component, array $options = array())
 {
     if ($component->dest instanceof Expression) {
         $columns = !empty($component->columns) ? '(`' . implode('`, `', $component->columns) . '`)' : '';
         return $component->dest . $columns;
     } elseif (isset($component->values)) {
         return ExpressionArray::build($component->values);
     } else {
         return 'OUTFILE "' . $component->dest . '"';
     }
 }