summaryrefslogtreecommitdiff
path: root/sql/item_subselect.h
diff options
context:
space:
mode:
authorunknown <dlenev@mysql.com>2005-08-10 00:23:56 +0400
committerunknown <dlenev@mysql.com>2005-08-10 00:23:56 +0400
commit61a68ed6fa0e408c64b857c1052b33eedc5e7de6 (patch)
tree3f10f6888ecf2531022cc520ee953ad5fb8b0ee1 /sql/item_subselect.h
parent7b969dddc3dec53d928b3e830662320b7c48d31f (diff)
downloadmariadb-git-61a68ed6fa0e408c64b857c1052b33eedc5e7de6.tar.gz
Clumsy but working fix for bug #11973 "SELECT .. INTO var_name; in trigger
cause crash on update". Let us update "thd" pointer in LEX, all its units and in LEX::result before executing statement in trigger body, since triggers are associated with TABLE object and because of this can be used in different threads. mysql-test/r/trigger.result: Added test case for bug #11973 "SELECT .. INTO var_name; in trigger cause crash on update". mysql-test/t/trigger.test: Added test case for bug #11973 "SELECT .. INTO var_name; in trigger cause crash on update". sql/item_subselect.cc: subselect_engine: Moved implementation of set_thd() method to item_subselect.cc, since now it also sets "thd" for subselect_engine::result. sql/item_subselect.h: subselect_engine: Moved implementation of set_thd() method to item_subselect.cc, since now it also sets "thd" for subselect_engine::result. sql/sql_class.h: select_result: Added set_thd() method for updating select_result::thd value (we need this in cases when statement to which this select_result belongs will be used in different threads, as it happens for statements in trigger body). multi_delete/multi_update: Got rid of redundant "thd" member (we already have it in select_result). sql/sql_delete.cc: multi_delete: Got rid of redundant "thd" member (we already have it in select_result). sql/sql_lex.h: st_select_lex_unit: Added set_thd() method for updating st_select_lex_unit::thd value (we need this in cases when statement to which this unit belongs will be used in different threads, as it happens for statements in trigger body). We don't update thd of select_result pointed by st_select_lex_unit::result in this method, since it is either have too short lifetime (i.e. created for each execution) or is accessible via Item_subquery or LEX::result and thus already taken care of. sql/sql_parse.cc: multi_delete: Got rid of redundant "thd" member (we already have it in select_result). sql/sql_prepare.cc: reinit_stmt_before_use(): We have to update "thd" pointer in LEX, all its units and in LEX::result, since statements which belong to trigger body are associated with TABLE object and because of this can be used in different threads. sql/sql_update.cc: multi_update: Got rid of redundant "thd" member (we already have it in select_result).
Diffstat (limited to 'sql/item_subselect.h')
-rw-r--r--sql/item_subselect.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 0b5736169fa..46623f76170 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -299,8 +299,11 @@ public:
virtual ~subselect_engine() {}; // to satisfy compiler
virtual void cleanup()= 0;
- // set_thd should be called before prepare()
- void set_thd(THD *thd_arg) { thd= thd_arg; }
+ /*
+ Also sets "thd" for subselect_engine::result.
+ Should be called before prepare().
+ */
+ void set_thd(THD *thd_arg);
THD * get_thd() { return thd; }
virtual int prepare()= 0;
virtual void fix_length_and_dec(Item_cache** row)= 0;