Skip to content

Commit

Permalink
fix: internal error on pin/unpin (usememos#4332)
Browse files Browse the repository at this point in the history
  • Loading branch information
AvoidMe authored Jan 31, 2025
1 parent 5ec3150 commit 7ed3a12
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions store/db/mysql/memo.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ func (d *DB) UpdateMemo(ctx context.Context, update *store.UpdateMemo) error {
}
set, args = append(set, "`payload` = ?"), append(args, string(payloadBytes))
}
if len(args) == 0 {
return nil
}
args = append(args, update.ID)

stmt := "UPDATE `memo` SET " + strings.Join(set, ", ") + " WHERE `id` = ?"
Expand Down
3 changes: 3 additions & 0 deletions store/db/postgres/memo.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ func (d *DB) UpdateMemo(ctx context.Context, update *store.UpdateMemo) error {
}
set, args = append(set, "payload = "+placeholder(len(args)+1)), append(args, string(payloadBytes))
}
if len(args) == 0 {
return nil
}

stmt := `UPDATE memo SET ` + strings.Join(set, ", ") + ` WHERE id = ` + placeholder(len(args)+1)
args = append(args, update.ID)
Expand Down
3 changes: 3 additions & 0 deletions store/db/sqlite/memo.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ func (d *DB) UpdateMemo(ctx context.Context, update *store.UpdateMemo) error {
}
set, args = append(set, "`payload` = ?"), append(args, string(payloadBytes))
}
if len(args) == 0 {
return nil
}
args = append(args, update.ID)

stmt := "UPDATE `memo` SET " + strings.Join(set, ", ") + " WHERE `id` = ?"
Expand Down

0 comments on commit 7ed3a12

Please sign in to comment.