mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve alter table statment
This commit is contained in:
@@ -1849,7 +1849,10 @@ public class MySqlExprParser extends SQLExprParser {
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
assignItem = new SQLAssignItem(new SQLIdentifierExpr(SINGLE_WORD_TABLE_OPTIONS[idx]), expr());
|
||||
// STORAGE_POLICY
|
||||
assignItem = new SQLAssignItem(
|
||||
new SQLIdentifierExpr(SINGLE_WORD_TABLE_OPTIONS[idx])
|
||||
, idx == 9 ? charExpr() : expr());
|
||||
}
|
||||
} else {
|
||||
// Following may not table options. Save mark.
|
||||
|
||||
@@ -68,4 +68,24 @@ public class MySqlAlterTableTest54 extends TestCase {
|
||||
//do nothing
|
||||
}
|
||||
}
|
||||
|
||||
public void test_6() throws Exception {
|
||||
String sql = "alter table event_log storage_policy = HOT";
|
||||
MySqlStatementParser parser = new MySqlStatementParser(sql);
|
||||
try {
|
||||
SQLAlterTableStatement stmt = (SQLAlterTableStatement) parser.parseStatementList().get(0);
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public void test_7() throws Exception {
|
||||
String sql = "alter table event_log storage_policy = COLD";
|
||||
MySqlStatementParser parser = new MySqlStatementParser(sql);
|
||||
try {
|
||||
SQLAlterTableStatement stmt = (SQLAlterTableStatement) parser.parseStatementList().get(0);
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user