示例#1
0
 def flush(self, table_name):
     '''
     刷新字段数据
     '''
     fields = self.get_fields(table_name)
     if not fields:
         return False
     self.fields[table_name] = fields
     if self.db_fields_cache:
         Util.file(
             '.fields/%s/%s_%s_%s' %
             (self.host, self.__class__.__name__, self.dbname, table_name),
             fields)
示例#2
0
 def _check_table_info(self, table_name):
     # 只在第一次执行记录
     if table_name not in self.fields:
         # 如果数据表字段没有定义则自动获取
         if self.db_fields_cache:
             self.fields[table_name] = Util.file(
                 '.fields/%s/%s_%s_%s' %
                 (self.host, self.__class__.__name__, self.dbname,
                  table_name))
             if not self.fields[table_name]:
                 self.flush(table_name)
         else:
             # 每次都会读取数据表信息
             self.flush(table_name)