def execute(self, sql, params): return MySqlManager.instance().execute(sql, params)
def selectOne(self, sql): result = MySqlManager.instance().select(sql) if result is None or len(result) < 1: return None return result[0]
def delete(self, sql): return MySqlManager.instance().update(sql)
def insert(self, sql): return MySqlManager.instance().insert(sql)
def count(self, sql): return len(MySqlManager.instance().select(sql))
def select(self, sql): return MySqlManager.instance().select(sql)
def updateQuery(self, sql): return MySqlManager.instance().update(sql)
def upsertQueries(self, queries): return MySqlManager.instance().insertQueries(queries)
def nonSelect(self, sql): return MySqlManager.instance().nonSelect(sql)
def initMysql(self, cbAndEvt): MySqlManager.instance().initMySql(appconfig.dbhost, appconfig.dbport, appconfig.dbuser, appconfig.dbpassword, cbAndEvt, poolCount=4)
def useDatabase(self, dbname): sql = f"USE {dbname}" return MySqlManager.instance().nonSelect(sql)
def createDatabase(self, dbname): sql = f"CREATE DATABASE {dbname}" return MySqlManager.instance().nonSelect(sql)
def existDatabase(self, dbname): sql = f"SHOW DATABASES LIKE '{dbname}'" rows = MySqlManager.instance().select(sql) return rows is not None
def closeMySql(self): MySqlManager.instance().closeMySql()
def initMySqlWithDatabase(self, host, port, user, passwd, dbname, cbAndEvt, poolCount): MySqlManager.instance().initMySqlWithDatabase(host, port, user, passwd, dbname, cbAndEvt, poolCount=poolCount) pass