/** * @test */ public function itShouldGetColumns() { $values = ['user_id' => 1, 'username' => 'nilportugues']; $this->query->setValues($values); $columns = $this->query->getColumns(); $this->assertInstanceOf('NilPortugues\\Sql\\QueryBuilder\\Syntax\\Column', $columns[0]); }
/** * @param Replace $replace * * @throws QueryException * * @return string */ public function write(Replace $replace) { $columns = $replace->getColumns(); if (empty($columns)) { throw new QueryException('No columns were defined for the current schema.'); } $columns = $this->writeQueryColumns($columns); $values = $this->writeQueryValues($replace->getValues()); $table = $this->writer->writeTable($replace->getTable()); $comment = AbstractBaseWriter::writeQueryComment($replace); return $comment . "REPLACE INTO {$table} ({$columns}) VALUES ({$values})"; }