Commit 74483532 authored by unknown's avatar unknown

replace mi_rrnd() in myrg_rkey family to more intelligent (HA_KEYREAD-aware) read function

parent 8fac4385
......@@ -29,3 +29,5 @@ extern pthread_mutex_t THR_LOCK_open;
#endif
int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag);
int _myrg_mi_read_record(MI_INFO *info, byte *buf);
......@@ -14,8 +14,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Read record based on a key */
#include "myrg_def.h"
static int queue_key_cmp(void *keyseg, byte *a, byte *b)
......@@ -55,3 +53,13 @@ int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag)
}
return error;
}
int _myrg_mi_read_record(MI_INFO *info, byte *buf)
{
if (!(*info->read_record)(info,info->lastpos,buf))
{
info->update|= HA_STATE_AKTIV; /* Record is read */
return 0;
}
return my_errno;
}
......@@ -45,5 +45,5 @@ int myrg_rfirst(MYRG_INFO *info, byte *buf, int inx)
return HA_ERR_END_OF_FILE;
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
return mi_rrnd(mi,buf,mi->lastpos);
return _myrg_mi_read_record(mi,buf);
}
......@@ -36,7 +36,7 @@
SerG
*/
int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key,
int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
uint key_len, enum ha_rkey_function search_flag)
{
byte *key_buff;
......@@ -83,5 +83,5 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key,
return HA_ERR_KEY_NOT_FOUND;
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
return mi_rrnd(mi,record,mi->lastpos);
return _myrg_mi_read_record(mi,buf);
}
......@@ -45,6 +45,6 @@ int myrg_rlast(MYRG_INFO *info, byte *buf, int inx)
return HA_ERR_END_OF_FILE;
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
return mi_rrnd(mi,buf,mi->lastpos);
return _myrg_mi_read_record(mi,buf);
}
......@@ -49,5 +49,5 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx)
/* now, mymerge's read_next is as simple as one queue_top */
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
return mi_rrnd(mi,buf,mi->lastpos);
return _myrg_mi_read_record(mi,buf);
}
......@@ -49,5 +49,5 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx)
/* now, mymerge's read_prev is as simple as one queue_top */
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
return mi_rrnd(mi,buf,mi->lastpos);
return _myrg_mi_read_record(mi,buf);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment