#include <table.h>
Collaboration diagram for st_table_list:

Definition at line 630 of file table.h.
| st_table_list::st_table_list | ( | ) | [inline] |
| void st_table_list::calc_md5 | ( | char * | buffer | ) |
Definition at line 2565 of file table.cc.
References my_MD5Final(), my_MD5Init(), and my_MD5Update().
Referenced by mysql_register_view(), and view_checksum().
02566 { 02567 my_MD5_CTX context; 02568 uchar digest[16]; 02569 my_MD5Init(&context); 02570 my_MD5Update(&context,(uchar *) query.str, query.length); 02571 my_MD5Final(digest, &context); 02572 sprintf((char *) buffer, 02573 "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", 02574 digest[0], digest[1], digest[2], digest[3], 02575 digest[4], digest[5], digest[6], digest[7], 02576 digest[8], digest[9], digest[10], digest[11], 02577 digest[12], digest[13], digest[14], digest[15]); 02578 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bool st_table_list::check_single_table | ( | st_table_list ** | table, | |
| table_map | map, | |||
| st_table_list * | view | |||
| ) |
Definition at line 2988 of file table.cc.
References merge_underlying_list, next_local, table, TRUE, and view.
Referenced by check_insert_fields().
02990 { 02991 for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local) 02992 { 02993 if (tbl->table) 02994 { 02995 if (tbl->table->map & map) 02996 { 02997 if (*table) 02998 return TRUE; 02999 *table= tbl; 03000 tbl->check_option= view->check_option; 03001 } 03002 } 03003 else if (tbl->check_single_table(table, map, view)) 03004 return TRUE; 03005 } 03006 return FALSE; 03007 }
Here is the caller graph for this function:

| void st_table_list::cleanup_items | ( | ) |
Definition at line 2924 of file table.cc.
References Item::cleanup_processor(), field_translation, and field_translation_end.
02925 { 02926 if (!field_translation) 02927 return; 02928 02929 for (Field_translator *transl= field_translation; 02930 transl < field_translation_end; 02931 transl++) 02932 transl->item->walk(&Item::cleanup_processor, 0, 0); 02933 }
Here is the call graph for this function:

| st_table_list * st_table_list::find_underlying_table | ( | TABLE * | table | ) |
Definition at line 2902 of file table.cc.
References merge_underlying_list, next_local, and table.
Referenced by unique_table().
02903 { 02904 /* is this real table and table which we are looking for? */ 02905 if (table == table_to_find && merge_underlying_list == 0) 02906 return this; 02907 02908 for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local) 02909 { 02910 TABLE_LIST *result; 02911 if ((result= tbl->find_underlying_table(table_to_find))) 02912 return result; 02913 } 02914 return 0; 02915 }
Here is the caller graph for this function:

| Security_context * st_table_list::find_view_security_context | ( | THD * | thd | ) |
Definition at line 3261 of file table.cc.
References alias, DBUG_ASSERT, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, prelocking_placeholder, referencing_view, view, view_sctx, and view_suid.
Referenced by prepare_security().
03262 { 03263 Security_context *sctx; 03264 TABLE_LIST *upper_view= this; 03265 DBUG_ENTER("st_table_list::find_view_security_context"); 03266 03267 DBUG_ASSERT(view); 03268 while (upper_view && !upper_view->view_suid) 03269 { 03270 DBUG_ASSERT(!upper_view->prelocking_placeholder); 03271 upper_view= upper_view->referencing_view; 03272 } 03273 if (upper_view) 03274 { 03275 DBUG_PRINT("info", ("Securety context of view %s will be used", 03276 upper_view->alias)); 03277 sctx= upper_view->view_sctx; 03278 DBUG_ASSERT(sctx); 03279 } 03280 else 03281 { 03282 DBUG_PRINT("info", ("Current global context will be used")); 03283 sctx= thd->security_ctx; 03284 } 03285 DBUG_RETURN(sctx); 03286 }
Here is the caller graph for this function:

