示例#1
0
 def delete(self):
     if self.__exist__ == False:
         logging.warning('删除失败,__exist__ = False')
         return False  #不是从表中取出的数据, 直接返回False
     sql_cmd = self.operation.delete(self)  # 生成sql语句
     logging.info('删除   %s' % sql_cmd)
     return executeSQL(sql_cmd)
示例#2
0
 def createTable(cls):  # 创建表
     sql_cmd = cls.operation.createTable(cls)  #生成sql语句
     logging.info('创建表=>%s' % sql_cmd)
     return executeSQL(sql_cmd)
示例#3
0
 def update(self):
     if self.__exist__ == False:
         return self.save()  #不是从表中取出的数据, 更新时返回保存的sql名
     sql_cmd = self.operation.update(self)  # 生成sql语句
     logging.info('更新   %s' % sql_cmd)
     return executeSQL(sql_cmd)
示例#4
0
 def deleteOne(cls, *args, **kwargs):
     sql_cmd = cls.operation.deleteOne(cls, *args, **kwargs)  # 生成sql语句
     logging.info('deleteOne   %s' % sql_cmd)
     return executeSQL(sql_cmd)
示例#5
0
 def deleteAll(cls, *args, **kwargs):  # condition为None时删除所有
     sql_cmd = cls.operation.deleteAll(cls, *args, **kwargs)  # 生成sql语句
     logging.info('deleteAll   %s' % sql_cmd)
     return executeSQL(sql_cmd)
示例#6
0
 def save(self):
     sql_cmd = self.operation.save(self)  # 生成sql语句
     logging.info('插入   %s' % sql_cmd)
     return executeSQL(sql_cmd)
示例#7
0
 def updateOne(cls, mappings, *args, **kwargs):
     sql_cmd = cls.operation.updateOne(cls, mappings, *args,
                                       **kwargs)  # 生成sql语句
     logging.info('updateOne   %s' % sql_cmd)
     return executeSQL(sql_cmd)