mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-03-14 14:16:15 +01:00
Add SQL rows.Err handling
This commit is contained in:
parent
d20b0029bb
commit
4fed541bb7
5 changed files with 21 additions and 2 deletions
|
@ -110,8 +110,6 @@ func (db *appdbimpl) GetComments(uid string, photo_id int64, requesting_uid stri
|
||||||
return ERR_INTERNAL, nil, err
|
return ERR_INTERNAL, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
defer rows.Close()
|
|
||||||
|
|
||||||
comments := make([]structures.Comment, 0)
|
comments := make([]structures.Comment, 0)
|
||||||
|
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
@ -124,6 +122,10 @@ func (db *appdbimpl) GetComments(uid string, photo_id int64, requesting_uid stri
|
||||||
}
|
}
|
||||||
comments = append(comments, c)
|
comments = append(comments, c)
|
||||||
}
|
}
|
||||||
|
// We check if the iteration ended prematurely
|
||||||
|
if err = rows.Err(); err != nil {
|
||||||
|
return ERR_INTERNAL, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return SUCCESS, &comments, nil
|
return SUCCESS, &comments, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,10 @@ func (db *appdbimpl) GetPhotoLikes(uid string, photo int64, requesting_uid strin
|
||||||
}
|
}
|
||||||
likes = append(likes, structures.UIDName{UID: uid, Name: name})
|
likes = append(likes, structures.UIDName{UID: uid, Name: name})
|
||||||
}
|
}
|
||||||
|
// We check if the iteration ended prematurely
|
||||||
|
if err = rows.Err(); err != nil {
|
||||||
|
return ERR_INTERNAL, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return SUCCESS, &likes, nil
|
return SUCCESS, &likes, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,10 @@ func (db *appdbimpl) GetUserPhotos(uid string, requesting_uid string, start_inde
|
||||||
}
|
}
|
||||||
photos = append(photos, photo)
|
photos = append(photos, photo)
|
||||||
}
|
}
|
||||||
|
// We check if the iteration ended prematurely
|
||||||
|
if err = rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return &photos, nil
|
return &photos, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,10 @@ func (db *appdbimpl) GetUserStream(uid string, start_index int, limit int) (*[]s
|
||||||
}
|
}
|
||||||
photos = append(photos, photo)
|
photos = append(photos, photo)
|
||||||
}
|
}
|
||||||
|
// We check if the iteration ended prematurely
|
||||||
|
if err = rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return &photos, nil
|
return &photos, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,6 +162,11 @@ func (db *appdbimpl) uidNameQuery(rows *sql.Rows, err error) (*[]structures.UIDN
|
||||||
}
|
}
|
||||||
followers = append(followers, structures.UIDName{UID: uid, Name: name})
|
followers = append(followers, structures.UIDName{UID: uid, Name: name})
|
||||||
}
|
}
|
||||||
|
// We check if the iteration ended prematurely
|
||||||
|
if err = rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return &followers, nil
|
return &followers, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue