improved db2 parser support. for issue #2489

This commit is contained in:
wenshao
2018-04-16 00:03:21 +08:00
parent 3ea9c0c8ba
commit 0acd0c76df
16 changed files with 440 additions and 79 deletions
@@ -2418,6 +2418,18 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
}
}
SQLExpr generatedAlawsAs = x.getGeneratedAlawsAs();
if (generatedAlawsAs != null) {
print0(ucase ? " GENERATED ALWAYS AS " : " generated always as ");
printExpr(generatedAlawsAs);
}
SQLColumnDefinition.Identity identity = x.getIdentity();
if (identity != null) {
print(' ');
identity.accept(this);
}
if (x.getEnable() != null) {
if (x.getEnable().booleanValue()) {
print0(ucase ? " ENABLE" : " enable");
@@ -6525,6 +6537,14 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
return false;
}
@Override
public boolean visit(SQLWindow x) {
x.getName().accept(this);
print0(ucase ? " AS " : " as ");
x.getOver().accept(this);
return false;
}
public void print(float value) {
if (this.appender == null) {
return;
@@ -838,4 +838,8 @@ public interface SQLASTVisitor {
boolean visit(SQLRealExpr x);
void endVisit(SQLRealExpr x);
boolean visit(SQLWindow x);
void endVisit(SQLWindow x);
}
@@ -1990,6 +1990,17 @@ public class SQLASTVisitorAdapter implements SQLASTVisitor {
}
@Override
public boolean visit(SQLWindow x) {
return true;
}
public void endVisit(SQLWindow x) {
}
public final boolean isEnabled(VisitorFeature feature) {
return VisitorFeature.isEnabled(this.features, feature);
}