Beispiel #1
0
 /**
  * Render a Insert object
  * @param  Query\Insert $query
  * @return string
  */
 public static function render(Query\Insert $query)
 {
     return Compiler::withDb($query->getDb(), function () use($query) {
         $table = $query->getTable();
         $select = $query->getSelect();
         return Compiler::expression(array('INSERT', $query->getType(), Compiler::word('INTO', $table !== null ? Aliased::render($table) : null), Columns::render($query->getColumns()), Compiler::word('VALUES', Values::combine($query->getValues())), Compiler::word('SET', Set::combine($query->getSet())), $select !== null ? Select::render($select) : null));
     });
 }
Beispiel #2
0
 /**
  * @dataProvider dataRender
  * @covers Harp\Query\Compiler\Values::render
  */
 public function testRender($values, $expected)
 {
     $values = new SQL\Values($values);
     $this->assertEquals($expected, Compiler\Values::render($values));
 }