16 #include "myisam_priv.h"
27 int mi_rnext(
MI_INFO *info,
unsigned char *buf,
int inx)
32 if ((inx = _mi_check_index(info,inx)) < 0)
35 if (info->lastpos == HA_OFFSET_ERROR && info->update & HA_STATE_PREV_FOUND)
38 if (fast_mi_readinfo(info))
40 changed=_mi_test_if_changed(info);
43 switch(info->s->keyinfo[inx].key_alg){
44 case HA_KEY_ALG_BTREE:
46 error=_mi_search_first(info,info->s->keyinfo+inx,
47 info->s->state.key_root[inx]);
53 switch (info->s->keyinfo[inx].key_alg) {
54 case HA_KEY_ALG_BTREE:
57 error= _mi_search_next(info,info->s->keyinfo+inx,info->lastkey,
58 info->lastkey_length,flag,
59 info->s->state.key_root[inx]);
61 error= _mi_search(info,info->s->keyinfo+inx,info->lastkey,
62 USE_WHOLE_KEY,flag, info->s->state.key_root[inx]);
69 while ((info->s->concurrent_insert &&
70 info->lastpos >= info->state->data_file_length) ||
71 (info->index_cond_func &&
72 !(res= mi_check_index_cond(info, inx, buf))))
75 if ((error=_mi_search_next(info,info->s->keyinfo+inx,
79 info->s->state.key_root[inx])))
82 if (!error && res == 2)
84 info->lastpos= HA_OFFSET_ERROR;
85 return(errno= HA_ERR_END_OF_FILE);
90 info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
91 info->update|= HA_STATE_NEXT_FOUND;
95 if (errno == HA_ERR_KEY_NOT_FOUND)
96 errno=HA_ERR_END_OF_FILE;
100 return(info->lastpos==HA_OFFSET_ERROR ? errno : 0);
102 else if (!(*info->read_record)(info,info->lastpos,buf))
104 info->update|= HA_STATE_AKTIV;
TODO: Rename this file - func.h is stupid.