-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: return valid MsgId from receive_imf() when the message is replaced
receive_imf() calls add_parts() which INSERTs or UPDATEs the message using UPSERT [1]. It then uses last_insert_rowid() to get the ID of the inserted message. However, it is incorrect to use last_insert_rowid() if an UPDATE was executed instead of INSERT. The solution is to use `RETURNING id` clause to make the UPSERT statement return message ID in any case [2]. The fix is tested in test_webxdc_update_for_not_downloaded_instance() and with a debug_assert!. [1] https://www.sqlite.org/lang_UPSERT.html [2] https://sqlite.org/forum/forumpost/9ce3bc1c4a85c15f
- Loading branch information
Showing
2 changed files
with
14 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters