Skip to content

Commit a3cdc28

Browse files
committed
Fixed crash on sql query.
1 parent 997a8ff commit a3cdc28

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/bitmessageqt/__init__.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -515,16 +515,17 @@ def loadSent(self, where="", what=""):
515515

516516
sqlQuery = '''
517517
SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime
518-
FROM sent WHERE folder="sent" AND %s LIKE "%s"
518+
FROM sent WHERE folder="sent" AND %s LIKE ?
519519
ORDER BY lastactiontime
520-
''' % (where, what)
520+
''' % (where,)
521521

522522
while self.ui.tableWidgetSent.rowCount() > 0:
523523
self.ui.tableWidgetSent.removeRow(0)
524524

525+
t = (what,)
525526
shared.sqlLock.acquire()
526527
shared.sqlSubmitQueue.put(sqlQuery)
527-
shared.sqlSubmitQueue.put('')
528+
shared.sqlSubmitQueue.put(t)
528529
queryreturn = shared.sqlReturnQueue.get()
529530
shared.sqlLock.release()
530531
for row in queryreturn:
@@ -641,18 +642,19 @@ def loadInbox(self, where="", what=""):
641642

642643
sqlQuery = '''
643644
SELECT msgid, toaddress, fromaddress, subject, received, message, read
644-
FROM inbox WHERE folder="inbox" AND %s LIKE "%s"
645+
FROM inbox WHERE folder="inbox" AND %s LIKE ?
645646
ORDER BY received
646-
''' % (where, what)
647+
''' % (where,)
647648

648649
while self.ui.tableWidgetInbox.rowCount() > 0:
649650
self.ui.tableWidgetInbox.removeRow(0)
650651

651652
font = QFont()
652653
font.setBold(True)
654+
t = (what,)
653655
shared.sqlLock.acquire()
654656
shared.sqlSubmitQueue.put(sqlQuery)
655-
shared.sqlSubmitQueue.put('')
657+
shared.sqlSubmitQueue.put(t)
656658
queryreturn = shared.sqlReturnQueue.get()
657659
shared.sqlLock.release()
658660
for row in queryreturn:

0 commit comments

Comments
 (0)