@Override public String toString() { return (getComment() != null ? getComment() + " " : "") + getWholeTableName() + (alias != null ? " " + alias : ""); }
public void visit(Table aTable) { buffer.append(aTable.getComment() != null ? aTable.getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(aTable.getWholeTableName()); String alias = aTable.getAlias() != null ? aTable.getAlias().toString() : ""; if (alias != null && !alias.isEmpty()) { buffer.append(" ").append(alias);// it's very strange, but in fact oracle doesn't permit as key word if form clause // buffer.append(" as ").append(alias); } }
public void deParse(Truncate truncate) { buffer.append(truncate.getComment() != null ? truncate.getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("Truncate") .append(truncate.getCommentTable() != null ? " " + truncate.getCommentTable() + ExpressionDeParser.LINE_SEPARATOR : "").append(" Table ") .append(truncate.getTable().getComment() != null ? truncate.getTable().getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(truncate.getTable().getWholeTableName()); buffer.append(!"".equals(truncate.getEndComment()) ? " " + truncate.getEndComment() : ""); }
public void deParse(Delete aDelete) { buffer .append(aDelete.getComment() != null ? aDelete.getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "") .append("Delete").append(aDelete.getFromComment() != null ? " " + aDelete.getFromComment() + ExpressionDeParser.LINE_SEPARATOR : "").append(" From ") .append(aDelete.getTable().getComment() != null ? aDelete.getTable().getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(aDelete.getTable().getWholeTableName()); if (aDelete.getWhere() != null) { buffer.append(aDelete.getWhereComment() != null ? " " + aDelete.getWhereComment() : "").append(ExpressionDeParser.LINE_SEPARATOR).append(" Where "); aDelete.getWhere().accept(expressionVisitor); } buffer.append(!"".equals(aDelete.getEndComment()) ? " " + aDelete.getEndComment() : ""); }
public void deParse(Update aUpdate) { buffer.append(aUpdate.getComment() != null ? aUpdate.getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("Update ").append(ExpressionDeParser.LINE_SEPARATOR) .append(aUpdate.getTable().getComment() != null ? aUpdate.getTable().getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(aUpdate.getTable().getWholeTableName()).append(ExpressionDeParser.LINE_SEPARATOR) .append(aUpdate.getCommentSet() != null ? " " + aUpdate.getCommentSet() + ExpressionDeParser.LINE_SEPARATOR : "").append(" set "); int columnsCounter = 0; for (int i = 0, s = aUpdate.getColumns().size(); i < s; i++) { Column column = (Column) aUpdate.getColumns().get(i); buffer.append(column.getComment() != null ? column.getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(column.getWholeColumnName()) .append(!aUpdate.getCommentsEqaulas().get(i).toString().isEmpty() ? " " + aUpdate.getCommentsEqaulas().get(i) + ExpressionDeParser.LINE_SEPARATOR : "").append(" = "); Expression expression = (Expression) aUpdate.getExpressions().get(i); expression.accept(expressionVisitor); if (i < aUpdate.getColumns().size() - 1) { buffer.append(!aUpdate.getCommentsComma().get(i).toString().isEmpty() ? " " + aUpdate.getCommentsComma().get(i) + " " : ""); if (columnsCounter++ == 2) { columnsCounter = 0; buffer.append(ExpressionDeParser.LINE_SEPARATOR).append(", "); } else { buffer.append(", "); } } } if (aUpdate.getWhere() != null) { buffer.append(aUpdate.getCommentWhere() != null ? " " + aUpdate.getCommentWhere() : "") .append(ExpressionDeParser.LINE_SEPARATOR).append(" Where "); aUpdate.getWhere().accept(expressionVisitor); } buffer.append(!"".equals(aUpdate.getEndComment()) ? " " + aUpdate.getEndComment() : ""); }
.append(insert.getComment() != null ? insert.getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("Insert") .append(insert.getCommentInto() != null ? " " + insert.getCommentInto() + ExpressionDeParser.LINE_SEPARATOR : "").append(" into ") .append(insert.getTable().getComment() != null ? insert.getTable().getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(insert.getTable().getWholeTableName()); if (insert.getColumns() != null) { buffer.append(insert.getCommentBeforeColums() != null ? insert.getCommentBeforeColums() + " " : "")
buffer.append(aReplace.getCommentInto() != null ? aReplace.getCommentInto() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("Into "); buffer.append(aReplace.getTable().getComment() != null ? aReplace.getTable().getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(aReplace.getTable().getWholeTableName()); if (aReplace.getExpressions() != null && aReplace.getColumns() != null) { buffer.append(aReplace.getCommentSet() != null ? " " + aReplace.getCommentSet() + ExpressionDeParser.LINE_SEPARATOR : "").append(" SET ");