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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
16
/* Scan through all rows */
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)
29
DBUG_ENTER("heap_scan_init");
31
info->current_record= (ulong) ~0L; /* No current record */
37
int heap_scan(register HP_INFO *info, uchar *record)
39
HP_SHARE *share=info->s;
41
DBUG_ENTER("heap_scan");
43
pos= ++info->current_record;
44
if (pos < info->next_block)
46
info->current_ptr+=share->block.recbuffer;
50
info->next_block+=share->block.records_in_block;
51
if (info->next_block >= share->records+share->deleted)
53
info->next_block= share->records+share->deleted;
54
if (pos >= info->next_block)
57
DBUG_RETURN(my_errno= HA_ERR_END_OF_FILE);
60
hp_find_record(info, pos);
62
if (!info->current_ptr[share->reclength])
64
DBUG_PRINT("warning",("Found deleted record"));
65
info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND;
66
DBUG_RETURN(my_errno=HA_ERR_RECORD_DELETED);
68
info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND | HA_STATE_AKTIV;
69
memcpy(record,info->current_ptr,(size_t) share->reclength);
70
info->current_hash_ptr=0; /* Can't use read_next */