From f64461feb0c899b0b85c87aa253c3f6d7b413d36 Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Mon, 2 Sep 2013 23:14:43 -0400 Subject: [PATCH] fixes to new SQL refactoring --- src/bitmessagemain.py | 8 +++----- src/bitmessageqt/__init__.py | 2 +- src/helper_sql.py | 2 -- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index 0da1fca5..cb44b7ad 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -441,8 +441,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): # Trash if in inbox table helper_inbox.trash(msgid) # Trash if in sent table - t = (msgid,) - sqlExecute('''UPDATE sent SET folder='trash' WHERE msgid=?''', t) + sqlExecute('''UPDATE sent SET folder='trash' WHERE msgid=?''', msgid) return 'Trashed message (assuming message existed).' elif method == 'trashInboxMessage': if len(params) == 0: @@ -454,8 +453,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): if len(params) == 0: raise APIError(0, 'I need parameters!') msgid = self._decode(params[0], "hex") - t = (msgid,) - sqlExecute('''UPDATE sent SET folder='trash' WHERE msgid=?''', t) + sqlExecute('''UPDATE sent SET folder='trash' WHERE msgid=?''', msgid) return 'Trashed sent message (assuming message existed).' elif method == 'trashSentMessageByAckData': # This API method should only be used when msgid is not available @@ -735,7 +733,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): readPosition = 16 # Nonce length + time length readPosition += decodeVarint(payload[readPosition:readPosition+10])[1] # Stream Number length t = (payload[readPosition:readPosition+20],hash) - sql.execute('''UPDATE inventory SET first20bytesofencryptedmessage=? WHERE hash=?; ''', t) + sql.execute('''UPDATE inventory SET first20bytesofencryptedmessage=? WHERE hash=?; ''', *t) queryreturn = sqlQuery('''SELECT payload FROM inventory WHERE first20bytesofencryptedmessage = ?''', requestedHash) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index a60053ea..2cdb2c97 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -1606,7 +1606,7 @@ class MyForm(QtGui.QMainWindow): t = ('', toAddress, ripe, fromAddress, subject, message, ackdata, int( time.time()), 'broadcastqueued', 1, 1, 'sent', 2) sqlExecute( - '''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''', t) + '''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''', *t) shared.workerQueue.put(('sendbroadcast', '')) diff --git a/src/helper_sql.py b/src/helper_sql.py index 9803b2c0..0353f9ae 100644 --- a/src/helper_sql.py +++ b/src/helper_sql.py @@ -7,7 +7,6 @@ sqlLock = threading.Lock() def sqlQuery(sqlStatement, *args): sqlLock.acquire() - print 'sqlQuery args are:', args sqlSubmitQueue.put(sqlStatement) if args == (): @@ -22,7 +21,6 @@ def sqlQuery(sqlStatement, *args): def sqlExecute(sqlStatement, *args): sqlLock.acquire() - print 'sqlExecute args are:', args sqlSubmitQueue.put(sqlStatement) if args == ():