Commit d0416ff9 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

extmod/modbtree: Actually implement end key support for .items().

parent 1babeb47
......@@ -153,6 +153,16 @@ STATIC mp_obj_t btree_iternext(mp_obj_t self_in) {
}
CHECK_ERROR(res);
if (self->end_key != mp_const_none) {
DBT end_key;
end_key.data = (void*)mp_obj_str_get_data(self->end_key, &end_key.size);
BTREE *t = self->db->internal;
if (t->bt_cmp(&key, &end_key) >= 0) {
self->end_key = MP_OBJ_NULL;
return MP_OBJ_STOP_ITERATION;
}
}
mp_obj_tuple_t *pair = mp_obj_new_tuple(2, NULL);
pair->items[0] = mp_obj_new_bytes(key.data, key.size);
pair->items[1] = mp_obj_new_bytes(val.data, val.size);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment