Added start blocke on no database connection available
This commit is contained in:
@@ -4,15 +4,20 @@ from ..PyqcrmFlags import PyqcrmFlags
|
||||
import mariadb
|
||||
|
||||
class UserDAO:
|
||||
__cursor = None
|
||||
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 createUser(self, username, password, info, role= PyqcrmFlags.USER):
|
||||
user_created = True
|
||||
user_created = False
|
||||
try:
|
||||
self.__cur.callproc("createUser", (username, password, info, role))
|
||||
self.__con.commit()
|
||||
if self.__cur:
|
||||
self.__cur.callproc("createUser", (username, password, info, role))
|
||||
self.__con.commit()
|
||||
user_created = True
|
||||
except mariadb.Error as e:
|
||||
print(f"Error: {e}")
|
||||
print(e.errno)
|
||||
@@ -21,8 +26,11 @@ class UserDAO:
|
||||
return user_created
|
||||
|
||||
def getUser(self, username):
|
||||
self.__cur.callproc("getUser", (username,))
|
||||
return self.__cur.fetchone()
|
||||
if self.__cur:
|
||||
self.__cur.callproc("getUser", (username,))
|
||||
return self.__cur.fetchone()
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user