Added start blocke on no database connection available
This commit is contained in:
@@ -6,21 +6,30 @@ from PySide6.QtCore import QObject, Signal
|
||||
|
||||
class BusinessDAO(QObject):
|
||||
newBusinessAdded = Signal()
|
||||
|
||||
__cur = None
|
||||
|
||||
def __init__(self):
|
||||
#print(f"*** File: {__file__}, init()")
|
||||
super().__init__()
|
||||
self.__con = DbManager().getConnection()
|
||||
self.__cur = self.__con.cursor()
|
||||
if self.__con:
|
||||
self.__cur = self.__con.cursor()
|
||||
|
||||
def getBusiness(self, enc_key, criterion = "Alle"):
|
||||
self.__cur.callproc("getCustomerView", (enc_key, criterion,))
|
||||
self.__all_cols = [desc[0] for desc in self.__cur.description]
|
||||
return self.__cur.fetchall(), self.__all_cols
|
||||
if self.__cur:
|
||||
self.__cur.callproc("getCustomerView", (enc_key, criterion,))
|
||||
self.__all_cols = [desc[0] for desc in self.__cur.description]
|
||||
return self.__cur.fetchall(), self.__all_cols
|
||||
else:
|
||||
return None, None
|
||||
|
||||
def addBusiness(self, data, contact_id):
|
||||
try:
|
||||
self.__cur.callproc("addBusiness", (json.dumps(data), contact_id))
|
||||
self.__con.commit()
|
||||
self.newBusinessAdded.emit()
|
||||
if self.__cur:
|
||||
self.__cur.callproc("addBusiness", (json.dumps(data), contact_id))
|
||||
self.__con.commit()
|
||||
self.newBusinessAdded.emit()
|
||||
|
||||
except mariadb.Error as e:
|
||||
print(str(e))
|
||||
|
||||
Reference in New Issue
Block a user