~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/subselect.cc

  • Committer: Brian Aker
  • Date: 2009-07-29 18:35:48 UTC
  • mfrom: (1101.1.12 merge)
  • Revision ID: brian@gaz-20090729183548-yp36iwoaemfc76z0
Merging Monty (which includes new replication)

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
 
135
135
void Item_in_subselect::cleanup()
136
136
{
137
 
  if (left_expr_cache)
 
137
  while (left_expr_cache.empty() == false)
138
138
  {
139
 
    left_expr_cache->delete_elements();
140
 
    delete left_expr_cache;
141
 
    left_expr_cache= NULL;
 
139
    delete left_expr_cache.back();
 
140
    left_expr_cache.pop_back();
142
141
  }
143
142
  first_execution= true;
144
143
  Item_subselect::cleanup();
307
306
    - on a cost-based basis, that takes into account the cost of a cache
308
307
      lookup, the cache hit rate, and the savings per cache hit.
309
308
  */
310
 
  if (!left_expr_cache && exec_method == MATERIALIZATION)
 
309
  if (left_expr_cache.empty() == true && exec_method == MATERIALIZATION)
311
310
    init_left_expr_cache();
312
311
 
313
312
  /* If the new left operand is already in the cache, reuse the old result. */
314
 
  if (left_expr_cache && test_if_item_cache_changed(*left_expr_cache) < 0)
 
313
  if (left_expr_cache.empty() == false && test_if_item_cache_changed(left_expr_cache) < 0)
315
314
  {
316
315
    /* Always compute IN for the first row as the cache is not valid for it. */
317
316
    if (!first_execution)
705
704
 
706
705
Item_in_subselect::Item_in_subselect(Item * left_exp,
707
706
                                     Select_Lex *select_lex):
708
 
  Item_exists_subselect(), left_expr_cache(0), first_execution(true),
 
707
  Item_exists_subselect(), first_execution(true),
709
708
  optimizer(0), pushed_cond_guards(NULL), exec_method(NOT_TRANSFORMED),
710
709
  upper_item(0)
711
710
{
1834
1833
  if (end_select == end_send_group || end_select == end_write_group)
1835
1834
    use_result_field= true;
1836
1835
 
1837
 
  if (!(left_expr_cache= new List<Cached_item>))
1838
 
    return true;
 
1836
  left_expr_cache.clear();
1839
1837
 
1840
1838
  for (uint32_t i= 0; i < left_expr->cols(); i++)
1841
1839
  {
1842
1840
    Cached_item *cur_item_cache= new_Cached_item(session,
1843
1841
                                                 left_expr->element_index(i),
1844
1842
                                                 use_result_field);
1845
 
    if (!cur_item_cache || left_expr_cache->push_front(cur_item_cache))
 
1843
    if (cur_item_cache == NULL)
1846
1844
      return true;
 
1845
    left_expr_cache.push_back(cur_item_cache);
1847
1846
  }
1848
1847
  return false;
1849
1848
}