| 31926 | |
| 31927 | |
| 31928 | static void print_table_array(THD *thd, |
| 31929 | table_map eliminated_tables, |
| 31930 | String *str, TABLE_LIST **table, |
| 31931 | TABLE_LIST **end, |
| 31932 | enum_query_type query_type) |
| 31933 | { |
| 31934 | (*table)->print(thd, eliminated_tables, str, query_type); |
| 31935 | |
| 31936 | for (TABLE_LIST **tbl= table + 1; tbl < end; tbl++) |
| 31937 | { |
| 31938 | TABLE_LIST *curr= *tbl; |
| 31939 | |
| 31940 | /* |
| 31941 | The "eliminated_tables &&" check guards against the case of |
| 31942 | printing the query for CREATE VIEW. We do that without having run |
| 31943 | JOIN::optimize() and so will have nested_join->used_tables==0. |
| 31944 | */ |
| 31945 | if (eliminated_tables && |
| 31946 | ((curr->table && (curr->table->map & eliminated_tables)) || |
| 31947 | (curr->nested_join && !(curr->nested_join->used_tables & |
| 31948 | ~eliminated_tables)))) |
| 31949 | { |
| 31950 | /* as of 5.5, print_join doesnt put eliminated elements into array */ |
| 31951 | DBUG_ASSERT(0); |
| 31952 | continue; |
| 31953 | } |
| 31954 | |
| 31955 | /* JOIN_TYPE_OUTER is just a marker unrelated to real join */ |
| 31956 | if (curr->outer_join & (JOIN_TYPE_LEFT|JOIN_TYPE_RIGHT)) |
| 31957 | { |
| 31958 | /* MySQL converts right to left joins */ |
| 31959 | str->append(STRING_WITH_LEN(" left join ")); |
| 31960 | } |
| 31961 | else if (curr->straight) |
| 31962 | str->append(STRING_WITH_LEN(" straight_join ")); |
| 31963 | else if (curr->sj_inner_tables) |
| 31964 | str->append(STRING_WITH_LEN(" semi join ")); |
| 31965 | else |
| 31966 | str->append(STRING_WITH_LEN(" join ")); |
| 31967 | |
| 31968 | curr->print(thd, eliminated_tables, str, query_type); |
| 31969 | if (curr->on_expr) |
| 31970 | { |
| 31971 | str->append(STRING_WITH_LEN(" on(")); |
| 31972 | curr->on_expr->print(str, query_type); |
| 31973 | str->append(')'); |
| 31974 | } |
| 31975 | } |
| 31976 | } |
| 31977 | |
| 31978 | |
| 31979 | /* |
no test coverage detected