Copilot commented on code in PR #725:
URL: 
https://github.com/apache/incubator-seata-go/pull/725#discussion_r2094676935


##########
pkg/datasource/sql/undo/builder/mysql_insertonduplicate_update_undo_log_builder.go:
##########
@@ -97,68 +97,108 @@ func (u *MySQLInsertOnDuplicateUndoLogBuilder) 
buildBeforeImageSQL(insertStmt *a
        if err := checkDuplicateKeyUpdate(insertStmt, metaData); err != nil {
                return "", nil, err
        }
-       var selectArgs []driver.Value
+       u.BeforeImageSqlPrimaryKeys = make(map[string]bool, 
len(metaData.Indexs))
        pkIndexMap := u.getPkIndex(insertStmt, metaData)
        var pkIndexArray []int
        for _, val := range pkIndexMap {
-               tmpVal := val
-               pkIndexArray = append(pkIndexArray, tmpVal)
+               pkIndexArray = append(pkIndexArray, val)
        }
        insertRows, err := getInsertRows(insertStmt, pkIndexArray)
        if err != nil {
                return "", nil, err
        }
-       insertNum := len(insertRows)
        paramMap, err := u.buildImageParameters(insertStmt, args, insertRows)
        if err != nil {
                return "", nil, err
        }

Review Comment:
   [nitpick] The early return condition based on 'len(paramMap)' and 
'len(metaData.Indexs)' is not immediately self-explanatory. Consider adding a 
comment to clarify the rationale behind this check.
   ```suggestion
        }
        // If there are no parameters to process (paramMap is empty) or the 
table metadata
        // does not contain any indexes (metaData.Indexs is empty), the 
function cannot proceed.
   ```



-- 
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: notifications-unsubscr...@seata.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to