| 15663 | */ |
| 15664 | |
| 15665 | enum_nested_loop_state |
| 15666 | end_sj_materialize(JOIN *join, JOIN_TAB *join_tab, bool end_of_records) |
| 15667 | { |
| 15668 | int error; |
| 15669 | THD *thd= join->thd; |
| 15670 | SJ_MATERIALIZATION_INFO *sjm= join_tab[-1].emb_sj_nest->sj_mat_info; |
| 15671 | DBUG_ENTER("end_sj_materialize"); |
| 15672 | if (!end_of_records) |
| 15673 | { |
| 15674 | TABLE *table= sjm->table; |
| 15675 | |
| 15676 | List_iterator<Item> it(sjm->sjm_table_cols); |
| 15677 | Item *item; |
| 15678 | while ((item= it++)) |
| 15679 | { |
| 15680 | if (item->is_null()) |
| 15681 | DBUG_RETURN(NESTED_LOOP_OK); |
| 15682 | } |
| 15683 | fill_record(thd, table, table->field, sjm->sjm_table_cols, true, false, |
| 15684 | true); |
| 15685 | if (unlikely(thd->is_error())) |
| 15686 | DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */ |
| 15687 | if (unlikely((error= table->file->ha_write_tmp_row(table->record[0])))) |
| 15688 | { |
| 15689 | /* create_myisam_from_heap will generate error if needed */ |
| 15690 | if (table->file->is_fatal_error(error, HA_CHECK_DUP) && |
| 15691 | create_internal_tmp_table_from_heap(thd, table, |
| 15692 | sjm->sjm_table_param.start_recinfo, |
| 15693 | &sjm->sjm_table_param.recinfo, error, 1, NULL)) |
| 15694 | DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */ |
| 15695 | } |
| 15696 | } |
| 15697 | DBUG_RETURN(NESTED_LOOP_OK); |
| 15698 | } |
| 15699 | |
| 15700 | |
| 15701 | /* |
nothing calls this directly
no test coverage detected