From e6ce543f051a2d9dc3ddfaecc4397cdd526701bd Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 30 Apr 2005 20:23:40 +0400 Subject: Fix for Bug #9913 "udf_deinit is not called after execution of PS" (aka "deinit is not called when calling udf from trigger"). We should call udf_deinit() function during cleanup phase after prepared (or ordinary) statement execution instead of calling it from Item's desctructor. No test case is provided since it is hard to test UDF's from our test suite. sql/item_func.cc: udf_handler: Moved all functionality from udf_handler::~udf_handler() to udf_handler::cleanup() method which will be called after each PS execution, thus allowing udf_deinit() to be executed symetrically with udf_init() (which is executed for each execution of PS). Added Item_udf_func::cleanup() which performs proper cleanup after execution of PS with UDF function. sql/item_func.h: Added Item_udf_func::cleanup() method to perform cleanup properly after execution of PS with UDF function. sql/item_sum.cc: Added Item_udf_sum::cleanup() method to perform cleanup properly after execution of PS with aggregate UDF function. sql/item_sum.h: Added Item_udf_sum::cleanup() method to perform cleanup properly after execution of PS with aggregate UDF function. sql/sql_udf.h: Added udf_handler::cleanup() method declaration which is responsible for cleaning up UDF execution context at the end of execution of statement (using ~udf_handler() for this purprose did not worked for PS). --- sql/sql_udf.h | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/sql_udf.h') 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()) -- cgit v1.2.1