From 6c2330407f99b0bab1db68ec38789fc10a3518ec Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Sep 2004 13:39:15 +0300 Subject: check that table used in multi-update is unique added (BUG#5455) mysql-test/r/multi_update.result: multi* unique updating table check mysql-test/t/multi_update.test: multi* unique updating table check sql/sql_lex.cc: new method to check table only in subqueries sql/sql_lex.h: new method to check table only in subqueries sql/sql_parse.cc: used new method to check table only in subqueries sql/sql_update.cc: check that table is unique added --- sql/sql_lex.cc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index fab047002ad..36af3003487 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1548,6 +1548,7 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num) 1 - found 0 - OK (table did not found) */ + bool st_select_lex_unit::check_updateable(char *db, char *table) { for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select()) @@ -1559,7 +1560,7 @@ bool st_select_lex_unit::check_updateable(char *db, char *table) /* Find db.table which will be updated in this select and - underlayed ones (except derived tables) + underlaying ones (except derived tables) SYNOPSIS st_select_lex::check_updateable() @@ -1570,11 +1571,30 @@ bool st_select_lex_unit::check_updateable(char *db, char *table) 1 - found 0 - OK (table did not found) */ + bool st_select_lex::check_updateable(char *db, char *table) { if (find_real_table_in_list(get_table_list(), db, table)) return 1; + return check_updateable_in_subqueries(db, table); +} + +/* + Find db.table which will be updated in underlaying subqueries + + SYNOPSIS + st_select_lex::check_updateable_in_subqueries() + db - data base name + table - real table name + + RETURN + 1 - found + 0 - OK (table did not found) +*/ + +bool st_select_lex::check_updateable_in_subqueries(char *db, char *table) +{ for (SELECT_LEX_UNIT *un= first_inner_unit(); un; un= un->next_unit()) -- cgit v1.2.1