diff options
author | unknown <igor@rurik.mysql.com> | 2005-05-10 16:31:13 -0700 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2005-05-10 16:31:13 -0700 |
commit | e02416c53cc97cb16b8d6a3c0df76568a061538d (patch) | |
tree | a60dad46c054f43e7617ba684f1346dbcb0ba1b7 /sql/table.cc | |
parent | 179451fc2a79763514cf11c3a90b09153ba72cb3 (diff) | |
download | mariadb-git-e02416c53cc97cb16b8d6a3c0df76568a061538d.tar.gz |
Many files:
Fixed bug #8528.
Representation for single-table views was made similar to
representation for multi-table views.
view.test:
Added test case for bug #8528.
view.result:
Added test case for bug #8528. Fixed other test cases.
mysql-test/r/view.result:
Added test case for bug #8528. Fixed other test cases.
mysql-test/t/view.test:
Added test case for bug #8528.
sql/sql_base.cc:
Fixed bug #8528.
Representation for single-table views was made similar to
representation for multi-table views.
sql/sql_delete.cc:
Fixed bug #8528.
Representation for single-table views was made similar to
representation for multi-table views.
sql/sql_insert.cc:
Fixed bug #8528.
Representation for single-table views was made similar to
representation for multi-table views.
sql/sql_parse.cc:
Fixed bug #8528.
Representation for single-table views was made similar to
representation for multi-table views.
sql/sql_prepare.cc:
Fixed bug #8528.
Representation for single-table views was made similar to
representation for multi-table views.
sql/sql_select.cc:
Fixed bug #8528.
Representation for single-table views was made similar to
representation for multi-table views.
sql/sql_update.cc:
Fixed bug #8528.
Representation for single-table views was made similar to
representation for multi-table views.
sql/sql_view.cc:
Fixed bug #8528.
Representation for single-table views was made similar to
representation for multi-table views.
sql/table.cc:
Fixed bug #8528.
Representation for single-table views was made similar to
representation for multi-table views.
sql/table.h:
Fixed bug #8528.
Representation for single-table views was made similar to
representation for multi-table views.
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/sql/table.cc b/sql/table.cc index 8e0f52e1910..d9a092ea416 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1644,11 +1644,13 @@ void st_table_list::set_ancestor() */ tbl->ancestor->set_ancestor(); } - tbl->table->grant= grant; + if (tbl->multitable_view) + multitable_view= TRUE; + if (tbl->table) + tbl->table->grant= grant; } while ((tbl= tbl->next_local)); - /* if view contain only one table, substitute TABLE of it */ - if (!ancestor->next_local) + if (!multitable_view) { table= ancestor->table; schema_table= ancestor->schema_table; @@ -1675,8 +1677,6 @@ void st_table_list::save_and_clear_want_privilege() } else { - DBUG_ASSERT(tbl->view && tbl->ancestor && - tbl->ancestor->next_local); tbl->save_and_clear_want_privilege(); } } @@ -1698,8 +1698,6 @@ void st_table_list::restore_want_privilege() tbl->table->grant.want_privilege= privilege_backup; else { - DBUG_ASSERT(tbl->view && tbl->ancestor && - tbl->ancestor->next_local); tbl->restore_want_privilege(); } } @@ -2053,16 +2051,17 @@ int st_table_list::view_check_option(THD *thd, bool ignore_failure) { if (check_option && check_option->val_int() == 0) { + TABLE_LIST *view= (belong_to_view ? belong_to_view : this); if (ignore_failure) { push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, ER_VIEW_CHECK_FAILED, ER(ER_VIEW_CHECK_FAILED), - view_db.str, view_name.str); + view->view_db.str, view->view_name.str); return(VIEW_CHECK_SKIP); } else { - my_error(ER_VIEW_CHECK_FAILED, MYF(0), view_db.str, view_name.str); + my_error(ER_VIEW_CHECK_FAILED, MYF(0), view->view_db.str, view->view_name.str); return(VIEW_CHECK_ERROR); } } @@ -2080,13 +2079,15 @@ int st_table_list::view_check_option(THD *thd, bool ignore_failure) (should be 0 on call, to find table, or point to table for unique test) map bit mask of tables + view view for which we are looking table RETURN FALSE table not found or found only one TRUE found several tables */ -bool st_table_list::check_single_table(st_table_list **table, table_map map) +bool st_table_list::check_single_table(st_table_list **table, table_map map, + st_table_list *view) { for (TABLE_LIST *tbl= ancestor; tbl; tbl= tbl->next_local) { @@ -2097,11 +2098,14 @@ bool st_table_list::check_single_table(st_table_list **table, table_map map) if (*table) return TRUE; else + { *table= tbl; + tbl->check_option= view->check_option; + } } } else - if (tbl->check_single_table(table, map)) + if (tbl->check_single_table(table, map, view)) return TRUE; } return FALSE; @@ -2131,7 +2135,7 @@ bool st_table_list::set_insert_values(MEM_ROOT *mem_root) } else { - DBUG_ASSERT(view && ancestor && ancestor->next_local); + DBUG_ASSERT(view && ancestor); for (TABLE_LIST *tbl= ancestor; tbl; tbl= tbl->next_local) if (tbl->set_insert_values(mem_root)) return TRUE; |