/** * @param Delete $delete * * @return string */ public function write(Delete $delete) { $table = $this->writer->writeTable($delete->getTable()); $parts = array("DELETE FROM {$table}"); AbstractBaseWriter::writeWhereCondition($delete, $this->writer, $this->placeholderWriter, $parts); AbstractBaseWriter::writeLimitCondition($delete, $this->placeholderWriter, $parts); $comment = AbstractBaseWriter::writeQueryComment($delete); return $comment . implode(" ", $parts); }
/** * @param Insert $insert * * @throws QueryException * * @return string */ public function write(Insert $insert) { $columns = $insert->getColumns(); if (empty($columns)) { throw new QueryException('No columns were defined for the current schema.'); } $columns = $this->writeQueryColumns($columns); $values = $this->writeQueryValues($insert->getValues()); $table = $this->writer->writeTable($insert->getTable()); $comment = AbstractBaseWriter::writeQueryComment($insert); return $comment . "INSERT INTO {$table} ({$columns}) VALUES ({$values})"; }
/** * @param Column $column * * @return string */ public function writeColumn(Column $column) { $alias = $column->getTable()->getAlias(); $table = $alias ? $this->writer->writeTableAlias($alias) : $this->writer->writeTable($column->getTable()); $columnString = empty($table) ? '' : "{$table}."; $columnString .= $this->writer->writeColumnName($column); return $columnString; }