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/08/20 15:44:52 UTC

[GitHub] [shardingsphere] strongduanmu edited a comment on issue #6942: Parameterized ON DUPLICATE KEY UPDATE in insert statement doesn't work on MySQL proxy

strongduanmu edited a comment on issue #6942:
URL: https://github.com/apache/shardingsphere/issues/6942#issuecomment-677740258


   @sandynz Thank you for the example, and I have reproduced this exception. The reason for this problem is that the value in the `on duplicate key statement` is parsed twice, therefore the `parametersCount` is greater than the actual value by 1. 
   
   ```java
   @Override
   public ASTNode visitOnDuplicateKeyClause(final OnDuplicateKeyClauseContext ctx) {
       Collection<AssignmentSegment> columns = new LinkedList<>();
       for (AssignmentContext each : ctx.assignment()) {
           columns.add((AssignmentSegment) visit(each));
           visit(each.assignmentValue());
       }
       return new OnDuplicateKeyColumnsSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), columns);
   }
   ```
   
   I will fix this problem as soon as possible.
   


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