diff options
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/sql/table.cc b/sql/table.cc index 9238d8aa68e..e1f15926c03 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1716,7 +1716,7 @@ void st_table_list::restore_want_privilege() check_opt_type - WHITH CHECK OPTION type (VIEW_CHECK_NONE, VIEW_CHECK_LOCAL, VIEW_CHECK_CASCADED) NOTES - ancestor is list of tables and views used by view + ancestor is list of tables and views used by view (underlying tables/views) DESCRIPTION It is: @@ -1750,6 +1750,9 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds, bool res= FALSE; DBUG_ENTER("st_table_list::setup_ancestor"); + if (check_stack_overrun(thd, (char *)&res)) + return TRUE; + for (tbl= ancestor; tbl; tbl= tbl->next_local) { if (tbl->ancestor && @@ -1987,6 +1990,34 @@ ok: /* + Find underlying base tables (TABLE_LIST) which represent given + table_to_find (TABLE) + + SYNOPSIS + st_table_list::find_underlying_table() + table_to_find table to find + + RETURN + 0 table is not found + found table reference +*/ + +st_table_list *st_table_list::find_underlying_table(TABLE *table_to_find) +{ + /* is this real table and table which we are looking for? */ + if (table == table_to_find && ancestor == 0) + return this; + + for (TABLE_LIST *tbl= ancestor; tbl; tbl= tbl->next_local) + { + TABLE_LIST *result; + if ((result= tbl->find_underlying_table(table_to_find))) + return result; + } + return 0; +} + +/* cleunup items belonged to view fields translation table SYNOPSIS |