| TABLE_LIST * st_table_list::first_leaf_for_name_resolution | ( | ) |
Definition at line 3088 of file table.cc.
References DBUG_ASSERT, is_leaf_for_name_resolution(), st_nested_join::join_list, JOIN_TYPE_RIGHT, LINT_INIT, nested_join, and outer_join.
Referenced by push_new_name_resolution_context(), Field_iterator_table_ref::set(), setup_natural_join_row_types(), and store_top_level_join_columns().
03089 { 03090 TABLE_LIST *cur_table_ref; 03091 NESTED_JOIN *cur_nested_join; 03092 LINT_INIT(cur_table_ref); 03093 03094 if (is_leaf_for_name_resolution()) 03095 return this; 03096 DBUG_ASSERT(nested_join); 03097 03098 for (cur_nested_join= nested_join; 03099 cur_nested_join; 03100 cur_nested_join= cur_table_ref->nested_join) 03101 { 03102 List_iterator_fast<TABLE_LIST> it(cur_nested_join->join_list); 03103 cur_table_ref= it++; 03104 /* 03105 If the current nested join is a RIGHT JOIN, the operands in 03106 'join_list' are in reverse order, thus the first operand is 03107 already at the front of the list. Otherwise the first operand 03108 is in the end of the list of join operands. 03109 */ 03110 if (!(cur_table_ref->outer_join & JOIN_TYPE_RIGHT)) 03111 { 03112 TABLE_LIST *next; 03113 while ((next= it++)) 03114 cur_table_ref= next; 03115 } 03116 if (cur_table_ref->is_leaf_for_name_resolution()) 03117 break; 03118 } 03119 return cur_table_ref; 03120 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void st_table_list::hide_view_error | ( | THD * | thd | ) |
Definition at line 2865 of file table.cc.
References ER_BAD_FIELD_ERROR, ER_COLUMNACCESS_DENIED_ERROR, ER_NO_DEFAULT_FOR_FIELD, ER_NO_DEFAULT_FOR_VIEW_FIELD, ER_PROCACCESS_DENIED_ERROR, ER_SP_DOES_NOT_EXIST, ER_TABLEACCESS_DENIED_ERROR, ER_VIEW_INVALID, my_error(), MYF, LEX_STRING::str, top_table(), view_db, and view_name.
Referenced by setup_tables_and_check_access().
02866 { 02867 /* Hide "Unknown column" or "Unknown function" error */ 02868 if (thd->net.last_errno == ER_BAD_FIELD_ERROR || 02869 thd->net.last_errno == ER_SP_DOES_NOT_EXIST || 02870 thd->net.last_errno == ER_PROCACCESS_DENIED_ERROR || 02871 thd->net.last_errno == ER_COLUMNACCESS_DENIED_ERROR || 02872 thd->net.last_errno == ER_TABLEACCESS_DENIED_ERROR) 02873 { 02874 TABLE_LIST *top= top_table(); 02875 thd->clear_error(); 02876 my_error(ER_VIEW_INVALID, MYF(0), top->view_db.str, top->view_name.str); 02877 } 02878 else if (thd->net.last_errno == ER_NO_DEFAULT_FOR_FIELD) 02879 { 02880 TABLE_LIST *top= top_table(); 02881 thd->clear_error(); 02882 // TODO: make correct error message 02883 my_error(ER_NO_DEFAULT_FOR_VIEW_FIELD, MYF(0), 02884 top->view_db.str, top->view_name.str); 02885 } 02886 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bool st_table_list::is_leaf_for_name_resolution | ( | ) |
Definition at line 3058 of file table.cc.
References is_join_columns_complete, is_natural_join, nested_join, and view.
Referenced by first_leaf_for_name_resolution(), and last_leaf_for_name_resolution().
03059 { 03060 return (view || is_natural_join || is_join_columns_complete || 03061 !nested_join); 03062 }
Here is the caller graph for this function:

| TABLE_LIST * st_table_list::last_leaf_for_name_resolution | ( | ) |
Definition at line 3146 of file table.cc.
References DBUG_ASSERT, is_leaf_for_name_resolution(), st_nested_join::join_list, JOIN_TYPE_RIGHT, nested_join, and outer_join.
Referenced by push_new_name_resolution_context(), Field_iterator_table_ref::set(), and store_top_level_join_columns().
03147 { 03148 TABLE_LIST *cur_table_ref= this; 03149 NESTED_JOIN *cur_nested_join; 03150 03151 if (is_leaf_for_name_resolution()) 03152 return this; 03153 DBUG_ASSERT(nested_join); 03154 03155 for (cur_nested_join= nested_join; 03156 cur_nested_join; 03157 cur_nested_join= cur_table_ref->nested_join) 03158 { 03159 cur_table_ref= cur_nested_join->join_list.head(); 03160 /* 03161 If the current nested is a RIGHT JOIN, the operands in 03162 'join_list' are in reverse order, thus the last operand is in the 03163 end of the list. 03164 */ 03165 if ((cur_table_ref->outer_join & JOIN_TYPE_RIGHT)) 03166 { 03167 List_iterator_fast<TABLE_LIST> it(cur_nested_join->join_list); 03168 TABLE_LIST *next; 03169 cur_table_ref= it++; 03170 while ((next= it++)) 03171 cur_table_ref= next; 03172 } 03173 if (cur_table_ref->is_leaf_for_name_resolution()) 03174 break; 03175 } 03176 return cur_table_ref; 03177 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bool st_table_list::placeholder | ( | ) | [inline] |
Definition at line 820 of file table.h.
Referenced by lock_tables(), mark_real_tables_as_free_for_reuse(), and mysql_lock_have_duplicate().
Here is the caller graph for this function:

Definition at line 2803 of file table.cc.
References and_conds(), Item::check_cols(), check_option, Item::copy_andor_structure(), DBUG_ASSERT, DBUG_ENTER, DBUG_RETURN, FALSE, Item::fix_fields(), Item::fixed, merge_underlying_list, next_local, TRUE, VIEW_CHECK_CASCADED, VIEW_CHECK_NONE, and where.
Referenced by prepare_check_option().
02804 { 02805 DBUG_ENTER("st_table_list::prep_check_option"); 02806 02807 for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local) 02808 { 02809 /* see comment of check_opt_type parameter */ 02810 if (tbl->view && 02811 tbl->prep_check_option(thd, 02812 ((check_opt_type == VIEW_CHECK_CASCADED) ? 02813 VIEW_CHECK_CASCADED : 02814 VIEW_CHECK_NONE))) 02815 { 02816 DBUG_RETURN(TRUE); 02817 } 02818 } 02819 02820 if (check_opt_type) 02821 { 02822 Item *item= 0; 02823 if (where) 02824 { 02825 DBUG_ASSERT(where->fixed); 02826 item= where->copy_andor_structure(thd); 02827 } 02828 if (check_opt_type == VIEW_CHECK_CASCADED) 02829 { 02830 for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local) 02831 { 02832 if (tbl->check_option) 02833 item= and_conds(item, tbl->check_option); 02834 } 02835 } 02836 if (item) 02837 thd->change_item_tree(&check_option, item); 02838 } 02839 02840 if (check_option) 02841 { 02842 const char *save_where= thd->where; 02843 thd->where= "check option"; 02844 if (!check_option->fixed && 02845 check_option->fix_fields(thd, &check_option) || 02846 check_option->check_cols(1)) 02847 { 02848 DBUG_RETURN(TRUE); 02849 } 02850 thd->where= save_where; 02851 } 02852 DBUG_RETURN(FALSE); 02853 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2720 of file table.cc.
References and_conds(), backup, DBUG_ENTER, DBUG_RETURN, embedding, Item::fix_fields(), Item::fixed, merge_underlying_list, next_local, on_expr, outer_join, TRUE, where, and where_processed.
Referenced by prepare_where().
02722 { 02723 DBUG_ENTER("st_table_list::prep_where"); 02724 02725 for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local) 02726 { 02727 if (tbl->view && tbl->prep_where(thd, conds, no_where_clause)) 02728 { 02729 DBUG_RETURN(TRUE); 02730 } 02731 } 02732 02733 if (where) 02734 { 02735 if (!where->fixed && where->fix_fields(thd, &where)) 02736 { 02737 DBUG_RETURN(TRUE); 02738 } 02739 02740 /* 02741 check that it is not VIEW in which we insert with INSERT SELECT 02742 (in this case we can't add view WHERE condition to main SELECT_LEX) 02743 */ 02744 if (!no_where_clause && !where_processed) 02745 { 02746 TABLE_LIST *tbl= this; 02747 Query_arena *arena= thd->stmt_arena, backup; 02748 arena= thd->activate_stmt_arena_if_needed(&backup); // For easier test 02749 02750 /* Go up to join tree and try to find left join */ 02751 for (; tbl; tbl= tbl->embedding) 02752 { 02753 if (tbl->outer_join) 02754 { 02755 /* 02756 Store WHERE condition to ON expression for outer join, because 02757 we can't use WHERE to correctly execute left joins on VIEWs and 02758 this expression will not be moved to WHERE condition (i.e. will 02759 be clean correctly for PS/SP) 02760 */ 02761 tbl->on_expr= and_conds(tbl->on_expr, where); 02762 break; 02763 } 02764 } 02765 if (tbl == 0) 02766 *conds= and_conds(*conds, where); 02767 if (arena) 02768 thd->restore_active_arena(arena, &backup); 02769 where_processed= TRUE; 02770 } 02771 } 02772 02773 DBUG_RETURN(FALSE); 02774 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bool st_table_list::prepare_check_option | ( | THD * | thd | ) | [inline] |
Definition at line 832 of file table.h.
References effective_with_check, FALSE, and prep_check_option().
Referenced by mysql_insert(), mysql_load(), and setup_conds().
00833 { 00834 bool res= FALSE; 00835 if (effective_with_check) 00836 res= prep_check_option(thd, effective_with_check); 00837 return res; 00838 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bool st_table_list::prepare_security | ( | THD * | thd | ) |
Definition at line 3302 of file table.cc.
References db, DBUG_ASSERT, DBUG_ENTER, DBUG_RETURN, FALSE, fill_effective_table_privileges(), find_view_security_context(), st_table::grant, grant, NO_ACCESS, prelocking_placeholder, prepare_view_securety_context(), st_grant_info::privilege, referencing_view, LEX_STRING::str, table, table_name, TRUE, view, view_db, view_name, and view_tables.
03303 { 03304 List_iterator_fast<TABLE_LIST> tb(*view_tables); 03305 TABLE_LIST *tbl; 03306 DBUG_ENTER("st_table_list::prepare_security"); 03307 #ifndef NO_EMBEDDED_ACCESS_CHECKS 03308 Security_context *save_security_ctx= thd->security_ctx; 03309 03310 DBUG_ASSERT(!prelocking_placeholder); 03311 if (prepare_view_securety_context(thd)) 03312 DBUG_RETURN(TRUE); 03313 thd->security_ctx= find_view_security_context(thd); 03314 while ((tbl= tb++)) 03315 { 03316 DBUG_ASSERT(tbl->referencing_view); 03317 char *db, *table_name; 03318 if (tbl->view) 03319 { 03320 db= tbl->view_db.str; 03321 table_name= tbl->view_name.str; 03322 } 03323 else 03324 { 03325 db= tbl->db; 03326 table_name= tbl->table_name; 03327 } 03328 fill_effective_table_privileges(thd, &tbl->grant, db, table_name); 03329 if (tbl->table) 03330 tbl->table->grant= grant; 03331 } 03332 thd->security_ctx= save_security_ctx; 03333 #else 03334 while ((tbl= tb++)) 03335 tbl->grant.privilege= ~NO_ACCESS; 03336 #endif 03337 DBUG_RETURN(FALSE); 03338 }
Here is the call graph for this function:

| bool st_table_list::prepare_view_securety_context | ( | THD * | thd | ) |
Definition at line 3216 of file table.cc.
References acl_getroot_no_password(), alias, DBUG_ASSERT, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, definer, ER, ER_NO_SUCH_USER, FALSE, st_lex_user::host, my_error(), MYF, prelocking_placeholder, push_warning_printf(), SQLCOM_SHOW_CREATE, LEX_STRING::str, TRUE, st_lex_user::user, view, view_sctx, view_suid, and MYSQL_ERROR::WARN_LEVEL_NOTE.
Referenced by prepare_security().
03217 { 03218 DBUG_ENTER("st_table_list::prepare_view_securety_context"); 03219 DBUG_PRINT("enter", ("table: %s", alias)); 03220 03221 DBUG_ASSERT(!prelocking_placeholder && view); 03222 if (view_suid) 03223 { 03224 DBUG_PRINT("info", ("This table is suid view => load contest")); 03225 DBUG_ASSERT(view && view_sctx); 03226 if (acl_getroot_no_password(view_sctx, 03227 definer.user.str, 03228 definer.host.str, 03229 definer.host.str, 03230 thd->db))
