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