~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_rfirst.c

  • Committer: Monty Taylor
  • Date: 2008-10-16 06:32:30 UTC
  • mto: (511.1.5 codestyle)
  • mto: This revision was merged to the branch mainline in revision 521.
  • Revision ID: monty@inaugust.com-20081016063230-4brxsra0qsmsg84q
Added -Wunused-macros.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
/* Read first record with the current key */
19
19
 
20
 
int heap_rfirst(HP_INFO *info, uchar *record, int inx)
 
20
int heap_rfirst(HP_INFO *info, unsigned char *record, int inx)
21
21
{
22
22
  HP_SHARE *share = info->s;
23
23
  HP_KEYDEF *keyinfo = share->keydef + inx;
24
24
  
25
 
  DBUG_ENTER("heap_rfirst");
26
25
  info->lastinx= inx;
27
26
  if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
28
27
  {
29
 
    uchar *pos;
 
28
    unsigned char *pos;
30
29
 
31
30
    if ((pos = tree_search_edge(&keyinfo->rb_tree, info->parents,
32
31
                                &info->last_pos, offsetof(TREE_ELEMENT, left))))
33
32
    {
34
33
      memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), 
35
 
             sizeof(uchar*));
 
34
             sizeof(unsigned char*));
36
35
      info->current_ptr = pos;
37
 
      memcpy(record, pos, (size_t)share->reclength);
 
36
      hp_extract_record(share, record, pos);
38
37
      /*
39
38
        If we're performing index_first on a table that was taken from
40
39
        table cache, info->lastkey_len is initialized to previous query.
51
50
    else
52
51
    {
53
52
      my_errno = HA_ERR_END_OF_FILE;
54
 
      DBUG_RETURN(my_errno);
 
53
      return(my_errno);
55
54
    }
56
 
    DBUG_RETURN(0);
 
55
    return(0);
57
56
  }
58
57
  else
59
58
  {
60
59
    if (!(info->s->records))
61
60
    {
62
61
      my_errno=HA_ERR_END_OF_FILE;
63
 
      DBUG_RETURN(my_errno);
 
62
      return(my_errno);
64
63
    }
65
 
    DBUG_ASSERT(0); /* TODO fix it */
 
64
    assert(0); /* TODO fix it */
66
65
    info->current_record=0;
67
66
    info->current_hash_ptr=0;
68
67
    info->update=HA_STATE_PREV_FOUND;
69
 
    DBUG_RETURN(heap_rnext(info,record));
 
68
    return(heap_rnext(info,record));
70
69
  }
71
70
}