| 8586 | */ |
| 8587 | |
| 8588 | bool st_select_lex::add_cross_joined_table(TABLE_LIST *left_op, |
| 8589 | TABLE_LIST *right_op, |
| 8590 | bool straight_fl) |
| 8591 | { |
| 8592 | DBUG_ENTER("add_cross_joined_table"); |
| 8593 | THD *thd= parent_lex->thd; |
| 8594 | if (!(right_op->nested_join && |
| 8595 | (right_op->nested_join->nest_type & JOIN_OP_NEST))) |
| 8596 | { |
| 8597 | /* |
| 8598 | This handles the cases when the right operand is not a nested join. |
| 8599 | like in queries |
| 8600 | SELECT * FROM t1 JOIN t2; |
| 8601 | SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a JOIN t3 |
| 8602 | */ |
| 8603 | add_joined_table(left_op); |
| 8604 | add_joined_table(right_op); |
| 8605 | right_op->straight= straight_fl; |
| 8606 | DBUG_RETURN(false); |
| 8607 | } |
| 8608 | |
| 8609 | TABLE_LIST *tbl; |
| 8610 | List<TABLE_LIST> *right_op_jl= right_op->join_list; |
| 8611 | TABLE_LIST *cj_nest; |
| 8612 | |
| 8613 | /* |
| 8614 | Create the node NJ for a new nested join for the future inclusion |
| 8615 | of left_op in it. Initially the nest is empty. |
| 8616 | */ |
| 8617 | if (unlikely(!(cj_nest= |
| 8618 | (TABLE_LIST*) thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST))+ |
| 8619 | sizeof(NESTED_JOIN))))) |
| 8620 | DBUG_RETURN(true); |
| 8621 | cj_nest->nested_join= |
| 8622 | ((NESTED_JOIN*) ((uchar*) cj_nest + ALIGN_SIZE(sizeof(TABLE_LIST)))); |
| 8623 | cj_nest->nested_join->nest_type= JOIN_OP_NEST; |
| 8624 | List<TABLE_LIST> *cjl= &cj_nest->nested_join->join_list; |
| 8625 | cjl->empty(); |
| 8626 | |
| 8627 | List<TABLE_LIST> *jl= &right_op->nested_join->join_list; |
| 8628 | DBUG_ASSERT(jl->elements == 2); |
| 8629 | /* Look for the left most node tbl of the right_op tree */ |
| 8630 | for ( ; ; ) |
| 8631 | { |
| 8632 | TABLE_LIST *pair_tbl= 0; /* useful only for operands of natural joins */ |
| 8633 | |
| 8634 | List_iterator<TABLE_LIST> li(*jl); |
| 8635 | tbl= li++; |
| 8636 | |
| 8637 | /* Expand name resolution context */ |
| 8638 | Name_resolution_context *on_context; |
| 8639 | if ((on_context= tbl->on_context)) |
| 8640 | { |
| 8641 | on_context->first_name_resolution_table= |
| 8642 | left_op->first_leaf_for_name_resolution(); |
| 8643 | } |
| 8644 | |
| 8645 | if (!(tbl->outer_join & JOIN_TYPE_RIGHT)) |
nothing calls this directly
no test coverage detected