Added start blocke on no database connection available

This commit is contained in:
2024-12-14 20:28:04 +01:00
parent 559ad1b882
commit 903a2b8dc1
13 changed files with 161 additions and 41 deletions

View File

@@ -7,18 +7,22 @@ class ContactDAO:
def __init__(self):
#print(f"*** File: {__file__}, __init__()")
self.__con = DbManager().getConnection()
self.__cur = self.__con.cursor()
if self.__con:
self.__cur = self.__con.cursor()
def getContacts(self):
print(f"*** File: {__file__}, getContacts()")
def addContact(self, contact, enc_key):
try:
self.__cur.callproc("addContactPerson", (enc_key, json.dumps(contact),))
self.__con.commit()
self.__cur.callproc("getLastInsertId")
contact_id = self.__cur.fetchone()
return contact_id[0]
if self.__cur:
self.__cur.callproc("addContactPerson", (enc_key, json.dumps(contact),))
self.__con.commit()
self.__cur.callproc("getLastInsertId")
contact_id = self.__cur.fetchone()
return contact_id[0]
else:
return None
except mariadb.Error as e:
print("MDB: " + str(e))
except Exception as e: