def iterkeys(self): """Iterate for every key in an abstract database object.""" if not tc.adb_iterinit(self.db): self._raise('Error initializing the iterator of an abstract ' \ 'database object.') while True: key = tc.adb_iternext2(self.db) if not key: break yield key.value
def iterkeys(self, as_type=None): """Iterate for every key in an abstract database object.""" if not tc.adb_iterinit(self.db): self._raise('Error initializing the iterator of an abstract ' \ 'database object.') while True: c_key, c_key_len = tc.adb_iternext(self.db) if not c_key: break key = util.deserialize(c_key, c_key_len, as_type) yield key
def iteritems(self): """Iterate for every key / value in an abstract database object.""" if not tc.adb_iterinit(self.db): self._raise('Error initializing the iterator of an abstract ' \ 'database object.') while True: key = tc.adb_iternext2(self.db) if not key: break value = tc.adb_get2(self.db, key) yield (key.value, value.value)
def iteritems(self, key_type=None, value_type=None): """Iterate for every key / value in an abstract database object.""" if not tc.adb_iterinit(self.db): self._raise('Error initializing the iterator of an abstract ' \ 'database object.') while True: c_key, c_key_len = tc.adb_iternext(self.db) if not c_key: break (c_value, c_value_len) = tc.adb_get(self.db, c_key, c_key_len) key = util.deserialize(c_key, c_key_len, key_type) value = util.deserialize(c_value, c_value_len, value_type) yield (key, value)