1
/* Copyright (C) 2000-2002 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
16
/* Scan through all rows */
18
#include "heap_priv.h"
21
Returns one of following values:
23
HA_ERR_RECORD_DELETED = Record is deleted.
24
HA_ERR_END_OF_FILE = EOF.
27
int heap_scan_init(register HP_INFO *info)
30
info->current_record= UINT32_MAX; /* No current record */
36
int heap_scan(register HP_INFO *info, unsigned char *record)
38
HP_SHARE *share=info->getShare();
41
pos= ++info->current_record;
42
if (pos < info->next_block)
44
info->current_ptr+=share->recordspace.block.recbuffer;
48
info->next_block+=share->recordspace.block.records_in_block;
49
if (info->next_block >= share->recordspace.chunk_count)
51
info->next_block= share->recordspace.chunk_count;
52
if (pos >= info->next_block)
55
return(errno= drizzled::HA_ERR_END_OF_FILE);
58
hp_find_record(info, pos);
60
if (get_chunk_status(&share->recordspace, info->current_ptr) != CHUNK_STATUS_ACTIVE)
62
info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND;
63
return(errno= drizzled::HA_ERR_RECORD_DELETED);
65
info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND | HA_STATE_AKTIV;
66
hp_extract_record(share, record, info->current_ptr);
67
info->current_hash_ptr=0; /* Can't use read_next */