16 #include "myisamdef.h"
32 DBUG_ENTER(
"mi_rnext_same");
34 if ((
int) (inx=info->lastinx) < 0 || info->lastpos == HA_OFFSET_ERROR)
35 DBUG_RETURN(my_errno=HA_ERR_WRONG_INDEX);
36 keyinfo=info->s->keyinfo+inx;
37 if (fast_mi_readinfo(info))
38 DBUG_RETURN(my_errno);
40 if (info->s->concurrent_insert)
43 switch (keyinfo->key_alg)
45 #ifdef HAVE_RTREE_KEYS
46 case HA_KEY_ALG_RTREE:
47 if ((error=rtree_find_next(info,inx,
48 myisam_read_vec[info->last_key_func])))
51 my_errno=HA_ERR_END_OF_FILE;
52 info->lastpos= HA_OFFSET_ERROR;
57 case HA_KEY_ALG_BTREE:
59 if (!(info->update & HA_STATE_RNEXT_SAME))
62 memcpy(info->lastkey2,info->lastkey,info->last_rkey_length);
66 if ((error=_mi_search_next(info,keyinfo,info->lastkey,
67 info->lastkey_length,SEARCH_BIGGER,
68 info->s->state.key_root[inx])))
70 if (ha_key_cmp(keyinfo->seg, info->lastkey, info->lastkey2,
71 info->last_rkey_length, SEARCH_FIND, not_used))
74 my_errno=HA_ERR_END_OF_FILE;
75 info->lastpos= HA_OFFSET_ERROR;
79 if (info->lastpos < info->state->data_file_length &&
80 (!info->index_cond_func || mi_check_index_cond(info, inx, buf)))
84 if (info->s->concurrent_insert)
87 info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
88 info->update|= HA_STATE_NEXT_FOUND | HA_STATE_RNEXT_SAME;
92 if (my_errno == HA_ERR_KEY_NOT_FOUND)
93 my_errno=HA_ERR_END_OF_FILE;
97 DBUG_RETURN(info->lastpos==HA_OFFSET_ERROR ? my_errno : 0);
99 else if (!(*info->read_record)(info,info->lastpos,buf))
101 info->update|= HA_STATE_AKTIV;
104 DBUG_RETURN(my_errno);