build() public static method

public static build ( ArrayObj[] $component, array $options = [] ) : string
$component ArrayObj[] The component to be built.
$options array Parameters for building.
return string
Esempio n. 1
0
 public function testBuild()
 {
     $arrays = Array2d::parse(new Parser(), $this->getTokensList('(1, 2), (3, 4), (5, 6)'));
     $this->assertEquals('(1, 2), (3, 4), (5, 6)', Array2d::build($arrays));
 }
Esempio n. 2
0
 /**
  * @return string
  */
 public function build()
 {
     $ret = 'INSERT ' . $this->options . ' INTO ' . $this->into;
     if ($this->values != NULL && count($this->values) > 0) {
         $ret .= ' VALUES ' . Array2d::build($this->values);
     } elseif ($this->set != NULL && count($this->set) > 0) {
         $ret .= ' SET ' . SetOperation::build($this->set);
     } elseif ($this->select != NULL && count($this->select) > 0) {
         $ret .= ' ' . $this->select->build();
     }
     if ($this->onDuplicateSet != NULL && count($this->onDuplicateSet) > 0) {
         $ret .= ' ON DUPLICATE KEY UPDATE ' . SetOperation::build($this->onDuplicateSet);
     }
     return $ret;
 }
Esempio n. 3
0
 /**
  * @return string
  */
 public function build()
 {
     $ret = 'REPLACE ' . $this->options . ' INTO ' . $this->into;
     if ($this->values != NULL && count($this->values) > 0) {
         $ret .= ' VALUES ' . Array2d::build($this->values);
     } elseif ($this->set != NULL && count($this->set) > 0) {
         $ret .= ' SET ' . SetOperation::build($this->set);
     } elseif ($this->select != NULL && strlen($this->select) > 0) {
         $ret .= ' ' . $this->select->build();
     }
     return $ret;
 }