summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorunknown <gkodinov@mysql.com>2006-05-26 11:51:30 +0300
committerunknown <gkodinov@mysql.com>2006-05-26 11:51:30 +0300
commit6386c5dfc089aa4da506201ce517a5d1340f2926 (patch)
tree248245bc4fdd9c6ffe0cdad5bb482d4bfc07add7 /sql/sql_base.cc
parent779b09b71ebaddcfc686f8f9681d79f688d0bffd (diff)
parentd7743c41c6cc559c556f435cd7cdd359bd035c09 (diff)
downloadmariadb-git-6386c5dfc089aa4da506201ce517a5d1340f2926.tar.gz
Merge mysql.com:/home/kgeorge/mysql/5.0/clean
into mysql.com:/home/kgeorge/mysql/5.0/B18681 sql/mysql_priv.h: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc52
1 files changed, 52 insertions, 0 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 9bc4ac8dc83..75b69c91846 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -4504,6 +4504,58 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
/*
+ prepare tables and check access for the view tables
+
+ SYNOPSIS
+ setup_tables_and_check_view_access()
+ thd Thread handler
+ context name resolution contest to setup table list there
+ from_clause Top-level list of table references in the FROM clause
+ tables Table list (select_lex->table_list)
+ conds Condition of current SELECT (can be changed by VIEW)
+ leaves List of join table leaves list (select_lex->leaf_tables)
+ refresh It is onle refresh for subquery
+ select_insert It is SELECT ... INSERT command
+ want_access what access is needed
+
+ NOTE
+ a wrapper for check_tables that will also check the resulting
+ table leaves list for access to all the tables that belong to a view
+
+ RETURN
+ FALSE ok; In this case *map will include the chosen index
+ TRUE error
+*/
+bool setup_tables_and_check_access(THD *thd,
+ Name_resolution_context *context,
+ List<TABLE_LIST> *from_clause,
+ TABLE_LIST *tables,
+ Item **conds, TABLE_LIST **leaves,
+ bool select_insert,
+ ulong want_access)
+{
+ TABLE_LIST *leaves_tmp = NULL;
+
+ if (setup_tables (thd, context, from_clause, tables, conds,
+ &leaves_tmp, select_insert))
+ return TRUE;
+
+ if (leaves)
+ *leaves = leaves_tmp;
+
+ for (; leaves_tmp; leaves_tmp= leaves_tmp->next_leaf)
+ if (leaves_tmp->belong_to_view &&
+ check_one_table_access(thd, want_access, leaves_tmp))
+ {
+ tables->hide_view_error(thd);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+/*
Create a key_map from a list of index names
SYNOPSIS