Added: addContact(label,address) and delContact(address) to Main
This commit is contained in:
parent
02dd992766
commit
5bc60fea05
|
@ -1292,7 +1292,39 @@ class Main:
|
||||||
queryreturn = shared.sqlReturnQueue.get()
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
shared.sqlSubmitQueue.put('commit')
|
shared.sqlSubmitQueue.put('commit')
|
||||||
shared.sqlLock.release()
|
shared.sqlLock.release()
|
||||||
|
|
||||||
|
def addContact(self,label,address):
|
||||||
|
|
||||||
|
#Add Address to Address Book
|
||||||
|
shared.sqlLock.acquire()
|
||||||
|
t = (address,)
|
||||||
|
shared.sqlSubmitQueue.put('''select * from addressbook where address=?''')
|
||||||
|
shared.sqlSubmitQueue.put(t)
|
||||||
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
|
shared.sqlLock.release()
|
||||||
|
|
||||||
|
if queryreturn != []:
|
||||||
|
return 'AddressAlreadyInsideError'
|
||||||
|
|
||||||
|
t = (label, address)
|
||||||
|
shared.sqlLock.acquire()
|
||||||
|
shared.sqlSubmitQueue.put('''INSERT INTO addressbook VALUES (?,?)''')
|
||||||
|
shared.sqlSubmitQueue.put(t)
|
||||||
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
|
shared.sqlSubmitQueue.put('commit')
|
||||||
|
shared.sqlLock.release()
|
||||||
|
|
||||||
|
def delContact(self,address):
|
||||||
|
|
||||||
|
shared.sqlLock.acquire()
|
||||||
|
t = (address,)
|
||||||
|
shared.sqlSubmitQueue.put('''delete from addressbook where address=?''')
|
||||||
|
shared.sqlSubmitQueue.put(t)
|
||||||
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
|
shared.sqlLock.release()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
mainprogram = Main()
|
mainprogram = Main()
|
||||||
mainprogram.start()
|
mainprogram.start()
|
||||||
|
|
Reference in New Issue
Block a user