tachibana22 commented on code in PR #1133:
URL: 
https://github.com/apache/incubator-seata-go/pull/1133#discussion_r3695594014


##########
pkg/datasource/sql/undo/executor/utils.go:
##########
@@ -72,22 +72,24 @@ func rowListToMap(rows []types.RowImage, primaryKeyList 
[]string) map[string]map
        for _, row := range rows {
                fieldMap := make(map[string]interface{}, 0)
                var rowKey string
-               var firstUnderline bool
+               pkValues := make(map[string]interface{})
 
                for _, column := range row.Columns {
                        cleanName := util.DelEscape(column.ColumnName, 
types.DBTypeMySQL)
-                       for i, key := range primaryKeyList {
+                       for _, key := range primaryKeyList {
                                if cleanName == key {
-                                       if firstUnderline && i > 0 {
-                                               rowKey += "_##$$_"
-                                       }
-                                       // todo make value more accurate
-                                       rowKey = fmt.Sprintf("%v%v", rowKey, 
column.GetActualValue())
-                                       firstUnderline = true
+                                       pkValues[key] = column.GetActualValue()
                                }
                        }
                        fieldMap[strings.ToUpper(cleanName)] = column.Value
                }
+
+               for i, key := range primaryKeyList {
+                       if i > 0 {
+                               rowKey += "_##$$_"
+                       }
+                       rowKey = fmt.Sprintf("%v%v", rowKey, pkValues[key])

Review Comment:
   ok



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