Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

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

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions roomserver/storage/postgres/events_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ func (s *eventStatements) BulkSelectSnapshotsFromEventIDs(
if err != nil {
return nil, err
}
defer internal.CloseAndLogIfError(ctx, rows, "BulkSelectSnapshotsFromEventIDs: rows.close() failed")

var eventID string
var stateNID types.StateSnapshotNID
Expand Down
1 change: 1 addition & 0 deletions roomserver/storage/postgres/user_room_keys_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func (s *userRoomKeysStatements) SelectAllPublicKeysForUser(ctx context.Context,
if errors.Is(err, sql.ErrNoRows) {
return nil, nil
}
defer internal.CloseAndLogIfError(ctx, rows, "SelectAllPublicKeysForUser: failed to close rows")

resultMap := make(map[types.RoomNID]ed25519.PublicKey)

Expand Down
1 change: 1 addition & 0 deletions roomserver/storage/sqlite3/user_room_keys_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ func (s *userRoomKeysStatements) SelectAllPublicKeysForUser(ctx context.Context,
if errors.Is(err, sql.ErrNoRows) {
return nil, nil
}
defer internal.CloseAndLogIfError(ctx, rows, "SelectAllPublicKeysForUser: failed to close rows")

resultMap := make(map[types.RoomNID]ed25519.PublicKey)

Expand Down
2 changes: 2 additions & 0 deletions syncapi/storage/postgres/memberships_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"database/sql"
"fmt"

"github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/internal/sqlutil"
rstypes "github.com/matrix-org/dendrite/roomserver/types"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
Expand Down Expand Up @@ -160,6 +161,7 @@ func (s *membershipsStatements) SelectMemberships(
if err != nil {
return
}
defer internal.CloseAndLogIfError(ctx, rows, "SelectMemberships: failed to close rows")
var (
eventID string
)
Expand Down
2 changes: 2 additions & 0 deletions syncapi/storage/sqlite3/memberships_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"database/sql"
"fmt"

"github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/internal/sqlutil"
rstypes "github.com/matrix-org/dendrite/roomserver/types"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
Expand Down Expand Up @@ -163,6 +164,7 @@ func (s *membershipsStatements) SelectMemberships(
if err != nil {
return
}
defer internal.CloseAndLogIfError(ctx, rows, "SelectMemberships: failed to close rows")
var eventID string
for rows.Next() {
if err = rows.Scan(&eventID); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"database/sql"

"github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/internal/sqlutil"
rstypes "github.com/matrix-org/dendrite/roomserver/types"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
Expand Down Expand Up @@ -137,6 +138,7 @@ func (s *outputRoomEventsTopologyStatements) SelectEventIDsInRange(
} else if err != nil {
return
}
defer internal.CloseAndLogIfError(ctx, rows, "SelectEventIDsInRange: failed to close rows")

// Return the IDs.
var eventID string
Expand Down
2 changes: 2 additions & 0 deletions userapi/storage/postgres/threepid_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 2 additions & 0 deletions userapi/storage/sqlite3/account_data_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"database/sql"
"encoding/json"

"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"
Expand Down Expand Up @@ -95,6 +96,7 @@ func (s *accountDataStatements) SelectAccountData(
if err != nil {
return nil, nil, err
}
defer internal.CloseAndLogIfError(ctx, rows, "SelectAccountData: failed to close rows")

global := map[string]json.RawMessage{}
rooms := map[string]map[string]json.RawMessage{}
Expand Down
1 change: 1 addition & 0 deletions userapi/storage/sqlite3/devices_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ func (s *devicesStatements) SelectDevicesByLocalpart(
if err != nil {
return devices, err
}
defer internal.CloseAndLogIfError(ctx, rows, "SelectDevicesByLocalpart: failed to close rows")

var dev api.Device
var lastseents sql.NullInt64
Expand Down
Loading