~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_scan.c

Removed reference to aio.h - we don't reference its use anywhere.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
/* Scan through all rows */
17
17
 
18
 
#include "heap_priv.h"
 
18
#include "heapdef.h"
19
19
 
20
20
/*
21
21
           Returns one of following values:
26
26
 
27
27
int heap_scan_init(register HP_INFO *info)
28
28
{
 
29
  DBUG_ENTER("heap_scan_init");
29
30
  info->lastinx= -1;
30
 
  info->current_record= UINT32_MAX;             /* No current record */
 
31
  info->current_record= (ulong) ~0L;            /* No current record */
31
32
  info->update=0;
32
33
  info->next_block=0;
33
 
  return(0);
 
34
  DBUG_RETURN(0);
34
35
}
35
36
 
36
 
int heap_scan(register HP_INFO *info, unsigned char *record)
 
37
int heap_scan(register HP_INFO *info, uchar *record)
37
38
{
38
 
  HP_SHARE *share=info->getShare();
39
 
  uint32_t pos;
 
39
  HP_SHARE *share=info->s;
 
40
  ulong pos;
 
41
  DBUG_ENTER("heap_scan");
40
42
 
41
43
  pos= ++info->current_record;
42
44
  if (pos < info->next_block)
43
45
  {
44
 
    info->current_ptr+=share->recordspace.block.recbuffer;
 
46
    info->current_ptr+=share->block.recbuffer;
45
47
  }
46
48
  else
47
49
  {
48
 
    info->next_block+=share->recordspace.block.records_in_block;
49
 
    if (info->next_block >= share->recordspace.chunk_count)
 
50
    info->next_block+=share->block.records_in_block;
 
51
    if (info->next_block >= share->records+share->deleted)
50
52
    {
51
 
      info->next_block= share->recordspace.chunk_count;
 
53
      info->next_block= share->records+share->deleted;
52
54
      if (pos >= info->next_block)
53
55
      {
54
56
        info->update= 0;
55
 
        return(errno= HA_ERR_END_OF_FILE);
 
57
        DBUG_RETURN(my_errno= HA_ERR_END_OF_FILE);
56
58
      }
57
59
    }
58
60
    hp_find_record(info, pos);
59
61
  }
60
 
  if (get_chunk_status(&share->recordspace, info->current_ptr) != CHUNK_STATUS_ACTIVE)
 
62
  if (!info->current_ptr[share->reclength])
61
63
  {
 
64
    DBUG_PRINT("warning",("Found deleted record"));
62
65
    info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND;
63
 
    return(errno=HA_ERR_RECORD_DELETED);
 
66
    DBUG_RETURN(my_errno=HA_ERR_RECORD_DELETED);
64
67
  }
65
68
  info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND | HA_STATE_AKTIV;
66
 
  hp_extract_record(share, record, info->current_ptr);
 
69
  memcpy(record,info->current_ptr,(size_t) share->reclength);
67
70
  info->current_hash_ptr=0;                     /* Can't use read_next */
68
 
  return(0);
 
71
  DBUG_RETURN(0);
69
72
} /* heap_scan */