SQL statement error when deleting in QT interface #1504

Closed
opened 2019-08-16 08:17:16 +02:00 by PeterSurda · 5 comments
PeterSurda commented 2019-08-16 08:17:16 +02:00 (Migrated from github.com)

2019-08-16 08:12:03,023 - CRITICAL - Major error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error mess age or post it in the forum! Error occurred while trying to execute statement: " DELETE FROM inbox" Here are the parameters; you might want to censor this data with asterisks (***) as it can contain private information: ('REDACTED',). Here is the actual error message thrown by the sqlThread: Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied.

There was an independent report in a chan, but I somehow triggered it as well. @g1itch you did some refactoring with this recently, can you check it out?

`2019-08-16 08:12:03,023 - CRITICAL - Major error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error mess age or post it in the forum! Error occurred while trying to execute statement: " DELETE FROM inbox" Here are the parameters; you might want to censor this data with asterisks (***) as it can contain private information: ('REDACTED',). Here is the actual error message thrown by the sqlThread: Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied.` There was an independent report in a chan, but I somehow triggered it as well. @g1itch you did some refactoring with this recently, can you check it out?
g1itch commented 2019-08-16 10:54:05 +02:00 (Migrated from github.com)

Where it appeared? While deleting from which folder? Because I cannot reproduce it by deleting from chan's inbox. And more strange there is no result for grep -r " DELETE FROM inbox" src. I cannot found delete statement with leading space.

Where it appeared? While deleting from which folder? Because I cannot reproduce it by deleting from chan's inbox. And more strange there is no result for `grep -r " DELETE FROM inbox" src`. I cannot found delete statement with leading space.
g1itch commented 2019-08-16 11:04:19 +02:00 (Migrated from github.com)

Oh, I see. You are deleting from trash. Maybe some regression in 0c1e5169

Oh, I see. You are deleting from trash. Maybe some regression in 0c1e5169
PeterSurda commented 2019-08-16 11:11:39 +02:00 (Migrated from github.com)

Yes, I believe it was from trash, but I'm not 100% sure.

Yes, I believe it was from trash, but I'm not 100% sure.
g1itch commented 2019-08-16 11:12:35 +02:00 (Migrated from github.com)
index 507e6ca0..2c5f1485 100644
--- a/src/bitmessageqt/__init__.py
+++ b/src/bitmessageqt/__init__.py
@@ -3270,8 +3270,8 @@ class MyForm(settingsmixin.SMainWindow):
             tableWidget.model().removeRows(r.topRow(), r.bottomRow()-r.topRow()+1)
         idCount = len(inventoryHashesToTrash)
         sqlExecuteChunked(
-            "DELETE FROM inbox" if folder == "trash" or shifted else
-            "UPDATE inbox SET folder='trash'"
+            ("DELETE FROM inbox" if folder == "trash" or shifted else
+             "UPDATE inbox SET folder='trash'") +
             " WHERE msgid IN ({0})", idCount, *inventoryHashesToTrash)
         tableWidget.selectRow(0 if currentRow == 0 else currentRow - 1)
         tableWidget.setUpdatesEnabled(True)

String literals does not stick together in this case as I expected. My bad.

```diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 507e6ca0..2c5f1485 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -3270,8 +3270,8 @@ class MyForm(settingsmixin.SMainWindow): tableWidget.model().removeRows(r.topRow(), r.bottomRow()-r.topRow()+1) idCount = len(inventoryHashesToTrash) sqlExecuteChunked( - "DELETE FROM inbox" if folder == "trash" or shifted else - "UPDATE inbox SET folder='trash'" + ("DELETE FROM inbox" if folder == "trash" or shifted else + "UPDATE inbox SET folder='trash'") + " WHERE msgid IN ({0})", idCount, *inventoryHashesToTrash) tableWidget.selectRow(0 if currentRow == 0 else currentRow - 1) tableWidget.setUpdatesEnabled(True) ``` String literals does not stick together in this case as I expected. My bad.
PeterSurda commented 2019-08-16 11:13:46 +02:00 (Migrated from github.com)

That makes sense.

That makes sense.
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Bitmessage/PyBitmessage-2024-12-21#1504
No description provided.