improved mysql parser. bug fixed for issue #2263

This commit is contained in:
wenshao
2018-01-22 23:28:58 +08:00
parent b7214015a2
commit 5ed3a3e5a7
7 changed files with 177 additions and 2 deletions
@@ -5192,7 +5192,7 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
if (x.isTablespace()) {
print0(ucase ? " TABLESPACE" : " tablespace");
}
return false;
}
@@ -6225,4 +6225,23 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
x.getTo().accept(this);
return false;
}
@Override
public boolean visit(SQLAlterTableExchangePartition x) {
print0(ucase ? "EXCHANGE PARTITION " : "exchange partition ");
x.getPartition().accept(this);
print0(ucase ? " WITH TABLE " : " with table ");
x.getTable().accept(this);
Boolean validation = x.getValidation();
if (validation != null) {
if (validation) {
print0(ucase ? " WITH VALIDATION" : " with validation");
} else {
print0(ucase ? " WITHOUT VALIDATION" : " without validation");
}
}
return false;
}
}
@@ -823,4 +823,7 @@ public interface SQLASTVisitor {
boolean visit(SQLAlterSequenceStatement x);
void endVisit(SQLAlterSequenceStatement x);
boolean visit(SQLAlterTableExchangePartition x);
void endVisit(SQLAlterTableExchangePartition x);
}
@@ -1944,6 +1944,16 @@ public class SQLASTVisitorAdapter implements SQLASTVisitor {
}
@Override
public boolean visit(SQLAlterTableExchangePartition x) {
return true;
}
@Override
public void endVisit(SQLAlterTableExchangePartition x) {
}
public final boolean isEnabled(VisitorFeature feature) {
return VisitorFeature.isEnabled(this.features, feature);
}
@@ -2441,4 +2441,13 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
public boolean visit(SQLCreateDatabaseStatement x) {
return false;
}
@Override
public boolean visit(SQLAlterTableExchangePartition x) {
SQLExprTableSource table = x.getTable();
if (table != null) {
table.accept(this);
}
return false;
}
}