mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved mysql parser. bug fixed for issue #2263
This commit is contained in:
@@ -25,6 +25,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
public class SQLAlterTableDiscardPartition extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private final List<SQLName> partitions = new ArrayList<SQLName>(4);
|
||||
private boolean tablespace;
|
||||
|
||||
public List<SQLName> getPartitions() {
|
||||
return partitions;
|
||||
@@ -44,4 +45,12 @@ public class SQLAlterTableDiscardPartition extends SQLObjectImpl implements SQLA
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
public boolean isTablespace() {
|
||||
return tablespace;
|
||||
}
|
||||
|
||||
public void setTablespace(boolean tablespace) {
|
||||
this.tablespace = tablespace;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3712,6 +3712,11 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
this.exprParser.names(item.getPartitions(), item);
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.TABLESPACE) {
|
||||
lexer.nextToken();
|
||||
item.setTablespace(true);
|
||||
}
|
||||
|
||||
stmt.addItem(item);
|
||||
} else {
|
||||
accept(Token.TABLESPACE);
|
||||
|
||||
@@ -5188,6 +5188,11 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
|
||||
public boolean visit(SQLAlterTableDiscardPartition x) {
|
||||
print0(ucase ? "DISCARD PARTITION " : "discard partition ");
|
||||
printPartitions(x.getPartitions());
|
||||
|
||||
if (x.isTablespace()) {
|
||||
print0(ucase ? " TABLESPACE" : " tablespace");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user