/** * @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 Update $update * * @throws QueryException * @return string */ public function write(Update $update) { $values = $update->getValues(); if (empty($values)) { throw new QueryException('No values to update in Update query.'); } $parts = array("UPDATE " . $this->writer->writeTable($update->getTable()) . " SET ", $this->writeUpdateValues($update)); AbstractBaseWriter::writeWhereCondition($update, $this->writer, $this->placeholderWriter, $parts); AbstractBaseWriter::writeLimitCondition($update, $this->placeholderWriter, $parts); $comment = AbstractBaseWriter::writeQueryComment($update); return $comment . implode(" ", $parts); }