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