~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/hp_delete.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:
22
22
  unsigned char *pos;
23
23
  HP_SHARE *share=info->getShare();
24
24
  HP_KEYDEF *keydef, *end, *p_lastinx;
25
 
  uint32_t rec_length, chunk_count;
26
25
 
27
26
  test_active(info);
28
27
 
30
29
    return(errno);                      /* Record changed */
31
30
  share->changed=1;
32
31
 
33
 
  rec_length = hp_get_encoded_data_length(share, record, &chunk_count);
34
 
 
35
32
  if ( --(share->records) < share->blength >> 1) share->blength>>=1;
36
33
  pos=info->current_ptr;
37
34
 
39
36
  for (keydef = share->keydef, end = keydef + share->keys; keydef < end;
40
37
       keydef++)
41
38
  {
42
 
    if ((*keydef->delete_key)(info, keydef, record, pos, keydef == p_lastinx))
 
39
    if (hp_delete_key(info, keydef, record, pos, keydef == p_lastinx))
43
40
      goto err;
44
41
  }
45
42
 
56
53
 
57
54
 
58
55
/*
59
 
  Remove one key from rb-tree
60
 
*/
61
 
 
62
 
int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
63
 
                   const unsigned char *record, unsigned char *recpos, int flag)
64
 
{
65
 
  heap_rb_param custom_arg;
66
 
  uint32_t old_allocated;
67
 
  int res;
68
 
 
69
 
  if (flag)
70
 
    info->last_pos= NULL; /* For heap_rnext/heap_rprev */
71
 
 
72
 
  custom_arg.keyseg= keyinfo->seg;
73
 
  custom_arg.key_length= hp_rb_make_key(keyinfo, &info->recbuf[0], record, recpos);
74
 
  custom_arg.search_flag= SEARCH_SAME;
75
 
  old_allocated= keyinfo->rb_tree.allocated;
76
 
  res= tree_delete(&keyinfo->rb_tree, &info->recbuf[0], custom_arg.key_length,
77
 
                   &custom_arg);
78
 
  info->getShare()->index_length-= (old_allocated - keyinfo->rb_tree.allocated);
79
 
  return res;
80
 
}
81
 
 
82
 
 
83
 
/*
84
56
  Remove one key from hash-table
85
57
 
86
58
  SYNPOSIS