29 #include "dict0mem.ic"
36 #ifndef UNIV_HOTBACKUP
40 #define DICT_HEAP_SIZE 100
45 UNIV_INTERN mysql_pfs_key_t autoinc_mutex_key;
53 dict_mem_table_create(
75 table->
flags = (
unsigned int) flags;
76 table->
name =
static_cast<char *
>(
ut_malloc(strlen(name) + 1));
77 memcpy(table->
name, name, strlen(name) + 1);
78 table->
space = (
unsigned int) space;
79 table->
n_cols = (
unsigned int) (n_cols + DATA_N_SYS_COLS);
84 #ifndef UNIV_HOTBACKUP
87 mutex_create(autoinc_mutex_key,
97 ut_d(table->magic_n = DICT_TABLE_MAGIC_N);
110 ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
113 #ifndef UNIV_HOTBACKUP
127 const char* col_names,
138 ut_ad(!cols == !col_names);
142 const char* s = col_names;
145 for (i = 0; i < cols; i++) {
149 old_len = s - col_names;
154 new_len = strlen(name) + 1;
155 total_len = old_len + new_len;
160 memcpy(res, col_names, old_len);
163 memcpy(res + old_len, name, new_len);
172 dict_mem_table_add_col(
185 ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
186 ut_ad(!heap == !name);
191 if (UNIV_UNLIKELY(table->
n_def == table->
n_cols)) {
194 if (UNIV_LIKELY(i) && UNIV_UNLIKELY(!table->
col_names)) {
204 col = dict_table_get_nth_col(table, i);
206 dict_mem_fill_column_struct(col, i, mtype, prtype, len);
215 dict_mem_fill_column_struct(
224 #ifndef UNIV_HOTBACKUP
229 column->
ind = (
unsigned int) col_pos;
231 column->
mtype = (
unsigned int) mtype;
232 column->
prtype = (
unsigned int) prtype;
233 column->
len = (
unsigned int) col_len;
234 #ifndef UNIV_HOTBACKUP
245 dict_mem_index_create(
247 const char* table_name,
248 const char* index_name,
259 ut_ad(table_name && index_name);
265 space, type, n_fields);
275 dict_mem_foreign_create(
void)
285 foreign->
heap = heap;
296 dict_mem_index_add_field(
307 ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
311 field = dict_index_get_nth_field(index, index->
n_def - 1);
314 field->
prefix_len = (
unsigned int) prefix_len;
326 ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);