~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_rkey.c

Removed dead variable, sorted authors file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#include "heapdef.h"
17
17
 
18
 
int heap_rkey(HP_INFO *info, unsigned char *record, int inx, const unsigned char *key, 
 
18
int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key, 
19
19
              key_part_map keypart_map, enum ha_rkey_function find_flag)
20
20
{
21
 
  unsigned char *pos;
 
21
  uchar *pos;
22
22
  HP_SHARE *share= info->s;
23
23
  HP_KEYDEF *keyinfo= share->keydef + inx;
 
24
  DBUG_ENTER("heap_rkey");
 
25
  DBUG_PRINT("enter",("info: 0x%lx  inx: %d", (long) info, inx));
24
26
 
25
27
  if ((uint) inx >= share->keys)
26
28
  {
27
 
    return(my_errno= HA_ERR_WRONG_INDEX);
 
29
    DBUG_RETURN(my_errno= HA_ERR_WRONG_INDEX);
28
30
  }
29
31
  info->lastinx= inx;
30
 
  info->current_record= UINT32_MAX;             /* For heap_rrnd() */
 
32
  info->current_record= (ulong) ~0L;            /* For heap_rrnd() */
31
33
 
32
34
  if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
33
35
  {
35
37
 
36
38
    custom_arg.keyseg= info->s->keydef[inx].seg;
37
39
    custom_arg.key_length= info->lastkey_len= 
38
 
      hp_rb_pack_key(keyinfo, (unsigned char*) info->lastkey,
39
 
                     (unsigned char*) key, keypart_map);
 
40
      hp_rb_pack_key(keyinfo, (uchar*) info->lastkey,
 
41
                     (uchar*) key, keypart_map);
40
42
    custom_arg.search_flag= SEARCH_FIND | SEARCH_SAME;
41
43
    /* for next rkey() after deletion */
42
44
    if (find_flag == HA_READ_AFTER_KEY)
49
51
                               &info->last_pos, find_flag, &custom_arg)))
50
52
    {
51
53
      info->update= 0;
52
 
      return(my_errno= HA_ERR_KEY_NOT_FOUND);
 
54
      DBUG_RETURN(my_errno= HA_ERR_KEY_NOT_FOUND);
53
55
    }
54
 
    memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(unsigned char*));
 
56
    memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(uchar*));
55
57
    info->current_ptr= pos;
56
58
  }
57
59
  else
59
61
    if (!(pos= hp_search(info, share->keydef + inx, key, 0)))
60
62
    {
61
63
      info->update= 0;
62
 
      return(my_errno);
 
64
      DBUG_RETURN(my_errno);
63
65
    }
64
66
    if (!(keyinfo->flag & HA_NOSAME))
65
67
      memcpy(info->lastkey, key, (size_t) keyinfo->length);
66
68
  }
67
 
  hp_extract_record(share, record, pos);
 
69
  memcpy(record, pos, (size_t) share->reclength);
68
70
  info->update= HA_STATE_AKTIV;
69
 
  return(0);
 
71
  DBUG_RETURN(0);
70
72
}
71
73
 
72
74
 
73
75
        /* Quick find of record */
74
76
 
75
 
unsigned char* heap_find(HP_INFO *info, int inx, const unsigned char *key)
 
77
uchar* heap_find(HP_INFO *info, int inx, const uchar *key)
76
78
{
77
79
  return hp_search(info, info->s->keydef + inx, key, 0);
78
80
}