bug fixed sql parser grouping sets

This commit is contained in:
高铁
2016-01-09 17:58:43 +08:00
parent 2ddc29e11a
commit aa41581ce2
6 changed files with 60 additions and 87 deletions
@@ -169,9 +169,11 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Printab
private String indent = "\t";
private int indentCount = 0;
private boolean prettyFormat = true;
protected boolean ucase = true;
protected boolean ucase = true;
protected int selectListNumberOfLine = 5;
protected boolean groupItemSingleLine = false;
private List<Object> parameters;
public SQLASTOutputVisitor(Appendable appender){
@@ -734,9 +736,17 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Printab
}
public boolean visit(SQLSelectGroupByClause x) {
if (x.getItems().size() > 0) {
int itemSize = x.getItems().size();
if (itemSize > 0) {
print0(ucase ? "GROUP BY " : "group by ");
printAndAccept(x.getItems(), ", ");
incrementIndent();
for (int i = 0; i < itemSize; ++i) {
if (i != 0) {
println(", ");
}
x.getItems().get(i).accept(this);
}
decrementIndent();
}
if (x.getHaving() != null) {