| 6677 | ****************************************************************************/ |
| 6678 | |
| 6679 | static 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. |
no test coverage detected