mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved mysql ddl support, fix #4039
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user