diff options
author | dlenev@mysql.com <> | 2005-05-09 16:21:57 +0400 |
---|---|---|
committer | dlenev@mysql.com <> | 2005-05-09 16:21:57 +0400 |
commit | e7f29e190426d938ae459eb3251127304c872602 (patch) | |
tree | 913aa03dab8cd22c346d20e8c9d8a62f3e1b127b | |
parent | 1e889f3beba0f167b6b14ac63ded740f7fa0bf8c (diff) | |
parent | 12621f349b5eec8605f3c3993abcaf32b849a712 (diff) | |
download | mariadb-git-e7f29e190426d938ae459eb3251127304c872602.tar.gz |
Manual merge of fix for bug #9913 into 5.0 tree.
-rw-r--r-- | cmd-line-utils/libedit/Makefile.am | 2 | ||||
-rw-r--r-- | mysql-test/t/range.test | 2 | ||||
-rw-r--r-- | scripts/mysql_install_db.sh | 5 | ||||
-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 |
8 files changed, 49 insertions, 20 deletions
diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am index 9ff005c7156..03f3eb65fbc 100644 --- a/cmd-line-utils/libedit/Makefile.am +++ b/cmd-line-utils/libedit/Makefile.am @@ -24,7 +24,7 @@ pkginclude_HEADERS = readline/readline.h noinst_HEADERS = chared.h el.h el_term.h histedit.h key.h parse.h refresh.h sig.h \ sys.h tokenizer.h config.h hist.h map.h prompt.h read.h \ - search.h tty.h libedit_term.h + search.h tty.h libedit_term.h vis.h EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c np/fgetln.c diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 84ae9674de9..e86688c4315 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc + # # Problem with range optimizer # diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index e1e2d4ce148..33db1eae82a 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -11,7 +11,6 @@ in_rpm=0 windows=0 defaults="" user="" -tmp_file=/tmp/mysql_install_db.$$ case "$1" in --no-defaults|--defaults-file=*|--defaults-extra-file=*) @@ -223,10 +222,8 @@ then then echo "Fill help tables" fi - echo "use mysql;" > $tmp_file - cat $tmp_file $fill_help_tables | eval "$mysqld_install_cmd_line" + (echo "use mysql;"; cat $fill_help_tables) | eval "$mysqld_install_cmd_line" res=$? - rm $tmp_file if test $res != 0 then echo "" 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()) |