Fixed error caused by canceling the SQL statement before it is used
This commit is contained in:
6
main.go
6
main.go
@@ -151,22 +151,20 @@ func getHistory(c *gin.Context) {
|
||||
var tempUser loginOutput
|
||||
stmt, err := db.Prepare("SELECT * FROM users WHERE uid=?")
|
||||
checkErr(err)
|
||||
err = stmt.Close()
|
||||
checkErr(err)
|
||||
err = stmt.QueryRow(history[i].UID).Scan(&tempUser.UID, &tempUser.Name, &tempUser.Password, &tempUser.Role)
|
||||
checkErr(err)
|
||||
tempHistory.User = tempUser.Name
|
||||
stmt.Close()
|
||||
|
||||
// get the task name and points
|
||||
var tempTask task
|
||||
stmt, err = db.Prepare("SELECT * FROM activities WHERE taskId=?")
|
||||
checkErr(err)
|
||||
err = stmt.Close()
|
||||
checkErr(err)
|
||||
err = stmt.QueryRow(history[i].TID).Scan(&tempTask.TID, &tempTask.Name, &tempTask.Points)
|
||||
checkErr(err)
|
||||
tempHistory.Task = tempTask.Name
|
||||
tempHistory.PointsGained = tempTask.Points
|
||||
stmt.Close()
|
||||
|
||||
tempHistory.Time = history[i].Time
|
||||
|
||||
|
||||
Reference in New Issue
Block a user