24
24
HP_SHARE *share=info->s;
25
26
DBUG_ENTER("heap_rnext");
27
28
if (info->lastinx < 0)
28
29
DBUG_RETURN(my_errno=HA_ERR_WRONG_INDEX);
30
if (info->current_hash_ptr)
31
pos= _hp_search_next(info,share->keydef+info->lastinx, info->lastkey,
32
info->current_hash_ptr);
31
keyinfo = share->keydef + info->lastinx;
32
if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
34
heap_rb_param custom_arg;
37
pos = tree_search_next(&keyinfo->rb_tree, &info->last_pos,
38
offsetof(TREE_ELEMENT, left),
39
offsetof(TREE_ELEMENT, right));
42
custom_arg.keyseg = keyinfo->seg;
43
custom_arg.key_length = info->lastkey_len;
44
custom_arg.search_flag = SEARCH_SAME | SEARCH_FIND;
45
pos = tree_search_key(&keyinfo->rb_tree, info->lastkey, info->parents,
46
&info->last_pos, info->last_find_flag, &custom_arg);
50
memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos),
52
info->current_ptr = pos;
56
my_errno = HA_ERR_KEY_NOT_FOUND;
35
if (!info->current_ptr && (info->update & HA_STATE_NEXT_FOUND))
61
if (info->current_hash_ptr)
62
pos= hp_search_next(info, keyinfo, info->lastkey,
63
info->current_hash_ptr);
37
pos=0; /* Read next after last */
38
my_errno=HA_ERR_KEY_NOT_FOUND;
66
if (!info->current_ptr && (info->update & HA_STATE_NEXT_FOUND))
68
pos=0; /* Read next after last */
69
my_errno=HA_ERR_KEY_NOT_FOUND;
71
else if (!info->current_ptr) /* Deleted or first call */
72
pos= hp_search(info, keyinfo, info->lastkey, 0);
74
pos= hp_search(info, keyinfo, info->lastkey, 1);
40
else if (!info->current_ptr) /* Deleted or first call */
41
pos= _hp_search(info,share->keydef+info->lastinx, info->lastkey, 0);
43
pos= _hp_search(info,share->keydef+info->lastinx, info->lastkey, 1);
48
79
info->update=HA_STATE_NEXT_FOUND; /* For heap_rprev */