def init_table(self): q = CollectionQueries(self.db, self.name) if not q.table_exists(): q.create_table() q.finish()
def has(self, key): q = CollectionQueries(self.db, self.name) r = q.exists(key) q.finish() return r
def keys(self): q = CollectionQueries(self.db, self.name) key_list = q.list_keys() q.finish() return key_list
def fill_entry(self, entry): q = CollectionQueries(self.db, self.name) key = entry.key() if key is None: raise CollectionError("Cannot fill entry with unkown key") value = q.read(key) entry.decode(value) q.finish()
def save_entry(self, entry): q = CollectionQueries(self.db, self.name) q.update(entry.key(), entry.encode()) q.finish()
def clear(self, key): q = CollectionQueries(self.db, self.name) q.remove(key) q.finish()