~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_rkey.c

  • Committer: Brian Aker
  • Date: 2008-12-16 07:07:50 UTC
  • Revision ID: brian@tangent.org-20081216070750-o5ykltxxqvn2awrx
Fixed errors test.

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, uchar *record, int inx, const uchar *key, 
 
18
#include <string.h>
 
19
 
 
20
int heap_rkey(HP_INFO *info, unsigned char *record, int inx, const unsigned char *key,
19
21
              key_part_map keypart_map, enum ha_rkey_function find_flag)
20
22
{
21
 
  uchar *pos;
 
23
  unsigned char *pos;
22
24
  HP_SHARE *share= info->s;
23
25
  HP_KEYDEF *keyinfo= share->keydef + inx;
24
26
 
27
29
    return(my_errno= HA_ERR_WRONG_INDEX);
28
30
  }
29
31
  info->lastinx= inx;
30
 
  info->current_record= (uint32_t) ~0L;         /* For heap_rrnd() */
 
32
  info->current_record= UINT32_MAX;             /* For heap_rrnd() */
31
33
 
32
34
  if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
33
35
  {
34
36
    heap_rb_param custom_arg;
35
37
 
36
38
    custom_arg.keyseg= info->s->keydef[inx].seg;
37
 
    custom_arg.key_length= info->lastkey_len= 
38
 
      hp_rb_pack_key(keyinfo, (uchar*) info->lastkey,
39
 
                     (uchar*) key, keypart_map);
 
39
    custom_arg.key_length= info->lastkey_len=
 
40
      hp_rb_pack_key(keyinfo, (unsigned char*) info->lastkey,
 
41
                     (unsigned char*) 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)
51
53
      info->update= 0;
52
54
      return(my_errno= HA_ERR_KEY_NOT_FOUND);
53
55
    }
54
 
    memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(uchar*));
 
56
    memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(unsigned char*));
55
57
    info->current_ptr= pos;
56
58
  }
57
59
  else
72
74
 
73
75
        /* Quick find of record */
74
76
 
75
 
uchar* heap_find(HP_INFO *info, int inx, const uchar *key)
 
77
unsigned char* heap_find(HP_INFO *info, int inx, const unsigned char *key)
76
78
{
77
79
  return hp_search(info, info->s->keydef + inx, key, 0);
78
80
}