V0.6 #852
|
@ -546,10 +546,12 @@ class sqlThread(threading.Thread):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
parameters = shared.sqlSubmitQueue.get()
|
parameters = shared.sqlSubmitQueue.get()
|
||||||
|
rowcount = 0
|
||||||
# print 'item', item
|
# print 'item', item
|
||||||
# print 'parameters', parameters
|
# print 'parameters', parameters
|
||||||
try:
|
try:
|
||||||
self.cur.execute(item, parameters)
|
self.cur.execute(item, parameters)
|
||||||
|
rowcount = self.cur.rowcount
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(while cur.execute) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal('(while cur.execute) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||||
|
@ -564,5 +566,5 @@ class sqlThread(threading.Thread):
|
||||||
|
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
shared.sqlReturnQueue.put(self.cur.fetchall())
|
shared.sqlReturnQueue.put((self.cur.fetchall(), rowcount))
|
||||||
# shared.sqlSubmitQueue.task_done()
|
# shared.sqlSubmitQueue.task_done()
|
||||||
|
|
|
@ -16,7 +16,7 @@ def sqlQuery(sqlStatement, *args):
|
||||||
else:
|
else:
|
||||||
sqlSubmitQueue.put(args)
|
sqlSubmitQueue.put(args)
|
||||||
|
|
||||||
queryreturn = sqlReturnQueue.get()
|
queryreturn, rowcount = sqlReturnQueue.get()
|
||||||
sqlLock.release()
|
sqlLock.release()
|
||||||
|
|
||||||
return queryreturn
|
return queryreturn
|
||||||
|
@ -30,9 +30,10 @@ def sqlExecute(sqlStatement, *args):
|
||||||
else:
|
else:
|
||||||
sqlSubmitQueue.put(args)
|
sqlSubmitQueue.put(args)
|
||||||
|
|
||||||
sqlReturnQueue.get()
|
queryreturn, rowcount = sqlReturnQueue.get()
|
||||||
sqlSubmitQueue.put('commit')
|
sqlSubmitQueue.put('commit')
|
||||||
sqlLock.release()
|
sqlLock.release()
|
||||||
|
return rowcount
|
||||||
|
|
||||||
def sqlStoredProcedure(procName):
|
def sqlStoredProcedure(procName):
|
||||||
sqlLock.acquire()
|
sqlLock.acquire()
|
||||||
|
|
Reference in New Issue
Block a user