16#include "myisam_priv.h"
17#include <drizzled/message/table.h>
29int mi_rnext_same(MI_INFO *info,
unsigned char *buf)
32 uint32_t inx,not_used[2];
35 if ((
int) (inx=info->lastinx) < 0 || info->lastpos == HA_OFFSET_ERROR)
36 return(errno=HA_ERR_WRONG_INDEX);
37 keyinfo=info->s->keyinfo+inx;
38 if (fast_mi_readinfo(info))
41 switch (keyinfo->key_alg)
43 case message::Table::Index::BTREE:
45 if (!(info->update & HA_STATE_RNEXT_SAME))
48 memcpy(info->lastkey2,info->lastkey,info->last_rkey_length);
52 if ((error=_mi_search_next(info,keyinfo,info->lastkey,
53 info->lastkey_length,SEARCH_BIGGER,
54 info->s->state.key_root[inx])))
56 if (ha_key_cmp(keyinfo->seg, info->lastkey, info->lastkey2,
57 info->last_rkey_length, SEARCH_FIND, not_used))
60 errno=HA_ERR_END_OF_FILE;
61 info->lastpos= HA_OFFSET_ERROR;
65 if (info->lastpos < info->state->data_file_length &&
66 (!info->index_cond_func || mi_check_index_cond(info, inx, buf)))
71 info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
72 info->update|= HA_STATE_NEXT_FOUND | HA_STATE_RNEXT_SAME;
76 if (errno == HA_ERR_KEY_NOT_FOUND)
77 errno=HA_ERR_END_OF_FILE;
81 return(info->lastpos==HA_OFFSET_ERROR ? errno : 0);
83 else if (!(*info->read_record)(info,info->lastpos,buf))
85 info->update|= HA_STATE_AKTIV;
TODO: Rename this file - func.h is stupid.