| 928 | */ |
| 929 | |
| 930 | TABLE_LIST *TABLE_LIST::last_leaf_for_name_resolution() |
| 931 | { |
| 932 | TABLE_LIST *cur_table_ref= this; |
| 933 | NESTED_JOIN *cur_nested_join; |
| 934 | |
| 935 | if (is_leaf_for_name_resolution()) |
| 936 | return this; |
| 937 | DBUG_ASSERT(nested_join); |
| 938 | |
| 939 | for (cur_nested_join= nested_join; |
| 940 | cur_nested_join; |
| 941 | cur_nested_join= cur_table_ref->nested_join) |
| 942 | { |
| 943 | cur_table_ref= cur_nested_join->join_list.head(); |
| 944 | /* |
| 945 | If the current nested is a RIGHT JOIN, the operands in |
| 946 | 'join_list' are in reverse order, thus the last operand is in the |
| 947 | end of the list. |
| 948 | */ |
| 949 | if ((cur_table_ref->outer_join & JOIN_TYPE_RIGHT)) |
| 950 | { |
| 951 | List_iterator_fast<TABLE_LIST> it(cur_nested_join->join_list); |
| 952 | TABLE_LIST *next; |
| 953 | cur_table_ref= it++; |
| 954 | while ((next= it++)) |
| 955 | cur_table_ref= next; |
| 956 | } |
| 957 | if (cur_table_ref->is_leaf_for_name_resolution()) |
| 958 | break; |
| 959 | } |
| 960 | return cur_table_ref; |
| 961 | } |
| 962 | |
| 963 | |
| 964 | /* |
no test coverage detected