improved mysql ddl support, fix #4039

This commit is contained in:
高铁
2020-11-15 10:55:44 +08:00
parent c8dcfe1464
commit 7b7b6bcf37
3 changed files with 24 additions and 3 deletions
@@ -8005,6 +8005,16 @@ public class MySqlStatementParser extends SQLStatementParser {
SQLCreateDatabaseStatement stmt = new SQLCreateDatabaseStatement(dbType);
if (lexer.token() == Token.HINT) {
List<SQLCommentHint> hints = this.exprParser.parseHints();
if (hints.size() == 1) {
String text = hints.get(0).getText();
if (text.endsWith(" IF NOT EXISTS") && text.charAt(0) == '!') {
stmt.setIfNotExists(true);
}
}
}
if (lexer.token() == Token.IF) {
lexer.nextToken();
accept(Token.NOT);