This commit is contained in:
Neil Alexander 2022-09-28 10:01:41 +01:00
parent 1f4b038a6e
commit a086b15590
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 2 additions and 12 deletions

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}