dendrite/federationsender
Kiril Vladimiroff d5dbe546e4
Always defer *sql.Rows.Close and consult with Err (#844)
* Always defer *sql.Rows.Close and consult with Err

database/sql.Rows.Next() makes sure to call Close only after exhausting
result rows which would NOT happen when returning early from a bad Scan.
Close being idempotent makes it a great candidate to get always deferred
regardless of what happens later on the result set.

This change also makes sure call Err() after exhausting Next() and
propagate non-nil results from it as the documentation advises.

Closes #764

Signed-off-by: Kiril Vladimiroff <kiril@vladimiroff.org>

* Override named result parameters in last returns

Signed-off-by: Kiril Vladimiroff <kiril@vladimiroff.org>

* Do the same over new changes that got merged

Signed-off-by: Kiril Vladimiroff <kiril@vladimiroff.org>

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2020-02-11 14:12:21 +00:00
..
api Add joined hosts query APIs (#781) 2019-08-22 19:47:52 +08:00
consumers Implement storage interfaces (#841) 2020-01-03 14:07:05 +00:00
query Return server names (#833) 2019-12-20 13:24:57 +00:00
queue Don't print Sending EDU if there is noone to send to (#721) 2019-07-01 16:04:49 +01:00
storage Always defer *sql.Rows.Close and consult with Err (#844) 2020-02-11 14:12:21 +00:00
types use go module for dependencies (#594) 2019-05-21 21:56:55 +01:00
federationsender.go Set up queryAPI in federationsender (#791) 2019-08-24 01:25:10 +08:00