improved sql parser.

This commit is contained in:
wenshao
2017-09-28 09:39:01 +08:00
parent aa957fab13
commit 6277b490bd
166 changed files with 2030 additions and 446 deletions
@@ -4110,7 +4110,7 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
@Override
public boolean visit(SQLOpenStatement x) {
print0(ucase ? "OPEN " : "open ");
print0(x.getCursorName());
printExpr(x.getCursorName());
List<SQLName> columns = x.getColumns();
if (columns.size() > 0) {
@@ -4143,7 +4143,7 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
@Override
public boolean visit(SQLCloseStatement x) {
print0(ucase ? "CLOSE " : "close ");
print0(x.getCursorName());
printExpr(x.getCursorName());
return false;
}
@@ -5352,6 +5352,20 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
return false;
}
@Override
public boolean visit(SQLIntervalExpr x) {
print0(ucase ? "INTERVAL " : "interval ");
SQLExpr value = x.getValue();
value.accept(this);
SQLIntervalUnit unit = x.getUnit();
if (unit != null) {
print(' ');
print0(ucase ? unit.name() : unit.name_lcase);
}
return false;
}
public Boolean getPrintStatementAfterSemi() {
return printStatementAfterSemi;
}
@@ -64,9 +64,9 @@ public interface SQLASTVisitor {
void endVisit(SQLSelectStatement selectStatement);
void postVisit(SQLObject astNode);
void postVisit(SQLObject x);
void preVisit(SQLObject astNode);
void preVisit(SQLObject x);
boolean visit(SQLAllColumnExpr x);
@@ -758,4 +758,8 @@ public interface SQLASTVisitor {
boolean visit(SQLAlterTypeStatement x);
void endVisit(SQLAlterTypeStatement x);
boolean visit(SQLIntervalExpr x);
void endVisit(SQLIntervalExpr x);
}
@@ -1739,6 +1739,16 @@ public class SQLASTVisitorAdapter implements SQLASTVisitor {
}
@Override
public boolean visit(SQLIntervalExpr x) {
return true;
}
@Override
public void endVisit(SQLIntervalExpr x) {
}
public final boolean isEnabled(VisitorFeature feature) {
return VisitorFeature.isEnabled(this.features, feature);
}
@@ -1113,6 +1113,10 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
return false;
}
if (x.getResolvedOwnerObject() instanceof SQLParameter) {
return false;
}
boolean skip = false;
for (SQLObject parent = x.getParent();parent != null;parent = parent.getParent()) {
if (parent instanceof SQLSelectQueryBlock) {