mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user