mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved oracle sql parser for pl/sql if.
This commit is contained in:
+11
-1
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user