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

Function ha_create_table_from_share

sql/handler.cc:6679–6714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6677****************************************************************************/
6678
6679static int ha_create_table_from_share(THD *thd, TABLE_SHARE *share,
6680 HA_CREATE_INFO *create_info,
6681 uint *ref_length)
6682{
6683 TABLE table;
6684
6685 if (open_table_from_share(thd, share, &empty_clex_str, 0, READ_ALL, 0,
6686 &table, true))
6687 return 1;
6688
6689 update_create_info_from_table(create_info, &table);
6690
6691 Table_path_buffer name_buff;
6692 Lex_cstring name= table.file->get_canonical_filename(share->path, &name_buff);
6693 int error= table.check_sequence_privileges(thd) ? 1 :
6694 table.file->ha_create(name.str, &table, create_info);
6695
6696 if (error)
6697 {
6698 if (!thd->is_error())
6699 {
6700 if (create_info->options & HA_CREATE_TMP_ALTER)
6701 my_printf_error(ER_CANT_CREATE_TABLE,
6702 ER_THD(thd, ER_CANT_CREATE_TMP_ALTER_TABLE),
6703 MYF(0), share->db.str, share->table_name.str, error);
6704 else
6705 my_error(ER_CANT_CREATE_TABLE, MYF(0), share->db.str,
6706 share->table_name.str, error);
6707 }
6708 table.file->print_error(error, MYF(ME_WARNING));
6709 }
6710 *ref_length= table.file->ref_length; // for hlindexes
6711
6712 (void) closefrm(&table);
6713 return error;
6714}
6715
6716/**
6717 Initiates table-file and calls appropriate database-creator.

Callers 1

ha_create_tableFunction · 0.85

Calls 10

open_table_from_shareFunction · 0.85
my_printf_errorFunction · 0.85
my_errorFunction · 0.85
closefrmFunction · 0.85
ha_createMethod · 0.80
is_errorMethod · 0.45
print_errorMethod · 0.45

Tested by

no test coverage detected