From 4b37cf65f7d9d83005fd73dc05fae39639303f24 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 12 Feb 2004 03:10:26 +0200 Subject: memory leacks in PS with subqueries fixed (adddition to fix of BUG#2462) sql/item.h: mechanism to keep reference in cache array for row IN sql/item_cmpfunc.cc: mechanism to keep reference in cache array for row IN layout fixed sql/item_cmpfunc.h: mechanism to keep reference in cache array for row IN sql/item_subselect.cc: fixed memory pools swapping prevented deleting Item_in_optimizer cache in case of row IN subquery sql/mysql_priv.h: declarations of function moved to be useful in sql_class.h sql/sql_base.cc: keep fields expanded from '*' in statement memory pool sql/sql_class.cc: fixed restoring/backup of memory pool and list of items sql/sql_class.h: memory allocation methods moved to Statement memory pool substituting for preparing sql/sql_lex.cc: ref_pointer_array kept in statement memory sql/sql_lex.h: reinitialization of UNIT sql/sql_prepare.cc: memory allocation/swapping fixed tests/client_test.c: layout fixed --- sql/item_cmpfunc.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'sql/item_cmpfunc.cc') diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 276c374c353..08712f328ca 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -445,7 +445,6 @@ bool Item_in_optimizer::fix_left(THD *thd, } - bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables, Item ** ref) { @@ -471,6 +470,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables, return 0; } + longlong Item_in_optimizer::val_int() { cache->store(args[0]); @@ -484,26 +484,38 @@ longlong Item_in_optimizer::val_int() return tmp; } + +void Item_in_optimizer::keep_top_level_cache() +{ + cache->keep_array(); + save_cache= 1; +} + + void Item_in_optimizer::cleanup() { DBUG_ENTER("Item_in_optimizer::cleanup"); Item_bool_func::cleanup(); - cache= 0; + if (!save_cache) + cache= 0; DBUG_VOID_RETURN; } + bool Item_in_optimizer::is_null() { cache->store(args[0]); return (null_value= (cache->null_value || args[1]->is_null())); } + longlong Item_func_eq::val_int() { int value= cmp.compare(); return value == 0 ? 1 : 0; } + /* Same as Item_func_eq, but NULL = NULL */ void Item_func_equal::fix_length_and_dec() -- cgit v1.2.1