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

Method finalize

sql/sql_select.cc:22469–22961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22467
22468
22469bool Create_tmp_table::finalize(THD *thd,
22470 TABLE *table,
22471 TMP_TABLE_PARAM *param,
22472 bool do_not_open, bool keep_row_order)
22473{
22474 DBUG_ENTER("Create_tmp_table::finalize");
22475 DBUG_ASSERT(table);
22476
22477 uint null_pack_length[2];
22478 uint null_pack_base[2];
22479 uint null_counter[2]= {0, 0};
22480 uint whole_null_pack_length;
22481 bool use_packed_rows= false;
22482 bool save_abort_on_warning;
22483 uchar *pos;
22484 uchar *null_flags;
22485 KEY *keyinfo= param->keyinfo;
22486 TMP_ENGINE_COLUMNDEF *recinfo;
22487 TABLE_SHARE *share= table->s;
22488 Copy_field *copy= param->copy_field;
22489 MEM_ROOT *mem_root_save= thd->mem_root;
22490 thd->mem_root= &table->mem_root;
22491
22492 DBUG_ASSERT(m_alloced_field_count >= share->fields);
22493 DBUG_ASSERT(m_alloced_field_count >= share->blob_fields);
22494
22495 if (choose_engine(thd, table, param))
22496 goto err;
22497
22498 if (table->file->set_ha_share_ref(&share->ha_share))
22499 {
22500 delete table->file;
22501 table->file= 0;
22502 goto err;
22503 }
22504 table->file->set_table(table);
22505
22506 if (!m_using_unique_constraint)
22507 share->reclength+= m_group_null_items; // null flag is stored separately
22508
22509 if (share->blob_fields == 0)
22510 {
22511 /* We need to ensure that first byte is not 0 for the delete link */
22512 if (m_field_count[other])
22513 m_null_count[other]++;
22514 else
22515 m_null_count[distinct]++;
22516 }
22517
22518 null_pack_length[other]= (m_null_count[other] + 7 +
22519 m_uneven_bit[other]) / 8;
22520 null_pack_base[other]= 0;
22521 null_pack_length[distinct]= (m_null_count[distinct] + 7 +
22522 m_uneven_bit[distinct]) / 8;
22523 null_pack_base[distinct]= null_pack_length[other];
22524 whole_null_pack_length= null_pack_length[other] +
22525 null_pack_length[distinct];
22526 share->reclength+= whole_null_pack_length;

Callers 2

create_tmp_tableFunction · 0.45

Calls 15

alloc_rootFunction · 0.85
field_convFunction · 0.85
instantiate_tmp_tableFunction · 0.85
move_fieldMethod · 0.80
set_bit_ptrMethod · 0.80
is_null_in_recordMethod · 0.80
set_notnullMethod · 0.80
set_table_nameMethod · 0.80
db_typeMethod · 0.80
real_maybe_nullMethod · 0.80
clear_bitMethod · 0.80

Tested by

no test coverage detected