diff --git a/src/main/java/net/sf/jsqlparser/expression/operators/relational/SupportsOldOracleJoinSyntax.java b/src/main/java/net/sf/jsqlparser/expression/operators/relational/SupportsOldOracleJoinSyntax.java index 1e2b0b994..02cc9a315 100644 --- a/src/main/java/net/sf/jsqlparser/expression/operators/relational/SupportsOldOracleJoinSyntax.java +++ b/src/main/java/net/sf/jsqlparser/expression/operators/relational/SupportsOldOracleJoinSyntax.java @@ -23,19 +23,19 @@ public interface SupportsOldOracleJoinSyntax { - static final int NO_ORACLE_JOIN = 0; - static final int ORACLE_JOIN_RIGHT = 1; - static final int ORACLE_JOIN_LEFT = 2; + final int NO_ORACLE_JOIN = 0; + final int ORACLE_JOIN_RIGHT = 1; + final int ORACLE_JOIN_LEFT = 2; int getOldOracleJoinSyntax(); void setOldOracleJoinSyntax(int oldOracleJoinSyntax); - - static final int NO_ORACLE_PRIOR = 0; - static final int ORACLE_PRIOR_START = 1; - static final int ORACLE_PRIOR_END = 2; - + + final int NO_ORACLE_PRIOR = 0; + final int ORACLE_PRIOR_START = 1; + final int ORACLE_PRIOR_END = 2; + int getOraclePriorPosition(); - + void setOraclePriorPosition(int priorPosition); } diff --git a/src/main/java/net/sf/jsqlparser/util/deparser/SelectDeParser.java b/src/main/java/net/sf/jsqlparser/util/deparser/SelectDeParser.java index f1c9762e0..1554c9345 100644 --- a/src/main/java/net/sf/jsqlparser/util/deparser/SelectDeParser.java +++ b/src/main/java/net/sf/jsqlparser/util/deparser/SelectDeParser.java @@ -37,7 +37,7 @@ public class SelectDeParser implements SelectVisitor, OrderByVisitor, SelectItemVisitor, FromItemVisitor, PivotVisitor { private StringBuilder buffer; - private ExpressionVisitor expressionVisitor; + private ExpressionVisitor expressionVisitor; public SelectDeParser() { } @@ -90,15 +90,15 @@ public void visit(PlainSelect plainSelect) { } if (plainSelect.getJoins() != null) { - for (Join join : plainSelect.getJoins()) { - deparseJoin(join); - } + for (Join join : plainSelect.getJoins()) { + deparseJoin(join); + } } if (plainSelect.getOracleHierarchical() != null) { plainSelect.getOracleHierarchical().accept(expressionVisitor); } - + if (plainSelect.getWhere() != null) { buffer.append(" WHERE "); plainSelect.getWhere().accept(expressionVisitor); @@ -175,55 +175,56 @@ public void visit(SubSelect subSelect) { @Override public void visit(Table tableName) { buffer.append(tableName.getWholeTableName()); - Pivot pivot = tableName.getPivot(); - if (pivot != null) { - pivot.accept(this); - } + Pivot pivot = tableName.getPivot(); + if (pivot != null) { + pivot.accept(this); + } String alias = tableName.getAlias(); if (alias != null && !alias.isEmpty()) { buffer.append(" AS ").append(alias); } } - @Override - public void visit(Pivot pivot) { - List forColumns = pivot.getForColumns(); - buffer.append(" PIVOT (") - .append(PlainSelect.getStringList(pivot.getFunctionItems())) - .append(" FOR ") - .append(PlainSelect.getStringList(forColumns, true, forColumns != null && forColumns.size() > 1)) - .append(" IN ") - .append(PlainSelect.getStringList(pivot.getInItems(), true, true)) - .append(")"); - } - - @Override - public void visit(PivotXml pivot) { - List forColumns = pivot.getForColumns(); - buffer.append(" PIVOT XML (") - .append(PlainSelect.getStringList(pivot.getFunctionItems())) - .append(" FOR ") - .append(PlainSelect.getStringList(forColumns, true, forColumns != null && forColumns.size() > 1)) - .append(" IN ("); - if (pivot.isInAny()) { - buffer.append("ANY"); - } else if (pivot.getInSelect() != null) { - buffer.append(pivot.getInSelect()); - } else { - buffer.append(PlainSelect.getStringList(pivot.getInItems())); - } - buffer.append("))"); - } + @Override + public void visit(Pivot pivot) { + List forColumns = pivot.getForColumns(); + buffer.append(" PIVOT (") + .append(PlainSelect.getStringList(pivot.getFunctionItems())) + .append(" FOR ") + .append(PlainSelect.getStringList(forColumns, true, forColumns != null && forColumns.size() > 1)) + .append(" IN ") + .append(PlainSelect.getStringList(pivot.getInItems(), true, true)) + .append(")"); + } + + @Override + public void visit(PivotXml pivot) { + List forColumns = pivot.getForColumns(); + buffer.append(" PIVOT XML (") + .append(PlainSelect.getStringList(pivot.getFunctionItems())) + .append(" FOR ") + .append(PlainSelect.getStringList(forColumns, true, forColumns != null && forColumns.size() > 1)) + .append(" IN ("); + if (pivot.isInAny()) { + buffer.append("ANY"); + } else if (pivot.getInSelect() != null) { + buffer.append(pivot.getInSelect()); + } else { + buffer.append(PlainSelect.getStringList(pivot.getInItems())); + } + buffer.append("))"); + } public void deparseOrderBy(List orderByElements) { deparseOrderBy(false, orderByElements); } - + public void deparseOrderBy(boolean oracleSiblings, List orderByElements) { - if (oracleSiblings) + if (oracleSiblings) { buffer.append(" ORDER SIBLINGS BY "); - else + } else { buffer.append(" ORDER BY "); + } for (Iterator iter = orderByElements.iterator(); iter.hasNext();) { OrderByElement orderByElement = iter.next(); orderByElement.accept(this);