Commit 98da6d5f authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into  mysql.com:/home/dlenev/src/mysql-5.0-bg11973-2


sql/item_subselect.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
mysql-test/r/trigger.result:
  SCCS merged
mysql-test/t/trigger.test:
  SCCS merged
parents 5329be86 61a68ed6
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -651,3 +651,16 @@ insert into t1 values (0);
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop procedure p1;
drop table t1;
create table t1 (id int, data int, username varchar(16));
insert into t1 (id, data) values (1, 0);
create trigger t1_whoupdated before update on t1 for each row
begin
declare user varchar(32);
declare i int;
select user() into user;
set NEW.username = user;
select count(*) from ((select 1) union (select 2)) as d1 into i;
end|
update t1 set data = 1;
update t1 set data = 2;
drop table t1;
+23 −0
Original line number Diff line number Diff line
@@ -662,3 +662,26 @@ create procedure p1() flush privileges;
insert into t1 values (0);
drop procedure p1;
drop table t1;

# Test for bug #11973 "SELECT .. INTO var_name; in trigger cause
#                      crash on update"
create table t1 (id int, data int, username varchar(16));
insert into t1 (id, data) values (1, 0);
delimiter |;
create trigger t1_whoupdated before update on t1 for each row
begin
  declare user varchar(32);
  declare i int;
  select user() into user;
  set NEW.username = user;
  select count(*) from ((select 1) union (select 2)) as d1 into i;
end|
delimiter ;|
update t1 set data = 1;

connect (addconroot, localhost, root,,);
connection addconroot;
update t1 set data = 2;

connection default;
drop table t1;
+8 −0
Original line number Diff line number Diff line
@@ -1276,6 +1276,14 @@ void Item_allany_subselect::print(String *str)
}


void subselect_engine::set_thd(THD *thd_arg)
{
  thd= thd_arg;
  if (result)
    result->set_thd(thd_arg);
}


subselect_single_select_engine::
subselect_single_select_engine(st_select_lex *select,
			       select_subselect *result,
+5 −2
Original line number Diff line number Diff line
@@ -299,8 +299,11 @@ class subselect_engine: public Sql_alloc
  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;
+3 −4
Original line number Diff line number Diff line
@@ -1565,6 +1565,7 @@ class select_result :public Sql_alloc {
    statement/stored procedure.
  */
  virtual void cleanup();
  void set_thd(THD *thd_arg) { thd= thd_arg; }
};


@@ -1920,14 +1921,13 @@ class multi_delete :public select_result_interceptor
{
  TABLE_LIST *delete_tables, *table_being_deleted;
  Unique **tempfiles;
  THD *thd;
  ha_rows deleted, found;
  uint num_of_tables;
  int error;
  bool do_delete, transactional_tables, normal_tables, delete_while_scanning;

public:
  multi_delete(THD *thd, TABLE_LIST *dt, uint num_of_tables);
  multi_delete(TABLE_LIST *dt, uint num_of_tables);
  ~multi_delete();
  int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
  bool send_data(List<Item> &items);
@@ -1943,7 +1943,6 @@ class multi_update :public select_result_interceptor
  TABLE_LIST *all_tables; /* query/update command tables */
  TABLE_LIST *leaves;     /* list of leves of join table tree */
  TABLE_LIST *update_tables, *table_being_updated;
  THD *thd;
  TABLE **tmp_tables, *main_table, *table_to_update;
  TMP_TABLE_PARAM *tmp_table_param;
  ha_rows updated, found;
@@ -1955,7 +1954,7 @@ class multi_update :public select_result_interceptor
  bool do_update, trans_safe, transactional_tables, ignore;

public:
  multi_update(THD *thd_arg, TABLE_LIST *ut, TABLE_LIST *leaves_list,
  multi_update(TABLE_LIST *ut, TABLE_LIST *leaves_list,
	       List<Item> *fields, List<Item> *values,
	       enum_duplicates handle_duplicates, bool ignore);
  ~multi_update();
Loading