~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/hp_rkey.cc

  • Committer: lbieber
  • Date: 2010-09-10 05:19:01 UTC
  • mfrom: (1753.1.1 build)
  • Revision ID: lbieber@orisndriz03-20100910051901-lyq4bh4vdegvzyo4
Merge Brian - clean up Heap code

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
using namespace drizzled;
21
21
 
22
22
int heap_rkey(HP_INFO *info, unsigned char *record, int inx, const unsigned char *key,
23
 
              key_part_map keypart_map, enum ha_rkey_function find_flag)
 
23
              key_part_map , enum ha_rkey_function )
24
24
{
25
25
  unsigned char *pos;
26
26
  HP_SHARE *share= info->getShare();
32
32
  }
33
33
  info->lastinx= inx;
34
34
  info->current_record= UINT32_MAX;             /* For heap_rrnd() */
35
 
 
36
 
  if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
37
 
  {
38
 
    heap_rb_param custom_arg;
39
 
 
40
 
    custom_arg.keyseg= info->getShare()->keydef[inx].seg;
41
 
    custom_arg.key_length= info->lastkey_len=
42
 
      hp_rb_pack_key(keyinfo, &info->lastkey[0],
43
 
                     (unsigned char*) key, keypart_map);
44
 
    custom_arg.search_flag= SEARCH_FIND | SEARCH_SAME;
45
 
    /* for next rkey() after deletion */
46
 
    if (find_flag == HA_READ_AFTER_KEY)
47
 
      info->last_find_flag= HA_READ_KEY_OR_NEXT;
48
 
    else if (find_flag == HA_READ_BEFORE_KEY)
49
 
      info->last_find_flag= HA_READ_KEY_OR_PREV;
50
 
    else
51
 
      info->last_find_flag= find_flag;
52
 
    if (!(pos= (unsigned char *)tree_search_key(&keyinfo->rb_tree,
53
 
                                                &info->lastkey[0], info->parents,
54
 
                                                &info->last_pos,
55
 
                                                find_flag, &custom_arg)))
56
 
    {
57
 
      info->update= 0;
58
 
      return(errno= HA_ERR_KEY_NOT_FOUND);
59
 
    }
60
 
    memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(unsigned char*));
61
 
    info->current_ptr= pos;
62
 
  }
63
 
  else
64
35
  {
65
36
    if (!(pos= hp_search(info, share->keydef + inx, key, 0)))
66
37
    {