diff options
author | dlenev@mysql.com <> | 2005-05-09 12:18:19 +0400 |
---|---|---|
committer | dlenev@mysql.com <> | 2005-05-09 12:18:19 +0400 |
commit | 12621f349b5eec8605f3c3993abcaf32b849a712 (patch) | |
tree | 0f6cb59ac2969b243c5a97756b88ef487b6e4c6d /sql | |
parent | 1ad41d3728450e4015e2d565f363d2d4ea5d24bd (diff) | |
parent | 8ee6d33bdd49978b68a78126653d3b4aaa60a4ca (diff) | |
download | mariadb-git-12621f349b5eec8605f3c3993abcaf32b849a712.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/dlenev/src/mysql-4.1-bg9913
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_func.cc | 15 | ||||
-rw-r--r-- | sql/item_func.h | 1 | ||||
-rw-r--r-- | sql/item_sum.cc | 11 | ||||
-rw-r--r-- | sql/item_sum.h | 1 | ||||
-rw-r--r-- | sql/sql_udf.h | 1 |
5 files changed, 29 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 477849a66c5..9c6c19f3ec9 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1692,6 +1692,13 @@ longlong Item_func_bit_count::val_int() udf_handler::~udf_handler() { + /* Everything should be properly cleaned up by this moment. */ + DBUG_ASSERT(not_original || !(initialized || buffers)); +} + + +void udf_handler::cleanup() +{ if (!not_original) { if (initialized) @@ -1703,9 +1710,11 @@ udf_handler::~udf_handler() (*deinit)(&initid); } free_udf(u_d); + initialized= FALSE; } if (buffers) // Because of bug in ecc delete [] buffers; + buffers= 0; } } @@ -1945,6 +1954,12 @@ String *udf_handler::val_str(String *str,String *save_str) } +void Item_udf_func::cleanup() +{ + udf.cleanup(); + Item_func::cleanup(); +} + double Item_func_udf_float::val() { diff --git a/sql/item_func.h b/sql/item_func.h index 288db3a148c..885e2383290 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -783,6 +783,7 @@ public: fixed= 1; return res; } + void cleanup(); Item_result result_type () const { return udf.result_type(); } table_map not_null_tables() const { return 0; } }; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 7e9c5d09136..dd4cda4ff91 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1449,6 +1449,17 @@ bool Item_udf_sum::add() DBUG_RETURN(0); } +void Item_udf_sum::cleanup() +{ + /* + udf_handler::cleanup() nicely handles case when we have not + original item but one created by copy_or_same() method. + */ + udf.cleanup(); + Item_sum::cleanup(); +} + + Item *Item_sum_udf_float::copy_or_same(THD* thd) { return new (thd->mem_root) Item_sum_udf_float(thd, this); diff --git a/sql/item_sum.h b/sql/item_sum.h index dab136e4716..040d9395e3a 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -550,6 +550,7 @@ public: bool add(); void reset_field() {}; void update_field() {}; + void cleanup(); }; diff --git a/sql/sql_udf.h b/sql/sql_udf.h index d1f99a6d232..acb04e949a3 100644 --- a/sql/sql_udf.h +++ b/sql/sql_udf.h @@ -67,6 +67,7 @@ class udf_handler :public Sql_alloc bool get_arguments(); bool fix_fields(THD *thd,struct st_table_list *tlist,Item_result_field *item, uint arg_count,Item **args); + void cleanup(); double val(my_bool *null_value) { if (get_arguments()) |