wenweibin commented on issue #7791:
URL: https://github.com/apache/shardingsphere/issues/7791#issuecomment-713653232


   1. Considering that the synax of _MySQL_ CALL _Statement_  is `CALL 
sp_name([parameter[,...]])`,in my opinion `MySQLCallStatement` class should add 
two properties: `procedureName`  and `parameters`,the codes are  as below:
   
   ```
   @ToString
   @AllArgsConstructor
   @Getter
   public final class MySQLCallStatement extends CallStatement implements 
MySQLStatement {
   
       private String procedureName;
   
       private List<ExpressionSegment> parameters;
   
   }
   ```
   
   2.  The Synax of _MySQL_ DO_Statement_  is `DO expr [, expr] ...,so i think 
`MySQLDoStatement` class should add one propertie: `expressionSegments` ,the 
codes are as below:
   
   ```
   @ToString
   @AllArgsConstructor
   @Getter
   public final class MySQLDoStatement extends DoStatement implements 
MySQLStatement {
   
       private List<ExpressionSegment> expressionSegments;
   }
   
   ```
   3. Correspondingly,the `MySQLDMLVisitor` class is refactored as below:
   
   ```
   public final class MySQLDMLVisitor extends MySQLVisitor implements 
DMLVisitor {
       
       @Override
       public ASTNode visitCall(final CallContext ctx) {
           String procedureName = ctx.identifier().getText();
           List<ExpressionSegment> parameters = new ArrayList<>();
           ctx.expr().forEach(each -> parameters.add((ExpressionSegment) 
visit(each)));
           return new MySQLCallStatement(procedureName,parameters);
       }
       
       @Override
       public ASTNode visitDoStatement(final DoStatementContext ctx) {
           List<ExpressionSegment> expressions = new ArrayList<>();
           ctx.expr().forEach(each -> expressions.add((ExpressionSegment) 
visit(each)));
           return new MySQLDoStatement(expressions);
       }
   }
   ```
   
   
   Can you give some suggestions?@jingshanglu  
   


----------------------------------------------------------------
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:
[email protected]


Reply via email to