improved sql parser.

This commit is contained in:
wenshao
2017-08-01 21:22:50 +08:00
parent bd125342e2
commit bd5f1712ba
4 changed files with 42 additions and 30 deletions
@@ -700,27 +700,8 @@ public class SQLCreateTableStatement extends SQLStatementImpl implements SQLDDLS
return true;
}
private boolean apply(SQLAlterTableAddIndex item) {
if (item.isKey()) {
MySqlPrimaryKey x = new MySqlPrimaryKey();
item.cloneTo(x);
x.setParent(this);
this.tableElementList.add(x);
return true;
}
if (item.isUnique()) {
MySqlUnique x = new MySqlUnique();
item.cloneTo(x);
x.setParent(this);
this.tableElementList.add(x);
return true;
}
MySqlTableIndex x = new MySqlTableIndex();
item.cloneTo(x);
x.setParent(this);
this.tableElementList.add(x);
return true;
protected boolean apply(SQLAlterTableAddIndex item) {
return false;
}
private boolean apply(SQLAlterTableAddColumn item) {
@@ -135,4 +135,16 @@ public class SQLUnionQuery extends SQLObjectImpl implements SQLSelectQuery {
return x;
}
public SQLSelectQueryBlock getFirstQueryBlock() {
if (left instanceof SQLSelectQueryBlock) {
return (SQLSelectQueryBlock) left;
}
if (left instanceof SQLUnionQuery) {
return ((SQLUnionQuery) left).getFirstQueryBlock();
}
return null;
}
}