From a086b155902a6d2e8416c623e1bd456a352d5787 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 28 Sep 2022 10:01:41 +0100 Subject: [PATCH] Fixes --- syncapi/storage/postgres/filter_table.go | 5 ----- syncapi/storage/sqlite3/filter_table.go | 5 ----- syncapi/storage/sqlite3/notification_data_table.go | 4 ++-- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/syncapi/storage/postgres/filter_table.go b/syncapi/storage/postgres/filter_table.go index 6f5ae626d..86cec3625 100644 --- a/syncapi/storage/postgres/filter_table.go +++ b/syncapi/storage/postgres/filter_table.go @@ -112,14 +112,9 @@ func (s *filterStatements) InsertFilter( // This can result in a race condition when two clients try to insert the // same filter and localpart at the same time, however this is not a // problem as both calls will result in the same filterID -<<<<<<< Updated upstream - err = sqlutil.TxStmt(txn, s.selectFilterIDByContentStmt).QueryRowContext(ctx, - localpart, filterJSON).Scan(&existingFilterID) -======= err = sqlutil.TxStmt(txn, s.selectFilterIDByContentStmt).QueryRowContext( ctx, localpart, filterJSON, ).Scan(&existingFilterID) ->>>>>>> Stashed changes if err != nil && err != sql.ErrNoRows { return "", err } diff --git a/syncapi/storage/sqlite3/filter_table.go b/syncapi/storage/sqlite3/filter_table.go index aa35511ab..5f1e980eb 100644 --- a/syncapi/storage/sqlite3/filter_table.go +++ b/syncapi/storage/sqlite3/filter_table.go @@ -116,14 +116,9 @@ func (s *filterStatements) InsertFilter( // This can result in a race condition when two clients try to insert the // same filter and localpart at the same time, however this is not a // problem as both calls will result in the same filterID -<<<<<<< Updated upstream - err = sqlutil.TxStmt(txn, s.selectFilterIDByContentStmt).QueryRowContext(ctx, - localpart, filterJSON).Scan(&existingFilterID) -======= err = sqlutil.TxStmt(txn, s.selectFilterIDByContentStmt).QueryRowContext( ctx, localpart, filterJSON, ).Scan(&existingFilterID) ->>>>>>> Stashed changes if err != nil && err != sql.ErrNoRows { return "", err } diff --git a/syncapi/storage/sqlite3/notification_data_table.go b/syncapi/storage/sqlite3/notification_data_table.go index e8c9c5f6e..6242898e1 100644 --- a/syncapi/storage/sqlite3/notification_data_table.go +++ b/syncapi/storage/sqlite3/notification_data_table.go @@ -90,13 +90,13 @@ func (r *notificationDataStatements) SelectUserUnreadCountsForRooms( for i := range roomIDs { params[i+1] = roomIDs[i] } - sql := strings.Replace(selectUserUnreadNotificationsForRooms, "($1)", sqlutil.QueryVariadic(len(params)), 1) + sql := strings.Replace(selectUserUnreadNotificationsForRooms, "($2)", sqlutil.QueryVariadicOffset(len(roomIDs), 1), 1) prep, err := r.db.PrepareContext(ctx, sql) if err != nil { return nil, err } defer internal.CloseAndLogIfError(ctx, prep, "SelectUserUnreadCountsForRooms: prep.close() failed") - rows, err := sqlutil.TxStmt(txn, prep).QueryContext(ctx, sql, params) + rows, err := sqlutil.TxStmt(txn, prep).QueryContext(ctx, params...) if err != nil { return nil, err }