improve sql parser

This commit is contained in:
wenshao
2014-09-21 13:31:42 +08:00
parent 675ef128fb
commit 3735d87eda
18 changed files with 320 additions and 22 deletions
@@ -34,8 +34,6 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class MySqlCreateTableStatement extends SQLCreateTableStatement implements MySqlStatement {
private boolean ifNotExiists = false;
private Map<String, SQLObject> tableOptions = new LinkedHashMap<String, SQLObject>();
protected SQLSelect query;
@@ -99,14 +97,6 @@ public class MySqlCreateTableStatement extends SQLCreateTableStatement implement
this.query = query;
}
public boolean isIfNotExiists() {
return ifNotExiists;
}
public void setIfNotExiists(boolean ifNotExiists) {
this.ifNotExiists = ifNotExiists;
}
@Override
protected void accept0(SQLASTVisitor visitor) {
if (visitor instanceof MySqlASTVisitor) {
@@ -2375,6 +2375,11 @@ public class MySqlStatementParser extends SQLStatementParser {
throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
} else if (identifierEquals("REMOVE")) {
throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
} else if (identifierEquals("ALGORITHM")) {
lexer.nextToken();
accept(Token.EQ);
stmt.getItems().add(new MySqlAlterTableOption("ALGORITHM", lexer.stringVal()));
lexer.nextToken();
} else if (identifierEquals(ENGINE)) {
lexer.nextToken();
accept(Token.EQ);