From 55a8c28c27778d018a145ce25e61bdcda7a764a5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Sep 2004 19:28:29 +0300 Subject: fixed merged view fields names (BUG#5147) support of merged VIEW over several tables added (WL#1809) mysql-test/r/view.result: merge of VIEW with several tables mysql-test/t/view.test: merge of VIEW with several tables sql/item.cc: renaming Item and restoring item name on cleunup() sql/item.h: renaming Item and restoring item name on cleunup() debug output added sql/item_cmpfunc.h: setup_conds() changed to support two tables lists sql/item_subselect.cc: list of table leaves used instead of local table list for name resolving sql/mysql_priv.h: setup_conds() and setup_tables() changed to support two tables lists sql/opt_sum.cc: list of table leaves used instead of local table list for name resolving sql/sp.cc: setup_tables() changed to support two tables lists sql/sql_base.cc: skip temporary tables in table finding fixed merged view fields names (BUG#5147) sql/sql_delete.cc: setup_conds() and setup_tables() changed to support two tables lists sql/sql_help.cc: setup_tables() changed to support two tables lists sql/sql_insert.cc: setup_tables() changed to support two tables lists name handling support sql/sql_lex.cc: allow view with several tables for MERGE sql/sql_lex.h: new table list sql/sql_load.cc: setup_tables() changed to support two tables lists sql/sql_olap.cc: setup_tables() changed to support two tables lists sql/sql_parse.cc: new list support sql/sql_prepare.cc: new list support sql/sql_select.cc: list of table leaves used instead of local table list for name resolving sql/sql_update.cc: setup_conds() and setup_tables() changed to support two tables lists sql/sql_view.cc: support of MERGED VIEWS with several tables sql/sql_yacc.yy: removed blanks in new code sql/table.cc: fixed setup view code support of merged VIEW over several tables added sql/table.h: fixed merged view fields names (BUG#5147) --- sql/sql_delete.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sql/sql_delete.cc') diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index f9dba49d2e3..4885470846b 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -284,8 +284,8 @@ int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds) SELECT_LEX *select_lex= &thd->lex->select_lex; DBUG_ENTER("mysql_prepare_delete"); - if (setup_tables(thd, table_list, conds) || - setup_conds(thd, table_list, conds) || + if (setup_tables(thd, table_list, conds, &select_lex->leaf_tables, 0) || + setup_conds(thd, table_list, select_lex->leaf_tables, conds) || setup_ftfuncs(select_lex)) DBUG_RETURN(-1); if (!table_list->updatable || check_key_in_view(thd, table_list)) @@ -341,7 +341,8 @@ int mysql_multi_delete_prepare(THD *thd) lex->query_tables also point on local list of DELETE SELECT_LEX */ - if (setup_tables(thd, lex->query_tables, &lex->select_lex.where)) + if (setup_tables(thd, lex->query_tables, &lex->select_lex.where, + &lex->select_lex.leaf_tables, 0)) DBUG_RETURN(-1); /* Fix tables-to-be-deleted-from list to point at opened tables */ -- cgit v1.2.1 From 9aa459f0df7e000224e4ac54c5009eac42ef365a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 Sep 2004 23:42:56 +0300 Subject: support of join view updateability (WL#1809) include/mysqld_error.h: new error mesaages mysql-test/r/view.result: tests of updatint/inserting join views mysql-test/t/view.test: tests of updatint/inserting join views sql/mysql_priv.h: support of "usual UPDATE" -> "multi UPDATE" conversion sql/share/czech/errmsg.txt: new error mesaages sql/share/danish/errmsg.txt: new error mesaages sql/share/dutch/errmsg.txt: new error mesaages sql/share/english/errmsg.txt: new error mesaages sql/share/estonian/errmsg.txt: new error mesaages sql/share/french/errmsg.txt: new error mesaages sql/share/german/errmsg.txt: new error mesaages sql/share/greek/errmsg.txt: new error mesaages sql/share/hungarian/errmsg.txt: new error mesaages sql/share/italian/errmsg.txt: new error mesaages sql/share/japanese/errmsg.txt: new error mesaages sql/share/korean/errmsg.txt: new error mesaages sql/share/norwegian-ny/errmsg.txt: new error mesaages sql/share/norwegian/errmsg.txt: new error mesaages sql/share/polish/errmsg.txt: new error mesaages sql/share/portuguese/errmsg.txt: new error mesaages sql/share/romanian/errmsg.txt: new error mesaages sql/share/russian/errmsg.txt: new error mesaages sql/share/serbian/errmsg.txt: new error mesaages sql/share/slovak/errmsg.txt: new error mesaages sql/share/spanish/errmsg.txt: new error mesaages sql/share/swedish/errmsg.txt: new error mesaages sql/share/ukrainian/errmsg.txt: new error mesaages sql/sql_base.cc: test to avoid join virew to be catched here sql/sql_class.h: support of join views add to update sql/sql_delete.cc: support of join views add to delete(error issue) sql/sql_insert.cc: support of join views add to insert (order of some check changed, to allow find table which will be inserted in, when we will know which fields will be inserted) mechanism of calling setup_tables() only once fixed for INSERT SELECT sql/sql_parse.cc: support of "usual UPDATE" -> "multi UPDATE" conversion mysql_insert_select_prepare now called in same environment for usual queries and PS preparing support of join views add to delete (error issue) sql/sql_prepare.cc: support of "usual UPDATE" -> "multi UPDATE" conversion support of join views add to delete (error issue) sql/sql_update.cc: support of join views add to update sql/sql_view.cc: join views made updatable sql/sql_view.h: insert_view_fields now can check some errors sql/table.cc: methods to support recursive walk by tables tree sql/table.h: methods to support recursive walk by tables tree --- sql/sql_delete.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sql/sql_delete.cc') diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 4885470846b..753efb29b36 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -43,7 +43,14 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order, if ((error= open_and_lock_tables(thd, table_list))) DBUG_RETURN(error); - table= table_list->table; + if (!(table= table_list->table)) + { + DBUG_ASSERT(table_list->view && + table_list->ancestor && table_list->ancestor->next_local); + my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0), + table_list->view_db.str, table_list->view_name.str); + DBUG_RETURN(-1); + } table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); thd->proc_info="init"; table->map=1; -- cgit v1.2.1