def gets(self): method_name = 'FileMapper.gets' log.info('{}: initialization.'.format(method_name)) files = [] for db_file in Files.select(): files.append(self.mapper(db_file)) log.info('{}: end.'.format(method_name)) return files
def gets(self): method_name = 'FileMapper.gets' log.info('{}: initialization.'.format(method_name)) files = [] for db_file in Files.select(): files.append(self.mapper(db_file)); log.info('{}: end.'.format(method_name)) return files
def update(self, file_object): method_name = 'FileMapper.update' log.info('{}: initialization.'.format(method_name)) query = Files.update(parallel_file_id=file_object.parallel_file_id, name=file_object.name, size=file_object.size, modified=file_object.modified, language_id=file_object.language_id).where(Files.id==file_object.id) log.info('{}: end.'.format(method_name)) if query.execute() != 1: return True else: return False
def insert(self, file_object): method_name = 'FileMapper.insert' log.info('{}: initialization.'.format(method_name)) query = Files.insert(parallel_file_id=file_object.parallel_file_id, name=file_object.name, size=file_object.size, modified=file_object.modified, language_id=file_object.language_id) file_object.id = query.execute() # Return new id log.info('{}: end.'.format(method_name)) return file_object
def update(self, file_object): method_name = 'FileMapper.update' log.info('{}: initialization.'.format(method_name)) query = Files.update(parallel_file_id=file_object.parallel_file_id, name=file_object.name, size=file_object.size, modified=file_object.modified, language_id=file_object.language_id).where( Files.id == file_object.id) log.info('{}: end.'.format(method_name)) if query.execute() != 1: return True else: return False
def get(self, file_id): method_name = 'FileMapper.get' log.info('{}: initialization.'.format(method_name)) try: file_object = Files.get(Files.id==file_id) log.info('{}: end.'.format(method_name)) return self.mapper(file_object) except Exception as e: log.info('FileDoesNotExist errno={}: strerror{}.'.format(e.errno, e.strerror)) log.info('{}: end.'.format(method_name)) raise Exception('FileDoesNotExist errno={}: strerror{}.'.format(e.errno, e.strerror))
def get(self, file_id): method_name = 'FileMapper.get' log.info('{}: initialization.'.format(method_name)) try: file_object = Files.get(Files.id == file_id) log.info('{}: end.'.format(method_name)) return self.mapper(file_object) except Exception as e: log.info('FileDoesNotExist errno={}: strerror{}.'.format( e.errno, e.strerror)) log.info('{}: end.'.format(method_name)) raise Exception('FileDoesNotExist errno={}: strerror{}.'.format( e.errno, e.strerror))