From 5c48d7316e472956264214b6213a39a4a8d522f9 Mon Sep 17 00:00:00 2001 From: Remi Reuvekamp Date: Sun, 15 Oct 2017 00:36:31 +0000 Subject: [PATCH] Fix database statement not prepared --- .../dendrite/clientapi/auth/storage/devices/devices_table.go | 5 ++++- .../dendrite/clientapi/auth/storage/devices/storage.go | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/devices_table.go b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/devices_table.go index 6680185e2..62932b65f 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/devices_table.go +++ b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/devices_table.go @@ -85,6 +85,9 @@ func (s *devicesStatements) prepare(db *sql.DB, server gomatrixserverlib.ServerN if s.deleteDeviceStmt, err = db.Prepare(deleteDeviceSQL); err != nil { return } + if s.deleteDevicesByLocalpartStmt, err = db.Prepare(deleteDevicesByLocalpartSQL); err != nil { + return + } s.serverName = server return } @@ -118,7 +121,7 @@ func (s *devicesStatements) deleteDevice( func (s *devicesStatements) deleteDevicesByLocalpart( ctx context.Context, txn *sql.Tx, localpart string, ) error { - stmt := common.TxStmt(txn, s.deleteDeviceStmt) + stmt := common.TxStmt(txn, s.deleteDevicesByLocalpartStmt) _, err := stmt.ExecContext(ctx, localpart) return err } diff --git a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/storage.go b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/storage.go index d3b3e84a5..c100e8f58 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/storage.go +++ b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/storage.go @@ -111,8 +111,8 @@ func (d *Database) RemoveDevice( } // RemoveAllDevices revokes devices by deleting the entry in the -// database matching with the given user ID localpart. -// If something went wrong during the deletion, it will return the SQL error +// database matching the given user ID localpart. +// If something went wrong during the deletion, it will return the SQL error. func (d *Database) RemoveAllDevices( ctx context.Context, localpart string, ) error {