24
24
HA_ERR_END_OF_FILE = EOF.
27
int heap_rrnd(register HP_INFO *info, unsigned char *record, unsigned char *pos)
27
int heap_rrnd(register HP_INFO *info, uchar *record, uchar *pos)
29
29
HP_SHARE *share=info->s;
30
DBUG_ENTER("heap_rrnd");
31
DBUG_PRINT("enter",("info: 0x%lx pos: %lx",(long) info, (long) pos));
32
34
if (!(info->current_ptr= pos))
35
return(errno= HA_ERR_END_OF_FILE);
37
DBUG_RETURN(my_errno= HA_ERR_END_OF_FILE);
37
if (get_chunk_status(&share->recordspace, info->current_ptr) != CHUNK_STATUS_ACTIVE)
39
if (!info->current_ptr[share->reclength])
39
/* treat deleted and linked chunks as deleted */
40
41
info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND;
41
return(errno=HA_ERR_RECORD_DELETED);
42
DBUG_RETURN(my_errno=HA_ERR_RECORD_DELETED);
43
44
info->update=HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND | HA_STATE_AKTIV;
44
hp_extract_record(share, record, info->current_ptr);
45
memcpy(record,info->current_ptr,(size_t) share->reclength);
46
DBUG_PRINT("exit", ("found record at 0x%lx", (long) info->current_ptr));
45
47
info->current_hash_ptr=0; /* Can't use rnext */
57
59
HA_ERR_END_OF_FILE = EOF.
60
int heap_rrnd_old(register HP_INFO *info, unsigned char *record, uint32_t pos)
62
int heap_rrnd_old(register HP_INFO *info, uchar *record, ulong pos)
62
64
HP_SHARE *share=info->s;
65
DBUG_ENTER("heap_rrnd");
66
DBUG_PRINT("enter",("info: 0x%lx pos: %ld",info,pos));
65
if (pos == (uint32_t) -1)
69
if (pos == (ulong) -1)
67
71
pos= ++info->current_record;
68
72
if (pos % share->block.records_in_block && /* Quick next record */
69
pos < share->used_chunk_count+share->deleted_chunk_count &&
70
(info->update & HA_STATE_PREV_FOUND))
73
pos < share->records+share->deleted &&
74
(info->update & HA_STATE_PREV_FOUND))
72
info->current_ptr+=share->block.recbufferlen;
76
info->current_ptr+=share->block.recbuffer;
77
81
info->current_record=pos;
79
if (pos >= share->used_chunk_count+share->deleted_chunk_count)
83
if (pos >= share->records+share->deleted)
82
return(errno= HA_ERR_END_OF_FILE);
86
DBUG_RETURN(my_errno= HA_ERR_END_OF_FILE);
85
89
/* Find record number pos */
89
93
if (!info->current_ptr[share->reclength])
91
95
info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND;
92
return(errno=HA_ERR_RECORD_DELETED);
96
DBUG_RETURN(my_errno=HA_ERR_RECORD_DELETED);
94
98
info->update=HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND | HA_STATE_AKTIV;
95
99
memcpy(record,info->current_ptr,(size_t) share->reclength);
100
DBUG_PRINT("exit",("found record at 0x%lx",info->current_ptr));
96
101
info->current_hash_ptr=0; /* Can't use rnext */
100
105
#endif /* WANT_OLD_HEAP_VERSION */