This commit is contained in:
温少
2012-03-15 14:31:29 +08:00
14 changed files with 42 additions and 24 deletions
@@ -26,7 +26,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class SQLCreateTableStatement extends SQLStatementImpl {
protected Type type;
protected SQLName name;
protected SQLExprTableSource tableSource;
protected List<SQLTableElement> tableElementList = new ArrayList<SQLTableElement>();
@@ -35,11 +35,23 @@ public class SQLCreateTableStatement extends SQLStatementImpl {
}
public SQLName getName() {
return name;
if (tableSource == null) {
return null;
}
return (SQLName) tableSource.getExpr();
}
public void setName(SQLName name) {
this.name = name;
this.setTableSource(new SQLExprTableSource(name));
}
public SQLExprTableSource getTableSource() {
return tableSource;
}
public void setTableSource(SQLExprTableSource tableSource) {
this.tableSource = tableSource;
}
public Type getType() {
@@ -67,7 +79,7 @@ public class SQLCreateTableStatement extends SQLStatementImpl {
buf.append("LOCAL TEMPORARY ");
}
this.name.output(buf);
this.tableSource.output(buf);
buf.append(" ");
buf.append("(");
@@ -83,7 +95,7 @@ public class SQLCreateTableStatement extends SQLStatementImpl {
@Override
protected void accept0(SQLASTVisitor visitor) {
if (visitor.visit(this)) {
this.acceptChild(visitor, name);
this.acceptChild(visitor, tableSource);
this.acceptChild(visitor, tableElementList);
}
visitor.endVisit(this);
@@ -9,21 +9,25 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class SQLTruncateStatement extends SQLStatementImpl {
private static final long serialVersionUID = 1L;
protected List<SQLName> tableNames = new ArrayList<SQLName>(2);
private static final long serialVersionUID = 1L;
protected List<SQLExprTableSource> tableSources = new ArrayList<SQLExprTableSource>(2);
public List<SQLName> getTableNames() {
return tableNames;
public List<SQLExprTableSource> getTableSources() {
return tableSources;
}
public void setTableNames(List<SQLName> tableNames) {
this.tableNames = tableNames;
public void setTableSources(List<SQLExprTableSource> tableSources) {
this.tableSources = tableSources;
}
public void addTableSource(SQLName name) {
this.tableSources.add(new SQLExprTableSource(name));
}
@Override
protected void accept0(SQLASTVisitor visitor) {
if (visitor.visit(this)) {
acceptChild(visitor, tableNames);
acceptChild(visitor, tableSources);
}
visitor.endVisit(this);
}