qunqingrihe commented on code in PR #725: URL: https://github.com/apache/incubator-seata-go/pull/725#discussion_r1873409641
########## pkg/datasource/sql/undo/builder/mysql_insertonduplicate_update_undo_log_builder.go: ########## @@ -97,68 +97,119 @@ func (u *MySQLInsertOnDuplicateUndoLogBuilder) buildBeforeImageSQL(insertStmt *a if err := checkDuplicateKeyUpdate(insertStmt, metaData); err != nil { return "", nil, err } - var selectArgs []driver.Value + + // Reset primary keys map + u.BeforeImageSqlPrimaryKeys = make(map[string]bool) + 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 } + if len(paramMap) == 0 || len(metaData.Indexs) == 0 { + return "", nil, nil + } + hasPK := false Review Comment: > > use `goto` > > goto 不太好理解? 那这里还需要改为goto吗 -- 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