improved oracle sql parser for pl/sql if.

This commit is contained in:
wenshao
2017-05-11 07:17:57 +08:00
parent f10921ec8f
commit 5693b8f2e9
6 changed files with 342 additions and 1 deletions
@@ -1977,8 +1977,18 @@ public class OracleOutputVisitor extends SQLASTOutputVisitor implements OracleAS
@Override
public boolean visit(SQLIfStatement x) {
print0(ucase ? "IF " : "if ");
int lines = this.lines;
incrementIndent();
x.getCondition().accept(this);
print0(ucase ? " THEN" : " then");
decrementIndent();
if (lines != this.lines) {
println();
} else {
print(' ');
}
print0(ucase ? "THEN" : "then");
incrementIndent();
println();
for (int i = 0, size = x.getStatements().size(); i < size; ++i) {
@@ -63,6 +63,8 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
protected boolean shardingSupport = false;
protected transient int lines = 0;
public SQLASTOutputVisitor(Appendable appender){
this.appender = appender;
}
@@ -283,6 +285,7 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
}
print0("\n");
lines++;
printIndent();
}