16#include "myisam_priv.h"
17#include <drizzled/message/table.h>
28int mi_rnext(MI_INFO *info,
unsigned char *buf,
int inx)
33 if ((inx = _mi_check_index(info,inx)) < 0)
36 if (info->lastpos == HA_OFFSET_ERROR && info->update & HA_STATE_PREV_FOUND)
39 if (fast_mi_readinfo(info))
41 changed=_mi_test_if_changed(info);
44 switch(info->s->keyinfo[inx].key_alg){
45 case message::Table::Index::BTREE:
47 error=_mi_search_first(info,info->s->keyinfo+inx,
48 info->s->state.key_root[inx]);
54 switch (info->s->keyinfo[inx].key_alg) {
55 case message::Table::Index::BTREE:
58 error= _mi_search_next(info,info->s->keyinfo+inx,info->lastkey,
59 info->lastkey_length,flag,
60 info->s->state.key_root[inx]);
62 error= _mi_search(info,info->s->keyinfo+inx,info->lastkey,
63 USE_WHOLE_KEY,flag, info->s->state.key_root[inx]);
70 while ((info->s->concurrent_insert &&
71 info->lastpos >= info->state->data_file_length) ||
72 (info->index_cond_func &&
73 !(res= mi_check_index_cond(info, inx, buf))))
76 if ((error=_mi_search_next(info,info->s->keyinfo+inx,
80 info->s->state.key_root[inx])))
83 if (!error && res == 2)
85 info->lastpos= HA_OFFSET_ERROR;
86 return(errno= HA_ERR_END_OF_FILE);
91 info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
92 info->update|= HA_STATE_NEXT_FOUND;
96 if (errno == HA_ERR_KEY_NOT_FOUND)
97 errno=HA_ERR_END_OF_FILE;
101 return(info->lastpos==HA_OFFSET_ERROR ? errno : 0);
103 else if (!(*info->read_record)(info,info->lastpos,buf))
105 info->update|= HA_STATE_AKTIV;
TODO: Rename this file - func.h is stupid.