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

Function create_internal_tmp_table_from_heap

sql/sql_select.cc:23789–23927  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23787
23788
23789bool
23790create_internal_tmp_table_from_heap(THD *thd, TABLE *table,
23791 TMP_ENGINE_COLUMNDEF *start_recinfo,
23792 TMP_ENGINE_COLUMNDEF **recinfo,
23793 int error,
23794 bool ignore_last_dupp_key_error,
23795 bool *is_duplicate)
23796{
23797 TABLE new_table;
23798 TABLE_SHARE share;
23799 const char *save_proc_info;
23800 int write_err= 0;
23801 String tmp_alias;
23802 DBUG_ENTER("create_internal_tmp_table_from_heap");
23803 if (is_duplicate)
23804 *is_duplicate= FALSE;
23805
23806 if (table->s->db_type() != heap_hton || error != HA_ERR_RECORD_FILE_FULL)
23807 {
23808 /*
23809 We don't want this error to be converted to a warning, e.g. in case of
23810 INSERT IGNORE ... SELECT.
23811 */
23812 table->file->print_error(error, MYF(ME_FATAL));
23813 DBUG_RETURN(1);
23814 }
23815 new_table= *table;
23816 share= *table->s;
23817 new_table.s= &share;
23818 new_table.s->db_plugin= ha_lock_engine(thd, TMP_ENGINE_HTON);
23819 if (unlikely(!(new_table.file= get_new_handler(&share, &new_table.mem_root,
23820 TMP_ENGINE_HTON))))
23821 DBUG_RETURN(1); // End of memory
23822
23823 if (unlikely(new_table.file->set_ha_share_ref(&share.ha_share)))
23824 {
23825 delete new_table.file;
23826 DBUG_RETURN(1);
23827 }
23828
23829 save_proc_info=thd->proc_info;
23830 THD_STAGE_INFO(thd, stage_converting_heap_to_myisam);
23831
23832 new_table.no_rows= table->no_rows;
23833 if (create_internal_tmp_table(&new_table, table->key_info, start_recinfo,
23834 recinfo,
23835 thd->lex->first_select_lex()->options |
23836 thd->variables.option_bits))
23837 goto err2;
23838 if (open_tmp_table(&new_table))
23839 {
23840 TMP_ENGINE_HTON->drop_table(TMP_ENGINE_HTON, new_table.s->path.str);
23841 goto err2;
23842 }
23843 if (table->file->indexes_are_disabled())
23844 new_table.file->ha_disable_indexes(key_map(0), false);
23845 table->file->ha_index_or_rnd_end();
23846 if (table->file->ha_rnd_init_with_error(1))

Callers 15

executeMethod · 0.85
send_dataMethod · 0.85
end_sj_materializeFunction · 0.85
end_writeFunction · 0.85
end_updateFunction · 0.85
end_write_groupFunction · 0.85
rollup_write_dataMethod · 0.85
send_dataMethod · 0.85
put_valueMethod · 0.85
executeMethod · 0.85

Calls 15

ha_lock_engineFunction · 0.85
get_new_handlerFunction · 0.85
open_tmp_tableFunction · 0.85
plugin_unlockFunction · 0.85
db_typeMethod · 0.80
first_select_lexMethod · 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

Tested by

no test coverage detected