sandynz commented on issue #6729:
URL: https://github.com/apache/shardingsphere/issues/6729#issuecomment-671003027


   Reason analyze of "sql parameters not set".
   
   InsertValueContext.parameterCount is 0, since related ExpressionSegment is 
not instanceof ParameterMarkerExpressionSegment.
   
   ```
   InsertValueContext.java
       private int calculateParametersCount(final Collection<ExpressionSegment> 
assignments) {
           int result = 0;
           for (ExpressionSegment each : assignments) {
               if (each instanceof ParameterMarkerExpressionSegment) {
                   result++;
               }
           }
           return result;
       }
   ```
   
   ```
   PostgreSQLDMLVisitor.java
       private Collection<ExpressionSegment> createInsertValuesSegments(final 
ExprListContext ctx) {
           Collection<ExpressionSegment> result = new LinkedList<>();
           if (null != ctx.exprList()) {
               Collection<ExpressionSegment> tmpResult = 
createInsertValuesSegments(ctx.exprList());
               result.addAll(tmpResult);
           }
           visit(ctx.aExpr());
           CommonExpressionSegment expressionSegment = new 
CommonExpressionSegment(ctx.aExpr().start.getStartIndex(), 
ctx.aExpr().stop.getStopIndex(), ctx.aExpr().getText());
           result.add(expressionSegment);
           return result;
       }
   ```
   Underlying expressionSegment result is ignored, and a new 
CommonExpressionSegment is created.
   
   routeContext example:
   ![routeContext 
example](https://user-images.githubusercontent.com/42492540/89724609-f9f71f00-da37-11ea-9e61-659ff3d7332b.png)
   


----------------------------------------------------------------
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