~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/unique.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:
62
62
    elements(0)
63
63
{
64
64
  // Second element is max size for memory use in unique sort
65
 
  init_tree(&tree, 0, 0, size, comp_func, false,
 
65
  tree.init_tree(0, 0, size, comp_func, false,
66
66
            NULL, comp_func_fixed_arg);
67
67
}
68
68
 
146
146
  double result;
147
147
 
148
148
  max_elements_in_tree= ((ulong) max_in_memory_size_arg /
149
 
                         ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size));
 
149
                         ALIGN_SIZE(sizeof(Tree_Element)+key_size));
150
150
 
151
151
  last_tree_elems= nkeys % max_elements_in_tree;
152
152
 
159
159
 
160
160
Unique::~Unique()
161
161
{
162
 
  delete_tree(&tree);
 
162
   tree.delete_tree();
163
163
}
164
164
 
165
165
 
171
171
void
172
172
Unique::reset()
173
173
{
174
 
  reset_tree(&tree);
 
174
  tree.reset_tree();
175
175
  assert(elements == 0);
176
176
}
177
177
 
198
198
 
199
199
bool Unique::walk(tree_walk_action action, void *walk_action_arg)
200
200
{
201
 
  return tree_walk(&tree, action, walk_action_arg, left_root_right);
 
201
  return tree.tree_walk(action, walk_action_arg, left_root_right);
202
202
}
203
203
 
204
204
/*
208
208
 
209
209
bool Unique::get(Table *table)
210
210
{
211
 
  table->sort.found_records= elements+tree.elements_in_tree;
 
211
  table->sort.found_records= elements+tree.getElementsInTree();
212
212
 
213
213
  if ((record_pointers=table->sort.record_pointers= (unsigned char*)
214
 
       malloc(size * tree.elements_in_tree)))
 
214
       malloc(size * tree.getElementsInTree())))
215
215
  {
216
 
    (void) tree_walk(&tree, (tree_walk_action) unique_write_to_ptrs,
 
216
    (void) tree.tree_walk((tree_walk_action) unique_write_to_ptrs,
217
217
                     this, left_root_right);
218
218
    return 0;
219
219
  }