more LIMIT 1s

This commit is contained in:
Howl 2016-04-07 12:43:39 +02:00
parent aae4c5de50
commit ea2d418a53
2 changed files with 2 additions and 2 deletions

View File

@ -111,7 +111,7 @@ func TokenNewPOST(md common.MethodData) (r common.Response) {
ret.Token = tokenStr ret.Token = tokenStr
id := 0 id := 0
err := md.DB.QueryRow("SELECT id FROM tokens WHERE token=?", tokenMD5).Scan(&id) err := md.DB.QueryRow("SELECT id FROM tokens WHERE token=? LIMIT 1", tokenMD5).Scan(&id)
if err == sql.ErrNoRows { if err == sql.ErrNoRows {
break break
} }

View File

@ -130,7 +130,7 @@ func UserWhatsTheIDGET(md common.MethodData) common.Response {
id int id int
allowed int allowed int
) )
err := md.DB.QueryRow("SELECT id, allowed FROM users WHERE username = ?", md.C.Param("username")).Scan(&id, &allowed) err := md.DB.QueryRow("SELECT id, allowed FROM users WHERE username = ? LIMIT 1", md.C.Param("username")).Scan(&id, &allowed)
if err != nil || allowed != 1 { if err != nil || allowed != 1 {
return common.Response{ return common.Response{
Code: 404, Code: 404,