| 2580 | */ |
| 2581 | |
| 2582 | inline bool JOIN_CACHE::check_match(uchar *rec_ptr) |
| 2583 | { |
| 2584 | /* Check whether pushdown conditions are satisfied */ |
| 2585 | DBUG_ENTER("JOIN_CACHE:check_match"); |
| 2586 | |
| 2587 | if (join_tab->select && join_tab->select->skip_record(join->thd) <= 0) |
| 2588 | DBUG_RETURN(FALSE); |
| 2589 | |
| 2590 | join_tab->jbuf_tracker->r_rows_after_where++; |
| 2591 | |
| 2592 | if (!join_tab->is_last_inner_table()) |
| 2593 | DBUG_RETURN(TRUE); |
| 2594 | |
| 2595 | /* |
| 2596 | This is the last inner table of an outer join, |
| 2597 | and maybe of other embedding outer joins, or |
| 2598 | this is the last inner table of a semi-join. |
| 2599 | */ |
| 2600 | JOIN_TAB *first_inner= join_tab->get_first_inner_table(); |
| 2601 | do |
| 2602 | { |
| 2603 | set_match_flag_if_none(first_inner, rec_ptr); |
| 2604 | if (first_inner->check_only_first_match() && |
| 2605 | !join_tab->first_inner) |
| 2606 | DBUG_RETURN(TRUE); |
| 2607 | /* |
| 2608 | This is the first match for the outer table row. |
| 2609 | The function set_match_flag_if_none has turned the flag |
| 2610 | first_inner->found on. The pushdown predicates for |
| 2611 | inner tables must be re-evaluated with this flag on. |
| 2612 | Note that, if first_inner is the first inner table |
| 2613 | of a semi-join, but is not an inner table of an outer join |
| 2614 | such that 'not exists' optimization can be applied to it, |
| 2615 | the re-evaluation of the pushdown predicates is not needed. |
| 2616 | */ |
| 2617 | for (JOIN_TAB *tab= first_inner; tab <= join_tab; tab++) |
| 2618 | { |
| 2619 | if (tab->select && tab->select->skip_record(join->thd) <= 0) |
| 2620 | DBUG_RETURN(FALSE); |
| 2621 | } |
| 2622 | } |
| 2623 | while ((first_inner= first_inner->first_upper) && |
| 2624 | first_inner->last_inner == join_tab); |
| 2625 | DBUG_RETURN(TRUE); |
| 2626 | } |
| 2627 | |
| 2628 | |
| 2629 | /* |
nothing calls this directly
no test coverage detected