Made use of helper_sql.sqlExecuteChunked() also in on_action_InboxMarkUnread

This commit is contained in:
Dmitri Bogomolov 2018-01-25 23:22:15 +02:00
parent 80fdb08f03
commit 6fca1631af
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -2784,9 +2784,13 @@ class MyForm(settingsmixin.SMainWindow):
tableWidget.item(currentRow, 1).setUnread(True) tableWidget.item(currentRow, 1).setUnread(True)
tableWidget.item(currentRow, 2).setUnread(True) tableWidget.item(currentRow, 2).setUnread(True)
tableWidget.item(currentRow, 3).setFont(font) tableWidget.item(currentRow, 3).setFont(font)
#sqlite requires the exact number of ?s to prevent injection # for 1081
rowcount = sqlExecute('''UPDATE inbox SET read=0 WHERE msgid IN (%s) AND read=1''' % ( idCount = len(inventoryHashesToMarkUnread)
"?," * len(inventoryHashesToMarkUnread))[:-1], *inventoryHashesToMarkUnread) rowcount = sqlExecuteChunked(
'''UPDATE inbox SET read=0 WHERE msgid IN ({0}) AND read=1''',
idCount, *inventoryHashesToMarkUnread
)
if rowcount == 1: if rowcount == 1:
# performance optimisation # performance optimisation
self.propagateUnreadCount(tableWidget.item(currentRow, 1 if tableWidget.item(currentRow, 1).type == AccountMixin.SUBSCRIPTION else 0).data(Qt.UserRole), self.getCurrentFolder()) self.propagateUnreadCount(tableWidget.item(currentRow, 1 if tableWidget.item(currentRow, 1).type == AccountMixin.SUBSCRIPTION else 0).data(Qt.UserRole), self.getCurrentFolder())