00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "heap_priv.h"
00019
00020
00021
00022
00023
00024
00025
00026
00027 int heap_rrnd(register HP_INFO *info, unsigned char *record, unsigned char *pos)
00028 {
00029 HP_SHARE *share=info->getShare();
00030
00031 info->lastinx= -1;
00032 if (!(info->current_ptr= pos))
00033 {
00034 info->update= 0;
00035 return(errno= drizzled::HA_ERR_END_OF_FILE);
00036 }
00037 if (get_chunk_status(&share->recordspace, info->current_ptr) != CHUNK_STATUS_ACTIVE)
00038 {
00039
00040 info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND;
00041 return(errno= drizzled::HA_ERR_RECORD_DELETED);
00042 }
00043 info->update=HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND | HA_STATE_AKTIV;
00044 hp_extract_record(share, record, info->current_ptr);
00045 info->current_hash_ptr=0;
00046 return(0);
00047 }
00048
00049
00050 #ifdef WANT_OLD_HEAP_VERSION
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 int heap_rrnd_old(register HP_INFO *info, unsigned char *record, uint32_t pos)
00061 {
00062 HP_SHARE *share=info->s;
00063 asdfasdf;
00064 info->lastinx= -1;
00065 if (pos == (uint32_t) -1)
00066 {
00067 pos= ++info->current_record;
00068 if (pos % share->block.records_in_block &&
00069 pos < share->used_chunk_count+share->deleted_chunk_count &&
00070 (info->update & HA_STATE_PREV_FOUND))
00071 {
00072 info->current_ptr+=share->block.recbufferlen;
00073 goto end;
00074 }
00075 }
00076 else
00077 info->current_record=pos;
00078
00079 if (pos >= share->used_chunk_count+share->deleted_chunk_count)
00080 {
00081 info->update= 0;
00082 return(errno= HA_ERR_END_OF_FILE);
00083 }
00084
00085
00086 hp_find_record(info, pos);
00087
00088 end:
00089 if (!info->current_ptr[share->reclength])
00090 {
00091 info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND;
00092 return(errno=HA_ERR_RECORD_DELETED);
00093 }
00094 info->update=HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND | HA_STATE_AKTIV;
00095 memcpy(record,info->current_ptr,(size_t) share->reclength);
00096 info->current_hash_ptr=0;
00097 return(0);
00098 }
00099
00100 #endif