refactor sql parser about the desc and explain parts of the code

This commit is contained in:
wenshao
2017-03-25 20:10:44 +08:00
parent 7322da961b
commit 99337c1ffb
18 changed files with 191 additions and 253 deletions
@@ -15,14 +15,24 @@
*/
package com.alibaba.druid.sql.ast.statement;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLName;
import com.alibaba.druid.sql.ast.SQLStatementImpl;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
import java.util.ArrayList;
import java.util.List;
public class SQLDescribeStatement extends SQLStatementImpl {
protected SQLName object;
protected SQLName column;
// for odps
protected SQLObjectType objectType;
protected List<SQLExpr> partition = new ArrayList<SQLExpr>();
public SQLName getObject() {
return object;
}
@@ -30,9 +40,40 @@ public class SQLDescribeStatement extends SQLStatementImpl {
public void setObject(SQLName object) {
this.object = object;
}
public SQLName getColumn() {
return column;
}
public void setColumn(SQLName column) {
if (column != null) {
column.setParent(this);
}
this.column = column;
}
public List<SQLExpr> getPartition() {
return partition;
}
public void setPartition(List<SQLExpr> partition) {
this.partition = partition;
}
public SQLObjectType getObjectType() {
return objectType;
}
public void setObjectType(SQLObjectType objectType) {
this.objectType = objectType;
}
@Override
protected void accept0(SQLASTVisitor visitor) {
throw new UnsupportedOperationException(this.getClass().getName());
if (visitor.visit(this)) {
acceptChild(visitor, object);
acceptChild(visitor, column);
}
visitor.endVisit(this);
}
}