jagan-parthiban commented on code in PR #7383:
URL: https://github.com/apache/trafficcontrol/pull/7383#discussion_r1132739214


##########
traffic_ops/traffic_ops_golang/api/generic_crud.go:
##########
@@ -119,19 +119,39 @@ func GenericCreateNameBasedID(val GenericCreator) (error, 
error, int) {
        }
        defer resultRows.Close()
 
+       var name string
        lastUpdated := tc.TimeNoMod{}
        rowsAffected := 0
-       for resultRows.Next() {
-               rowsAffected++
-               if err := resultRows.Scan(&lastUpdated); err != nil {
-                       return nil, errors.New(val.GetType() + " create 
scanning: " + err.Error()), http.StatusInternalServerError
+
+       // Only when the type is of serviceCategory, &name is scanned and 
returned from the DB.
+       // Else return only &lastUpdated.
+       if val.GetType() == "serviceCategory" {
+               for resultRows.Next() {

Review Comment:
   Suggestion Implemented



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

Reply via email to