Copilot commented on code in PR #8124:
URL: https://github.com/apache/incubator-seata/pull/8124#discussion_r3340104425


##########
sqlparser/seata-sqlparser-druid/src/main/java/org/apache/seata/sqlparser/druid/mysql/MySQLInsertRecognizer.java:
##########
@@ -126,7 +127,15 @@ public List<List<Object>> 
getInsertRows(Collection<Integer> primaryKeyIndex) {
                 } else if (expr instanceof SQLVariantRefExpr) {
                     row.add(((SQLVariantRefExpr) expr).getName());
                 } else if (expr instanceof SQLMethodInvokeExpr) {
-                    row.add(SqlMethodExpr.get());
+                    final int[] placeholderCount = {0};
+                    expr.accept(new SQLASTVisitorAdapter() {
+                        @Override
+                        public boolean visit(SQLVariantRefExpr x) {
+                            placeholderCount[0]++;
+                            return true;
+                        }
+                    });

Review Comment:
   Inside SQLMethodInvokeExpr placeholder tracking, the visitor currently 
counts every SQLVariantRefExpr, including MySQL user/system variables (e.g. 
@var, @@version) that are not JDBC placeholders. This can over-count 
placeholders and miscalculate PreparedStatement parameter indexes when such 
variables appear inside SQL functions.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to