Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/db/v1beta1/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ func (d *dbConn) RegisterObservationLog(trialName string, observationLog *v1beta
return fmt.Errorf("Pepare SQL statement failed: %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix @chenwenjun-github ! Could you please also correct the typo here? (Prepare)
Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

// Close the statement
defer stmt.Close()

// Execute INSERT
_, err = stmt.Exec(values...)
if err != nil {
Expand Down Expand Up @@ -179,6 +182,8 @@ func (d *dbConn) GetObservationLog(trialName string, metricName string, startTim
result := &v1beta1.ObservationLog{
MetricLogs: []*v1beta1.MetricLog{},
}
// Close the rows
defer rows.Close()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you move this right after the error check (line number 182), similar to stmt.Close().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

for rows.Next() {
var mname, mvalue, sqlTimeStr string
err := rows.Scan(&sqlTimeStr, &mname, &mvalue)
Expand Down