MCPcopy Create free account
hub / github.com/MariaDB/server / insert_all_rows_into_tmp_table

Method insert_all_rows_into_tmp_table

sql/table.cc:9936–9995  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9934
9935
9936bool TABLE::insert_all_rows_into_tmp_table(THD *thd,
9937 TABLE *tmp_table,
9938 TMP_TABLE_PARAM *tmp_table_param,
9939 bool with_cleanup)
9940{
9941 int write_err= 0;
9942
9943 DBUG_ENTER("TABLE::insert_all_rows_into_tmp_table");
9944
9945 if (with_cleanup)
9946 {
9947 if ((write_err= tmp_table->file->ha_delete_all_rows()))
9948 goto err;
9949 }
9950
9951 if (file->indexes_are_disabled())
9952 tmp_table->file->ha_disable_indexes(key_map(0), false);
9953
9954 file->ha_index_or_rnd_end();
9955
9956 if (unlikely(file->ha_rnd_init_with_error(1)))
9957 DBUG_RETURN(1);
9958
9959 if (tmp_table->no_rows)
9960 tmp_table->file->extra(HA_EXTRA_NO_ROWS);
9961 else
9962 {
9963 /* update table->file->stats.records */
9964 file->info(HA_STATUS_VARIABLE);
9965 tmp_table->file->ha_start_bulk_insert(file->stats.records);
9966 }
9967
9968 while (likely(!file->ha_rnd_next(tmp_table->record[0])))
9969 {
9970 write_err= tmp_table->file->ha_write_tmp_row(tmp_table->record[0]);
9971 if (unlikely(write_err))
9972 {
9973 bool is_duplicate;
9974 if (tmp_table->file->is_fatal_error(write_err, HA_CHECK_DUP) &&
9975 create_internal_tmp_table_from_heap(thd, tmp_table,
9976 tmp_table_param->start_recinfo,
9977 &tmp_table_param->recinfo,
9978 write_err, 1, &is_duplicate))
9979 DBUG_RETURN(1);
9980
9981 }
9982 if (unlikely(thd->check_killed()))
9983 goto err_killed;
9984 }
9985 if (!tmp_table->no_rows && tmp_table->file->ha_end_bulk_insert())
9986 goto err;
9987 DBUG_RETURN(0);
9988
9989err:
9990 DBUG_PRINT("error",("Got error: %d",write_err));
9991 file->print_error(write_err, MYF(0));
9992err_killed:
9993 (void) file->ha_rnd_end();

Callers 2

fill_recursiveMethod · 0.80
exec_recursiveMethod · 0.80

Calls 15

ha_delete_all_rowsMethod · 0.80
ha_disable_indexesMethod · 0.80
ha_index_or_rnd_endMethod · 0.80
ha_start_bulk_insertMethod · 0.80
ha_rnd_nextMethod · 0.80
check_killedMethod · 0.80
ha_end_bulk_insertMethod · 0.80
indexes_are_disabledMethod · 0.45
extraMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected