MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / first_leaf_for_name_resolution

Method first_leaf_for_name_resolution

sql/table.cc:872–904  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

870*/
871
872TABLE_LIST *TABLE_LIST::first_leaf_for_name_resolution()
873{
874 TABLE_LIST *cur_table_ref;
875 NESTED_JOIN *cur_nested_join;
876 LINT_INIT(cur_table_ref);
877
878 if (is_leaf_for_name_resolution())
879 return this;
880 DBUG_ASSERT(nested_join);
881
882 for (cur_nested_join= nested_join;
883 cur_nested_join;
884 cur_nested_join= cur_table_ref->nested_join)
885 {
886 List_iterator_fast<TABLE_LIST> it(cur_nested_join->join_list);
887 cur_table_ref= it++;
888 /*
889 If the current nested join is a RIGHT JOIN, the operands in
890 'join_list' are in reverse order, thus the first operand is
891 already at the front of the list. Otherwise the first operand
892 is in the end of the list of join operands.
893 */
894 if (!(cur_table_ref->outer_join & JOIN_TYPE_RIGHT))
895 {
896 TABLE_LIST *next;
897 while ((next= it++))
898 cur_table_ref= next;
899 }
900 if (cur_table_ref->is_leaf_for_name_resolution())
901 break;
902 }
903 return cur_table_ref;
904}
905
906
907/*

Callers 1

Calls 1

Tested by

no test coverage detected