improve wall filter

This commit is contained in:
wenshao
2013-04-01 20:05:46 +08:00
parent 7a49a6ce35
commit 032c5762e2
46 changed files with 1653 additions and 222 deletions
@@ -20,6 +20,8 @@ import java.util.List;
import com.alibaba.druid.sql.ast.SQLName;
import com.alibaba.druid.sql.ast.SQLStatementImpl;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class SQLAlterTableStatement extends SQLStatementImpl implements SQLDDLStatement {
@@ -54,4 +56,13 @@ public class SQLAlterTableStatement extends SQLStatementImpl implements SQLDDLSt
public void setName(SQLName name) {
this.setTableSource(new SQLExprTableSource(name));
}
@Override
protected void accept0(SQLASTVisitor visitor) {
if (visitor.visit(this)) {
acceptChild(visitor, getTableSource());
acceptChild(visitor, getItems());
}
visitor.endVisit(this);
}
}
@@ -44,6 +44,9 @@ public class SQLDeleteStatement extends SQLStatementImpl {
}
public void setTableSource(SQLTableSource tableSource) {
if (tableSource != null) {
tableSource.setParent(this);
}
this.tableSource = tableSource;
}
@@ -49,6 +49,9 @@ public abstract class SQLInsertInto extends SQLObjectImpl {
}
public void setTableSource(SQLExprTableSource tableSource) {
if (tableSource != null) {
tableSource.setParent(this);
}
this.tableSource = tableSource;
}
@@ -63,6 +63,9 @@ public class SQLJoinTableSource extends SQLTableSourceImpl {
}
public void setLeft(SQLTableSource left) {
if (left != null) {
left.setParent(this);
}
this.left = left;
}
@@ -71,6 +74,9 @@ public class SQLJoinTableSource extends SQLTableSourceImpl {
}
public void setRight(SQLTableSource right) {
if (right != null) {
right.setParent(this);
}
this.right = right;
}
@@ -79,6 +85,9 @@ public class SQLJoinTableSource extends SQLTableSourceImpl {
}
public void setCondition(SQLExpr condition) {
if (condition != null) {
condition.setParent(this);
}
this.condition = condition;
}
@@ -43,10 +43,13 @@ public class SQLSelectQueryBlock extends SQLSelectQuery {
}
public void setInto(SQLExpr into) {
this.into = new SQLExprTableSource(into);
this.setInto(new SQLExprTableSource(into));
}
public void setInto(SQLExprTableSource into) {
if (into != null) {
into.setParent(this);
}
this.into = into;
}
@@ -36,7 +36,9 @@ public class SQLTruncateStatement extends SQLStatementImpl {
}
public void addTableSource(SQLName name) {
this.tableSources.add(new SQLExprTableSource(name));
SQLExprTableSource tableSource = new SQLExprTableSource(name);
tableSource.setParent(this);
this.tableSources.add(tableSource);
}
@Override
@@ -45,6 +45,9 @@ public class SQLUpdateStatement extends SQLStatementImpl {
}
public void setTableSource(SQLTableSource tableSource) {
if (tableSource != null) {
tableSource.setParent(this);
}
this.tableSource = tableSource;
}