mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
fix #4444
This commit is contained in:
@@ -457,6 +457,11 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return parseCreateMaterializedView();
|
||||
}
|
||||
|
||||
if(lexer.identifierEquals(FnvHash.Constants.ROLE)) {
|
||||
lexer.reset(mark);
|
||||
return parseCreateRole();
|
||||
}
|
||||
|
||||
throw new ParserException("TODO " + lexer.info());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.alibaba.druid.bvt.sql.mysql.issues;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
|
||||
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlSchemaStatVisitor;
|
||||
import com.alibaba.druid.stat.TableStat;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
public class Issue4444 {
|
||||
@Test
|
||||
public void test_idle2() throws Exception {
|
||||
String sql = "create role 'role1'";
|
||||
MySqlStatementParser parser = new MySqlStatementParser(sql);
|
||||
SQLStatement statement = parser.parseStatement();
|
||||
MySqlSchemaStatVisitor visitor = new MySqlSchemaStatVisitor();
|
||||
statement.accept(visitor);
|
||||
assertEquals("CREATE ROLE 'role1'", statement.toString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user