~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/subselect.cc

Reverted 1103

Show diffs side-by-side

added added

removed removed

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