Example #1
0
 def executeQuery(self, sql):
     LogBase.writeTextDaybyDay(self.config['logPath']['sql'], sql, 'sql')
     cur = self.conn.cursor()
     cur._defer_warnings = True
     #cur.execute(sql)
     self.__clearP()
     return cur
Example #2
0
    def execute(self, sql):
        LogBase.writeTextDaybyDay(self.config['logPath']['sql'], sql, 'sql')
        cur = self.conn.cursor()
        cur._defer_warnings = True
        #cur.execute(sql)
        self.__clearP()

        result = {}
        result['affected_rows'] = cur._result.affected_rows
        result['insert_id'] = cur._result.insert_id

        return result
Example #3
0
    def __writeText(self, path, text):

        if self.config['print']['logOrErrorPrint']:
            print(text)

        LogBase.writeTextDaybyDay(path, text)
Example #4
0
    def __init__(self):

        self.config = json.loads(LogBase.readText('./config.json'))
Example #5
0
 def __writeText(self, path, text):
     if self.config['print']['logOrErrorPrint']:
         text = time.strftime('%Y-%m-%d %H:%M:%S',
                              time.localtime(
                                  time.time())) + "\t" + str(text)
     LogBase.writeTextDaybyDay(path, text)