| 45 | |
| 46 | |
| 47 | int Pushdown_derived::execute() |
| 48 | { |
| 49 | int err; |
| 50 | THD *thd= handler->thd; |
| 51 | TABLE *table= handler->table; |
| 52 | TMP_TABLE_PARAM *tmp_table_param= handler->tmp_table_param; |
| 53 | |
| 54 | DBUG_ENTER("Pushdown_derived::execute"); |
| 55 | |
| 56 | if ((err= handler->init_scan())) |
| 57 | goto error; |
| 58 | |
| 59 | while (!(err= handler->next_row())) |
| 60 | { |
| 61 | if (unlikely(thd->check_killed())) |
| 62 | { |
| 63 | handler->end_scan(); |
| 64 | DBUG_RETURN(-1); |
| 65 | } |
| 66 | |
| 67 | if ((err= table->file->ha_write_tmp_row(table->record[0]))) |
| 68 | { |
| 69 | bool is_duplicate; |
| 70 | if (likely(!table->file->is_fatal_error(err, HA_CHECK_DUP))) |
| 71 | continue; // Distinct elimination |
| 72 | |
| 73 | if (create_internal_tmp_table_from_heap(thd, table, |
| 74 | tmp_table_param->start_recinfo, |
| 75 | &tmp_table_param->recinfo, |
| 76 | err, 1, &is_duplicate)) |
| 77 | DBUG_RETURN(1); |
| 78 | if (is_duplicate) |
| 79 | continue; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | if (err != 0 && err != HA_ERR_END_OF_FILE) |
| 84 | goto error; |
| 85 | |
| 86 | if ((err= handler->end_scan())) |
| 87 | goto error_2; |
| 88 | |
| 89 | DBUG_RETURN(0); |
| 90 | |
| 91 | error: |
| 92 | handler->end_scan(); |
| 93 | error_2: |
| 94 | handler->print_error(err, MYF(0)); |
| 95 | DBUG_RETURN(-1); // Error not sent to client |
| 96 | } |
| 97 | |
| 98 | |
| 99 | void derived_handler::print_error(int error, myf errflag) |
nothing calls this directly
no test coverage detected