| 24620 | */ |
| 24621 | |
| 24622 | enum_nested_loop_state |
| 24623 | sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records) |
| 24624 | { |
| 24625 | int error; |
| 24626 | enum_nested_loop_state rc; |
| 24627 | DBUG_ENTER("sub_select"); |
| 24628 | |
| 24629 | if (join_tab->split_derived_to_update && !end_of_records) |
| 24630 | { |
| 24631 | table_map tab_map= join_tab->split_derived_to_update; |
| 24632 | for (uint i= 0; tab_map; i++, tab_map>>= 1) |
| 24633 | { |
| 24634 | if (tab_map & 1) |
| 24635 | join->map2table[i]->preread_init_done= false; |
| 24636 | } |
| 24637 | } |
| 24638 | |
| 24639 | /* Restore state if mark_as_null_row() have been called */ |
| 24640 | if (join_tab->last_inner) |
| 24641 | { |
| 24642 | JOIN_TAB *last_inner_tab= join_tab->last_inner; |
| 24643 | for (JOIN_TAB *jt= join_tab; jt <= last_inner_tab; jt++) |
| 24644 | jt->table->null_row= 0; |
| 24645 | } |
| 24646 | else |
| 24647 | join_tab->table->null_row=0; |
| 24648 | |
| 24649 | if (end_of_records) |
| 24650 | { |
| 24651 | enum_nested_loop_state nls= |
| 24652 | (*join_tab->next_select)(join,join_tab+1,end_of_records); |
| 24653 | DBUG_RETURN(nls); |
| 24654 | } |
| 24655 | join_tab->tracker->r_scans++; |
| 24656 | |
| 24657 | rc= NESTED_LOOP_OK; |
| 24658 | |
| 24659 | for (SJ_TMP_TABLE *flush_dups_table= join_tab->flush_weedout_table; |
| 24660 | flush_dups_table; |
| 24661 | flush_dups_table= flush_dups_table->next_flush_table) |
| 24662 | { |
| 24663 | flush_dups_table->sj_weedout_delete_rows(); |
| 24664 | } |
| 24665 | |
| 24666 | if (!join_tab->preread_init_done && join_tab->preread_init()) |
| 24667 | DBUG_RETURN(NESTED_LOOP_ERROR); |
| 24668 | |
| 24669 | if (unlikely(join_tab->rowid_filter)) |
| 24670 | { |
| 24671 | if (unlikely(join_tab->need_to_build_rowid_filter)) |
| 24672 | { |
| 24673 | if (join_tab->build_range_rowid_filter()) |
| 24674 | DBUG_RETURN(NESTED_LOOP_ERROR); |
| 24675 | /* |
| 24676 | We have to check join_tab->rowid_filter again as the above |
| 24677 | function may have cleared it in case of errors. |
| 24678 | */ |
| 24679 | if (join_tab->rowid_filter && join_tab->rowid_filter->is_empty()) |
no test coverage detected