/**
* Alipay.com Inc.
* Copyright (c) 2004-2012 All Rights Reserved.
*/
package com.alipay.zdal.parser.sql.ast.statement;
import com.alipay.zdal.parser.sql.ast.SQLExpr;
import com.alipay.zdal.parser.sql.ast.SQLName;
import com.alipay.zdal.parser.sql.ast.SQLStatementImpl;
import com.alipay.zdal.parser.sql.ast.expr.SQLIdentifierExpr;
import com.alipay.zdal.parser.sql.visitor.SQLASTVisitor;
/**
*
* @author xiaoqing.zhouxq
* @version $Id: SQLDeleteStatement.java, v 0.1 2012-11-17 ����3:21:44 xiaoqing.zhouxq Exp $
*/
public class SQLDeleteStatement extends SQLStatementImpl {
private static final long serialVersionUID = 1L;
protected SQLTableSource tableSource;
protected SQLExpr where;
public SQLDeleteStatement() {
}
public SQLTableSource getTableSource() {
return tableSource;
}
public SQLExprTableSource getExprTableSource() {
return (SQLExprTableSource) getTableSource();
}
public void setTableSource(SQLExpr expr) {
this.setTableSource(new SQLExprTableSource(expr));
}
public void setTableSource(SQLTableSource tableSource) {
this.tableSource = tableSource;
}
public SQLName getTableName() {
return (SQLName) getExprTableSource().getExpr();
}
public void setTableName(SQLName tableName) {
this.setTableSource(new SQLExprTableSource(tableName));
}
public void setTableName(String name) {
setTableName(new SQLIdentifierExpr(name));
}
public SQLExpr getWhere() {
return where;
}
public void setWhere(SQLExpr where) {
this.where = where;
}
public String getAlias() {
return this.tableSource.getAlias();
}
public void setAlias(String alias) {
this.tableSource.setAlias(alias);
}
@Override
protected void accept0(SQLASTVisitor visitor) {
if (visitor.visit(this)) {
acceptChild(visitor, tableSource);
acceptChild(visitor, where);
}
visitor.endVisit(this);
}
}