bug fixed for SQLBetweenExpr output. for issue #2593

This commit is contained in:
wenshao
2018-05-27 13:45:05 +08:00
parent acfa688a65
commit 6c1dee0004
2 changed files with 116 additions and 2 deletions
@@ -496,8 +496,28 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
print0(ucase ? " BETWEEN " : " between ");
}
printExpr(beginExpr);
print0(ucase ? " AND " : " and ");
int lines = this.lines;
if (beginExpr instanceof SQLBinaryOpExpr) {
SQLBinaryOpExpr binaryOpBegin = (SQLBinaryOpExpr) beginExpr;
incrementIndent();
if (binaryOpBegin.isBracket() || binaryOpBegin.getOperator().isLogical()) {
print('(');
printExpr(beginExpr);
print(')');
} else {
printExpr(beginExpr);
}
decrementIndent();
} else {
printExpr(beginExpr);
}
if (lines != this.lines) {
println();
print0(ucase ? "AND " : "and ");
} else {
print0(ucase ? " AND " : " and ");
}
printExpr(endExpr);