More rows.Close() and rows.Err() (#3262)

Looks like we missed some `rows.Close()`

Even though `rows.Err()` is mostly not necessary, we should be more
consistent in the DB layer.

[skip ci]
This commit is contained in:
Till 2023-11-09 08:42:33 +01:00 committed by GitHub
parent ee73a90aea
commit 699f5ca8c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 101 additions and 61 deletions

View file

@ -18,6 +18,7 @@ import (
"context"
"database/sql"
"github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/userapi/storage/tables"
"github.com/matrix-org/gomatrixserverlib/spec"
@ -94,6 +95,7 @@ func (s *threepidStatements) SelectThreePIDsForLocalpart(
if err != nil {
return
}
defer internal.CloseAndLogIfError(ctx, rows, "SelectThreePIDsForLocalpart: failed to close rows")
threepids = []authtypes.ThreePID{}
for rows.Next() {
@ -107,7 +109,7 @@ func (s *threepidStatements) SelectThreePIDsForLocalpart(
Medium: medium,
})
}
err = rows.Err()
return
}