Skip to content

Commit c60987f

Browse files
committed
Added INSERT statement builder.
1 parent 7797423 commit c60987f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Statements/InsertStatement.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use SqlParser\Statement;
1212
use SqlParser\Components\IntoKeyword;
1313
use SqlParser\Components\Array2d;
14+
use SqlParser\Components\ArrayObj;
1415

1516
/**
1617
* `INSERT` statement.
@@ -76,7 +77,16 @@ class InsertStatement extends Statement
7677
/**
7778
* Values to be inserted.
7879
*
79-
* @var Array2d
80+
* @var ArrayObj[]
8081
*/
8182
public $values;
83+
84+
/**
85+
* @return string
86+
*/
87+
public function build() {
88+
return 'INSERT ' . $this->options
89+
. ' INTO ' . $this->into
90+
. ' VALUES ' . ArrayObj::build($this->values);
91+
}
8292
}

0 commit comments

Comments
 (0)