You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/02/07 03:07:36 UTC

[GitHub] [incubator-shardingsphere] tristaZero commented on a change in pull request #4190: Add mysql grant visitor for DCLStatement

tristaZero commented on a change in pull request #4190: Add mysql grant visitor for DCLStatement
URL: https://github.com/apache/incubator-shardingsphere/pull/4190#discussion_r376194678
 
 

 ##########
 File path: shardingsphere-sql-parser/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/visitor/MySQLDCLVisitor.java
 ##########
 @@ -82,4 +92,34 @@ public ASTNode visitRenameUser(final RenameUserContext ctx) {
     public ASTNode visitSetPassword(final SetPasswordContext ctx) {
         return new SetPasswordStatement();
     }
+
+    @Override
+    public ASTNode visitGrant(final GrantContext ctx) {
+        GrantStatement result = new GrantStatement();
+        PrivilegeClause_Context privilegeClause = ctx.privilegeClause_();
+        if (null != privilegeClause && null != privilegeClause.onObjectClause_()) {
+            PrivilegeLevel_Context privilegeLevel = privilegeClause.onObjectClause_().privilegeLevel_();
+            TableNameContext tableNameContext = privilegeLevel.tableName();
+            if (null != tableNameContext) {
+                TableSegment tableSegment = createTableSegment(tableNameContext);
 
 Review comment:
   It it better to change it to `visit(tableNameContext)` which will call `visitTableName(final TableNameContext ctx)` in `MySQLVisitor.java`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services