improved mysql parser. bug fixed for issue #2263

This commit is contained in:
wenshao
2018-01-22 23:28:58 +08:00
parent b7214015a2
commit 5ed3a3e5a7
7 changed files with 177 additions and 2 deletions
@@ -3806,7 +3806,31 @@ public class MySqlStatementParser extends SQLStatementParser {
accept(Token.RPAREN);
stmt.addItem(item);
} else if (lexer.identifierEquals("EXCHANGE")) {
throw new ParserException("TODO " + lexer.info());
lexer.nextToken();
accept(Token.PARTITION);
SQLAlterTableExchangePartition item = new SQLAlterTableExchangePartition();
SQLName partition = this.exprParser.name();
item.setPartition(partition);
accept(Token.WITH);
accept(Token.TABLE);
SQLName table = this.exprParser.name();
item.setTable(table);
if (lexer.token() == Token.WITH) {
lexer.nextToken();
acceptIdentifier("VALIDATION");
item.setValidation(true);
} else if (lexer.identifierEquals(FnvHash.Constants.WITHOUT)) {
lexer.nextToken();
acceptIdentifier("VALIDATION");
item.setValidation(false);
}
stmt.addItem(item);
} else if (lexer.token() == Token.OPTIMIZE) {
lexer.nextToken();