This commit is contained in:
温少
2012-03-14 14:25:29 +08:00
parent b266a9c820
commit 6b7958dbfd
10 changed files with 74 additions and 49 deletions
@@ -11,7 +11,7 @@ import com.alibaba.druid.sql.ast.statement.SQLInsertStatement.ValuesClause;
public abstract class SQLInsertInto extends SQLObjectImpl {
private static final long serialVersionUID = 1L;
protected SQLName tableName;
protected SQLExprTableSource tableSource;
protected String alias;
protected final List<SQLExpr> columns = new ArrayList<SQLExpr>();
@@ -30,12 +30,24 @@ public abstract class SQLInsertInto extends SQLObjectImpl {
this.alias = alias;
}
public SQLExprTableSource getTableSource() {
return tableSource;
}
public void setTableSource(SQLExprTableSource tableSource) {
this.tableSource = tableSource;
}
public SQLName getTableName() {
return tableName;
return (SQLName) tableSource.getExpr();
}
public void setTableName(SQLName tableName) {
this.tableName = tableName;
this.setTableSource(new SQLExprTableSource(tableName));
}
public void setTableSource(SQLName tableName) {
this.setTableSource(new SQLExprTableSource(tableName));
}
public SQLSelect getQuery() {
@@ -34,7 +34,7 @@ public class SQLInsertStatement extends SQLInsertInto implements SQLStatement {
@Override
protected void accept0(SQLASTVisitor visitor) {
if (visitor.visit(this)) {
this.acceptChild(visitor, tableName);
this.acceptChild(visitor, tableSource);
this.acceptChild(visitor, columns);
this.acceptChild(visitor, values);
this.acceptChild(visitor, query);