~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_write.cc

  • Committer: Mark Atwood
  • Date: 2011-12-27 16:09:18 UTC
  • mfrom: (2461.2.1 trunk)
  • Revision ID: me@mark.atwood.name-20111227160918-ai7t6ka9s9xlmlbv
resolve and merge lp:~ivolucien/drizzle/trunk-bug-621861

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include <drizzled/internal/m_string.h>
21
21
#include <drizzled/util/test.h>
 
22
#include <drizzled/tree.h>
22
23
 
23
24
using namespace drizzled;
24
25
 
97
98
    {
98
99
      bool local_lock_tree= (lock_tree &&
99
100
                                !(info->bulk_insert &&
100
 
                                  is_tree_inited(&info->bulk_insert[i])));
 
101
                                  info->bulk_insert[i].is_inited()));
101
102
      if (local_lock_tree)
102
103
      {
103
104
        share->keyinfo[i].version++;
188
189
 
189
190
int _mi_ck_write(MI_INFO *info, uint32_t keynr, unsigned char *key, uint32_t key_length)
190
191
{
191
 
  if (info->bulk_insert && is_tree_inited(&info->bulk_insert[keynr]))
 
192
  if (info->bulk_insert && info->bulk_insert[keynr].is_inited())
192
193
  {
193
194
    return(_mi_ck_write_tree(info, keynr, key, key_length));
194
195
  }
716
717
{
717
718
  int error;
718
719
 
719
 
  error= tree_insert(&info->bulk_insert[keynr], key,
 
720
  error= info->bulk_insert[keynr].tree_insert(key,
720
721
         key_length + info->s->rec_reflength,
721
 
         info->bulk_insert[keynr].custom_arg) ? 0 : HA_ERR_OUT_OF_MEM ;
 
722
         info->bulk_insert[keynr].getCustomArg()) ? 0 : HA_ERR_OUT_OF_MEM ;
722
723
 
723
724
  return(error);
724
725
} /* _mi_ck_write_tree */
797
798
  else
798
799
    cache_size/=total_keylength*16;
799
800
 
800
 
  info->bulk_insert=(TREE *)
801
 
    malloc((sizeof(TREE)*share->base.keys+
 
801
  info->bulk_insert=(Tree *) malloc((sizeof(Tree)*share->base.keys+
802
802
           sizeof(bulk_insert_param)*num_keys));
803
803
 
804
804
  if (!info->bulk_insert)
812
812
      params->info=info;
813
813
      params->keynr=i;
814
814
      /* Only allocate a 16'th of the buffer at a time */
815
 
      init_tree(&info->bulk_insert[i],
816
 
                cache_size * key[i].maxlength,
 
815
      info->bulk_insert[i].init_tree(cache_size * key[i].maxlength,
817
816
                cache_size * key[i].maxlength, 0,
818
817
                (qsort_cmp2)keys_compare, false,
819
818
                (tree_element_free) keys_free, (void *)params++);
820
819
    }
821
820
    else
822
 
     info->bulk_insert[i].root=0;
 
821
     info->bulk_insert[i].setRoot(0);
823
822
  }
824
823
 
825
824
  return(0);
829
828
{
830
829
  if (info->bulk_insert)
831
830
  {
832
 
    if (is_tree_inited(&info->bulk_insert[inx]))
833
 
      reset_tree(&info->bulk_insert[inx]);
 
831
    if (info->bulk_insert[inx].is_inited())
 
832
      info->bulk_insert[inx].reset_tree();
834
833
  }
835
834
}
836
835
 
841
840
    uint32_t i;
842
841
    for (i=0 ; i < info->s->base.keys ; i++)
843
842
    {
844
 
      if (is_tree_inited(& info->bulk_insert[i]))
 
843
      if (info->bulk_insert[i].is_inited())
845
844
      {
846
 
        delete_tree(& info->bulk_insert[i]);
 
845
        info->bulk_insert[i].delete_tree();
847
846
      }
848
847
    }
849
848
    free((void *)info->bulk_insert);