From a3cdc28bbf156795f7ebbf04d2ee0e04a78440f7 Mon Sep 17 00:00:00 2001 From: Rainulf Pineda Date: Fri, 12 Jul 2013 05:02:21 -0400 Subject: [PATCH] Fixed crash on sql query. --- src/bitmessageqt/__init__.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 92209bbe..316f4205 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -515,16 +515,17 @@ class MyForm(QtGui.QMainWindow): sqlQuery = ''' SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime - FROM sent WHERE folder="sent" AND %s LIKE "%s" + FROM sent WHERE folder="sent" AND %s LIKE ? ORDER BY lastactiontime - ''' % (where, what) + ''' % (where,) while self.ui.tableWidgetSent.rowCount() > 0: self.ui.tableWidgetSent.removeRow(0) + t = (what,) shared.sqlLock.acquire() shared.sqlSubmitQueue.put(sqlQuery) - shared.sqlSubmitQueue.put('') + shared.sqlSubmitQueue.put(t) queryreturn = shared.sqlReturnQueue.get() shared.sqlLock.release() for row in queryreturn: @@ -641,18 +642,19 @@ class MyForm(QtGui.QMainWindow): sqlQuery = ''' SELECT msgid, toaddress, fromaddress, subject, received, message, read - FROM inbox WHERE folder="inbox" AND %s LIKE "%s" + FROM inbox WHERE folder="inbox" AND %s LIKE ? ORDER BY received - ''' % (where, what) + ''' % (where,) while self.ui.tableWidgetInbox.rowCount() > 0: self.ui.tableWidgetInbox.removeRow(0) font = QFont() font.setBold(True) + t = (what,) shared.sqlLock.acquire() shared.sqlSubmitQueue.put(sqlQuery) - shared.sqlSubmitQueue.put('') + shared.sqlSubmitQueue.put(t) queryreturn = shared.sqlReturnQueue.get() shared.sqlLock.release() for row in queryreturn: