diff options
author | unknown <dlenev@mysql.com> | 2005-05-09 16:21:57 +0400 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2005-05-09 16:21:57 +0400 |
commit | cb598b10f056e9b93577dc0ca84a7924c06d2904 (patch) | |
tree | 913aa03dab8cd22c346d20e8c9d8a62f3e1b127b /sql | |
parent | d6f7a337e7b20c25bf46e5ea2a470983a4efa71c (diff) | |
parent | dad8efdf6b71eab2f339552053537396a37e00fa (diff) | |
download | mariadb-git-cb598b10f056e9b93577dc0ca84a7924c06d2904.tar.gz |
Manual merge of fix for bug #9913 into 5.0 tree.
mysql-test/t/range.test:
Auto merged
scripts/mysql_install_db.sh:
Auto merged
sql/item_func.h:
Auto merged
sql/item_sum.cc:
Auto merged
sql/item_sum.h:
Auto merged
sql/sql_udf.h:
Auto merged
mysql-test/r/mysqldump.result:
Manual merge.
mysql-test/t/mysqldump.test:
Manual merge.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_func.cc | 46 | ||||
-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, 45 insertions, 15 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 283d7463293..3c87b6ef920 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2533,6 +2533,28 @@ longlong Item_func_bit_count::val_int() #ifdef HAVE_DLOPEN +void udf_handler::cleanup() +{ + if (!not_original) + { + if (initialized) + { + if (u_d->func_deinit != NULL) + { + void (*deinit)(UDF_INIT *) = (void (*)(UDF_INIT*)) + u_d->func_deinit; + (*deinit)(&initid); + } + free_udf(u_d); + initialized= FALSE; + } + if (buffers) // Because of bug in ecc + delete [] buffers; + buffers= 0; + } +} + + bool udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func, uint arg_count, Item **arguments) @@ -2805,6 +2827,13 @@ my_decimal *udf_handler::val_decimal(my_bool *null_value, my_decimal *dec_buf) } +void Item_udf_func::cleanup() +{ + udf.cleanup(); + Item_func::cleanup(); +} + + double Item_func_udf_float::val_real() { DBUG_ASSERT(fixed == 1); @@ -2930,21 +2959,8 @@ String *Item_func_udf_str::val_str(String *str) udf_handler::~udf_handler() { - if (!not_original) - { - if (initialized) - { - if (u_d->func_deinit != NULL) - { - void (*deinit)(UDF_INIT *) = (void (*)(UDF_INIT*)) - u_d->func_deinit; - (*deinit)(&initid); - } - free_udf(u_d); - } - if (buffers) // Because of bug in ecc - delete [] buffers; - } + /* Everything should be properly cleaned up by this moment. */ + DBUG_ASSERT(not_original || !(initialized || buffers)); } #else diff --git a/sql/item_func.h b/sql/item_func.h index cdc03a166c5..b53f2a0b9c6 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -879,6 +879,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 76bf8189a0e..a5694189976 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -2456,6 +2456,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 b263cbfa0a7..bb5d31b4b4f 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -667,6 +667,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 2a7c06e1891..4df3fe0949d 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()) |