fixes to new SQL refactoring

This commit is contained in:
Jonathan Warren 2013-09-02 23:14:43 -04:00
parent ea3cf9e00e
commit f64461feb0
3 changed files with 4 additions and 8 deletions

View File

@ -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)

View File

@ -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', ''))

View File

@ -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 == ():