1
by brian
clean slate |
1 |
/* Copyright (C) 2000-2002 MySQL AB
|
2 |
||
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.
|
|
6 |
||
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.
|
|
11 |
||
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 */
|
|
15 |
||
16 |
/* Scan through all rows */
|
|
17 |
||
1130.3.28
by Monty Taylor
Moved heapdef.h and myisamdef.h to *_priv.h for easier filtering for include guard check. |
18 |
#include "heap_priv.h" |
1
by brian
clean slate |
19 |
|
20 |
/*
|
|
21 |
Returns one of following values:
|
|
22 |
0 = Ok.
|
|
23 |
HA_ERR_RECORD_DELETED = Record is deleted.
|
|
24 |
HA_ERR_END_OF_FILE = EOF.
|
|
25 |
*/
|
|
26 |
||
27 |
int heap_scan_init(register HP_INFO *info) |
|
28 |
{
|
|
29 |
info->lastinx= -1; |
|
365.2.8
by Monty Taylor
More MAX macros. |
30 |
info->current_record= UINT32_MAX; /* No current record */ |
1
by brian
clean slate |
31 |
info->update=0; |
32 |
info->next_block=0; |
|
51.3.1
by Jay Pipes
Removed all DBUG symbols from heap storage engine |
33 |
return(0); |
1
by brian
clean slate |
34 |
}
|
35 |
||
481
by Brian Aker
Remove all of uchar. |
36 |
int heap_scan(register HP_INFO *info, unsigned char *record) |
1
by brian
clean slate |
37 |
{
|
1697.2.1
by Brian Aker
Encapsulate the internal share for HEAP. |
38 |
HP_SHARE *share=info->getShare(); |
291
by Brian Aker
Head ulong conversion. |
39 |
uint32_t pos; |
1
by brian
clean slate |
40 |
|
41 |
pos= ++info->current_record; |
|
42 |
if (pos < info->next_block) |
|
43 |
{
|
|
244.1.1
by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns. |
44 |
info->current_ptr+=share->recordspace.block.recbuffer; |
1
by brian
clean slate |
45 |
}
|
46 |
else
|
|
47 |
{
|
|
244.1.1
by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns. |
48 |
info->next_block+=share->recordspace.block.records_in_block; |
49 |
if (info->next_block >= share->recordspace.chunk_count) |
|
1
by brian
clean slate |
50 |
{
|
244.1.1
by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns. |
51 |
info->next_block= share->recordspace.chunk_count; |
1
by brian
clean slate |
52 |
if (pos >= info->next_block) |
53 |
{
|
|
54 |
info->update= 0; |
|
1241.9.57
by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined. |
55 |
return(errno= HA_ERR_END_OF_FILE); |
1
by brian
clean slate |
56 |
}
|
57 |
}
|
|
58 |
hp_find_record(info, pos); |
|
59 |
}
|
|
244.1.1
by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns. |
60 |
if (get_chunk_status(&share->recordspace, info->current_ptr) != CHUNK_STATUS_ACTIVE) |
1
by brian
clean slate |
61 |
{
|
62 |
info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND; |
|
1241.9.57
by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined. |
63 |
return(errno=HA_ERR_RECORD_DELETED); |
1
by brian
clean slate |
64 |
}
|
65 |
info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND | HA_STATE_AKTIV; |
|
244.1.1
by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns. |
66 |
hp_extract_record(share, record, info->current_ptr); |
1
by brian
clean slate |
67 |
info->current_hash_ptr=0; /* Can't use read_next */ |
51.3.1
by Jay Pipes
Removed all DBUG symbols from heap storage engine |
68 |
return(0); |
1
by brian
clean slate |
69 |
} /* heap_scan */ |