27 #if defined(BUILD_DRIZZLE)
30 # include "mysql_version.h"
35 #include "dict0load.ic"
50 static const char* SYSTEM_TABLE_NAME[] = {
71 dict_index_get_nth_field(
74 return(strcmp(name, dict_table_get_col_name(table, tmp)) == 0);
83 dict_get_first_table_name_in_db(
109 dfield = dtuple_get_nth_field(tuple, 0);
112 dict_index_copy_types(tuple, sys_index, 1);
114 btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
129 field = rec_get_nth_field_old(rec, 0, &len);
131 if (len < strlen(name)
132 ||
ut_memcmp(name, field, strlen(name)) != 0) {
146 char* table_name =
mem_strdupl((
char*) field, len);
177 mutex_enter(&kernel_mutex);
178 srv_fatal_semaphore_wait_threshold += 7200;
179 mutex_exit(&kernel_mutex);
182 mutex_enter(&(dict_sys->
mutex));
186 rec = dict_startscan_system(&pcur, &mtr, SYS_TABLES);
191 err_msg = dict_process_sys_tables_rec(
199 dict_table_print_low(table);
202 fprintf(stderr,
" InnoDB: %s\n", err_msg);
208 rec = dict_getnext_system(&pcur, &mtr);
212 mutex_exit(&(dict_sys->
mutex));
216 mutex_enter(&kernel_mutex);
217 srv_fatal_semaphore_wait_threshold -= 7200;
218 mutex_exit(&kernel_mutex);
227 dict_getnext_system_low(
249 btr_pcur_store_position(pcur, mtr);
259 dict_startscan_system(
264 dict_system_id_t system_id)
270 ut_a(system_id < SYS_NUM_SYSTEM_TABLES);
279 rec = dict_getnext_system_low(pcur, mtr);
301 rec = dict_getnext_system_low(pcur, mtr);
312 dict_process_sys_tables_rec(
317 dict_table_info_t status)
324 const char* err_msg = NULL;
327 field = (
const char*) rec_get_nth_field_old(rec, 0, &len);
340 err_msg =
"Table not found in cache";
343 err_msg = dict_load_table_low(table_name, rec, table);
351 && dict_table_get_first_index(*table)) {
355 dict_update_statistics(*table,
370 dict_process_sys_indexes_rec(
375 table_id_t* table_id)
383 err_msg = dict_load_index_low(buf, NULL,
384 heap, rec, FALSE, &index);
396 dict_process_sys_columns_rec(
401 table_id_t* table_id,
402 const char** col_name)
407 err_msg = dict_load_column_low(NULL, heap, column,
408 table_id, col_name, rec);
418 dict_process_sys_fields_rec(
425 index_id_t* index_id,
434 last_index_id =
static_cast<unsigned char *
>(
mem_heap_alloc(heap, 8));
437 err_msg = dict_load_field_low(buf, NULL, sys_field,
438 pos, last_index_id, heap, rec);
452 dict_process_sys_foreign_rec(
461 ulint n_fields_and_type;
464 return(
"delete-marked record in SYS_FOREIGN");
468 return(
"wrong number of columns in SYS_FOREIGN record");
471 field = rec_get_nth_field_old(rec, 0, &len);
472 if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
474 return(
"incorrect column length in SYS_FOREIGN");
479 if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
483 if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
487 field = rec_get_nth_field_old(rec, 3, &len);
488 if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
492 heap, (
const char*) field, len);
494 field = rec_get_nth_field_old(rec, 4, &len);
495 if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
499 heap, (
const char*) field, len);
501 field = rec_get_nth_field_old(rec, 5, &len);
502 if (UNIV_UNLIKELY(len != 4)) {
507 foreign->
type = (
unsigned int) (n_fields_and_type >> 24);
508 foreign->
n_fields = (
unsigned int) (n_fields_and_type & 0x3FFUL);
518 dict_process_sys_foreign_col_rec(
523 const char** for_col_name,
524 const char** ref_col_name,
532 return(
"delete-marked record in SYS_FOREIGN_COLS");
536 return(
"wrong number of columns in SYS_FOREIGN_COLS record");
539 field = rec_get_nth_field_old(rec, 0, &len);
540 if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
542 return(
"incorrect column length in SYS_FOREIGN_COLS");
546 field = rec_get_nth_field_old(rec, 1, &len);
547 if (UNIV_UNLIKELY(len != 4)) {
553 if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
557 if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
561 field = rec_get_nth_field_old(rec, 4, &len);
562 if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
567 field = rec_get_nth_field_old(rec, 5, &len);
568 if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
580 UNIV_INTERN
void dict_print_with_callback(dict_print_callback func,
void *func_arg)
593 mutex_enter(&kernel_mutex);
594 srv_fatal_semaphore_wait_threshold += 7200;
595 mutex_exit(&kernel_mutex);
597 mutex_enter(&(dict_sys->
mutex));
617 mutex_exit(&(dict_sys->
mutex));
621 mutex_enter(&kernel_mutex);
622 srv_fatal_semaphore_wait_threshold -= 7200;
623 mutex_exit(&kernel_mutex);
628 field = rec_get_nth_field_old(rec, 0, &len);
634 char* table_name =
mem_strdupl((
char*) field, len);
636 btr_pcur_store_position(&pcur, &mtr);
640 func(func_arg, table_name);
657 dict_sys_tables_get_flags(
666 field = rec_get_nth_field_old(rec, 5, &len);
675 field = rec_get_nth_field_old(rec, 4, &len);
678 if (UNIV_UNLIKELY(!(n_cols & 0x80000000UL))) {
680 return(ULINT_UNDEFINED);
689 return(ULINT_UNDEFINED);
692 #if DICT_TF_FORMAT_MAX > DICT_TF_FORMAT_ZIP
693 # error "missing case labels for DICT_TF_FORMAT_ZIP .. DICT_TF_FORMAT_MAX"
699 if (UNIV_UNLIKELY((flags & DICT_TF_ZSSIZE_MASK)
702 return(ULINT_UNDEFINED);
705 if (UNIV_UNLIKELY(flags & (SIZE_MAX <<
DICT_TF_BITS))) {
707 return(ULINT_UNDEFINED);
723 dict_check_tablespaces_and_store_max_id(
725 ibool in_crash_recovery)
734 mutex_enter(&(dict_sys->
mutex));
743 + DICT_HDR_MAX_SPACE_ID,
745 fil_set_max_space_id_if_bigger(max_space_id);
765 fil_set_max_space_id_if_bigger(max_space_id);
767 mutex_exit(&(dict_sys->
mutex));
781 field = rec_get_nth_field_old(rec, 0, &len);
784 flags = dict_sys_tables_get_flags(rec);
785 if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) {
787 field = rec_get_nth_field_old(rec, 5, &len);
791 fputs(
" InnoDB: Error: table ", stderr);
794 "InnoDB: in InnoDB data dictionary"
795 " has unknown type %lx.\n",
801 field = rec_get_nth_field_old(rec, 9, &len);
806 btr_pcur_store_position(&pcur, &mtr);
812 }
else if (in_crash_recovery) {
818 field = rec_get_nth_field_old(rec, 4, &len);
822 field = rec_get_nth_field_old(rec, 7, &len);
836 fil_space_for_table_exists_in_mem(
837 space_id, name, is_temp, TRUE, !is_temp);
842 fil_open_single_table_tablespace(FALSE, space_id,
848 if (space_id > max_space_id) {
849 max_space_id = space_id;
866 dict_load_column_low(
876 table_id_t* table_id,
877 const char** col_name,
888 ut_ad(table || column);
891 return(
"delete-marked record in SYS_COLUMNS");
895 return(
"wrong number of columns in SYS_COLUMNS record");
898 field = rec_get_nth_field_old(rec, 0, &len);
899 if (UNIV_UNLIKELY(len != 8)) {
901 return(
"incorrect column length in SYS_COLUMNS");
907 return(
"SYS_COLUMNS.TABLE_ID mismatch");
910 field = rec_get_nth_field_old(rec, 1, &len);
911 if (UNIV_UNLIKELY(len != 4)) {
918 if (UNIV_UNLIKELY(table && table->
n_def != pos)) {
919 return(
"SYS_COLUMNS.POS mismatch");
923 if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
927 if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
931 field = rec_get_nth_field_old(rec, 4, &len);
932 if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
942 field = rec_get_nth_field_old(rec, 5, &len);
943 if (UNIV_UNLIKELY(len != 4)) {
949 field = rec_get_nth_field_old(rec, 6, &len);
950 if (UNIV_UNLIKELY(len != 4)) {
956 && dtype_is_string_type(mtype)) {
959 if (dtype_is_binary_string_type(mtype, prtype)) {
963 prtype = dtype_form_prtype(
965 DATA_MYSQL_BINARY_CHARSET_COLL);
970 prtype = dtype_form_prtype(
972 data_mysql_default_charset_coll);
976 field = rec_get_nth_field_old(rec, 7, &len);
977 if (UNIV_UNLIKELY(len != 4)) {
981 field = rec_get_nth_field_old(rec, 8, &len);
982 if (UNIV_UNLIKELY(len != 4)) {
987 dict_mem_table_add_col(table, heap, name, mtype,
990 dict_mem_fill_column_struct(column, pos, mtype,
1025 ut_a(name_of_col_is(sys_columns, sys_index, 4,
"NAME"));
1026 ut_a(name_of_col_is(sys_columns, sys_index, 8,
"PREC"));
1029 dfield = dtuple_get_nth_field(tuple, 0);
1035 dict_index_copy_types(tuple, sys_index, 1);
1037 btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
1039 for (i = 0; i + DATA_N_SYS_COLS < (ulint) table->
n_cols; i++) {
1040 const char* err_msg;
1046 err_msg = dict_load_column_low(table, heap, NULL, NULL,
1050 fprintf(stderr,
"InnoDB: %s\n", err_msg);
1062 static const char* dict_load_field_del =
"delete-marked record in SYS_FIELDS";
1070 dict_load_field_low(
1082 byte* last_index_id,
1089 ulint pos_and_prefix_len;
1095 ut_a((!index) || (!sys_field));
1098 return(dict_load_field_del);
1102 return(
"wrong number of columns in SYS_FIELDS record");
1105 field = rec_get_nth_field_old(rec, 0, &len);
1106 if (UNIV_UNLIKELY(len != 8)) {
1108 return(
"incorrect column length in SYS_FIELDS");
1112 ut_a(last_index_id);
1113 memcpy(index_id, (
const char*)field, 8);
1114 first_field = memcmp(index_id, last_index_id, 8);
1116 first_field = (index->
n_def == 0);
1117 if (memcmp(field, index_id, 8)) {
1118 return(
"SYS_FIELDS.INDEX_ID mismatch");
1122 field = rec_get_nth_field_old(rec, 1, &len);
1123 if (UNIV_UNLIKELY(len != 4)) {
1128 if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
1132 if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
1146 if (index && UNIV_UNLIKELY
1147 ((pos_and_prefix_len & 0xFFFFUL) != index->
n_def
1148 && (pos_and_prefix_len >> 16 & 0xFFFF) != index->
n_def)) {
1149 return(
"SYS_FIELDS.POS mismatch");
1152 if (first_field || pos_and_prefix_len > 0xFFFFUL) {
1153 prefix_len = pos_and_prefix_len & 0xFFFFUL;
1154 position = (pos_and_prefix_len & 0xFFFF0000UL) >> 16;
1157 position = pos_and_prefix_len & 0xFFFFUL;
1160 field = rec_get_nth_field_old(rec, 4, &len);
1161 if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
1166 dict_mem_index_add_field(
1174 heap, (
const char*) field, len);
1210 ut_a(name_of_col_is(sys_fields, sys_index, 4,
"COL_NAME"));
1213 dfield = dtuple_get_nth_field(tuple, 0);
1219 dict_index_copy_types(tuple, sys_index, 1);
1221 btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
1223 for (i = 0; i < index->
n_fields; i++) {
1224 const char* err_msg;
1230 err_msg = dict_load_field_low(buf, index, NULL, NULL, NULL,
1233 if (err_msg == dict_load_field_del) {
1239 }
else if (err_msg) {
1240 fprintf(stderr,
"InnoDB: %s\n", err_msg);
1241 error = DB_CORRUPTION;
1256 static const char* dict_load_index_del =
"delete-marked record in SYS_INDEXES";
1258 static const char* dict_load_index_id_err =
"SYS_INDEXES.TABLE_ID mismatch";
1268 dict_load_index_low(
1273 const char* table_name,
1297 return(dict_load_index_del);
1301 return(
"wrong number of columns in SYS_INDEXES record");
1304 field = rec_get_nth_field_old(rec, 0, &len);
1305 if (UNIV_UNLIKELY(len != 8)) {
1307 return(
"incorrect column length in SYS_INDEXES");
1312 memcpy(table_id, (
const char*)field, 8);
1313 }
else if (memcmp(field, table_id, 8)) {
1316 return(dict_load_index_id_err);
1319 field = rec_get_nth_field_old(rec, 1, &len);
1320 if (UNIV_UNLIKELY(len != 8)) {
1327 if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
1331 if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
1335 field = rec_get_nth_field_old(rec, 4, &name_len);
1336 if (UNIV_UNLIKELY(name_len == UNIV_SQL_NULL)) {
1343 field = rec_get_nth_field_old(rec, 5, &len);
1344 if (UNIV_UNLIKELY(len != 4)) {
1349 field = rec_get_nth_field_old(rec, 6, &len);
1350 if (UNIV_UNLIKELY(len != 4)) {
1355 field = rec_get_nth_field_old(rec, 7, &len);
1356 if (UNIV_UNLIKELY(len != 4)) {
1361 field = rec_get_nth_field_old(rec, 8, &len);
1362 if (UNIV_UNLIKELY(len != 4)) {
1367 *index = dict_mem_index_create(table_name, name_buf,
1368 space, type, n_fields);
1373 space, type, n_fields);
1378 ut_ad((*index)->page);
1403 ulint error = DB_SUCCESS;
1412 ut_a(name_of_col_is(sys_indexes, sys_index, 4,
"NAME"));
1413 ut_a(name_of_col_is(sys_indexes, sys_index, 8,
"PAGE_NO"));
1416 dfield = dtuple_get_nth_field(tuple, 0);
1422 dict_index_copy_types(tuple, sys_index, 1);
1424 btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
1428 const char* err_msg;
1437 err_msg = dict_load_index_low(buf, table->
name, heap, rec,
1439 ut_ad((index == NULL) == (err_msg != NULL));
1441 if (err_msg == dict_load_index_id_err) {
1445 }
else if (err_msg == dict_load_index_del) {
1448 }
else if (err_msg) {
1449 fprintf(stderr,
"InnoDB: %s\n", err_msg);
1450 error = DB_CORRUPTION;
1461 "InnoDB: Error: unknown type %lu"
1462 " of index %s of table %s\n",
1465 error = DB_UNSUPPORTED;
1466 dict_mem_index_free(index);
1471 "InnoDB: Error: trying to load index %s"
1473 "InnoDB: but the index tree has been freed!\n",
1477 dict_mem_index_free(index);
1478 error = DB_CORRUPTION;
1481 && NULL == dict_table_get_first_index(table)) {
1483 fputs(
"InnoDB: Error: trying to load index ",
1486 fputs(
" for table ", stderr);
1488 fputs(
"\nInnoDB: but the first index"
1489 " is not clustered!\n", stderr);
1492 }
else if (table->
id < DICT_HDR_FIRST_ID
1495 && !strcmp(
"ID_IND", index->
name)))) {
1499 dict_mem_index_free(index);
1501 dict_load_fields(index, heap);
1502 error = dict_index_add_to_cache(table, index,
1503 index->
page, FALSE);
1509 if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
1532 dict_load_table_low(
1545 return(
"delete-marked record in SYS_TABLES");
1549 return(
"wrong number of columns in SYS_TABLES record");
1553 if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
1555 return(
"incorrect column length in SYS_TABLES");
1558 if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
1562 if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
1567 if (UNIV_UNLIKELY(len != 8)) {
1571 field = rec_get_nth_field_old(rec, 4, &len);
1572 if (UNIV_UNLIKELY(len != 4)) {
1579 if (UNIV_UNLIKELY(len != 4)) {
1584 if (UNIV_UNLIKELY(len != 8)) {
1589 if (UNIV_UNLIKELY(len != 4)) {
1594 if (UNIV_UNLIKELY(len != UNIV_SQL_NULL)) {
1598 field = rec_get_nth_field_old(rec, 9, &len);
1600 if (UNIV_UNLIKELY(len != 4)) {
1608 flags = dict_sys_tables_get_flags(rec);
1610 if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) {
1611 field = rec_get_nth_field_old(rec, 5, &len);
1616 fputs(
" InnoDB: Error: table ", stderr);
1618 fprintf(stderr,
"\n"
1619 "InnoDB: in InnoDB data dictionary"
1620 " has unknown type %lx.\n",
1630 if (n_cols & 0x80000000UL) {
1635 field = rec_get_nth_field_old(rec, 7, &len);
1637 if (UNIV_UNLIKELY(len != 4)) {
1646 fputs(
" InnoDB: Warning: table ", stderr);
1648 fprintf(stderr,
"\n"
1649 "InnoDB: in InnoDB data dictionary"
1650 " has unknown flags %lx.\n",
1660 *table = dict_mem_table_create(name, space, n_cols & ~0x80000000UL,
1663 field = rec_get_nth_field_old(rec, 3, &len);
1668 (*table)->ibd_file_missing = FALSE;
1701 const char* err_msg;
1713 ut_a(name_of_col_is(sys_tables, sys_index, 3,
"ID"));
1714 ut_a(name_of_col_is(sys_tables, sys_index, 4,
"N_COLS"));
1715 ut_a(name_of_col_is(sys_tables, sys_index, 5,
"TYPE"));
1716 ut_a(name_of_col_is(sys_tables, sys_index, 7,
"MIX_LEN"));
1717 ut_a(name_of_col_is(sys_tables, sys_index, 9,
"SPACE"));
1720 dfield = dtuple_get_nth_field(tuple, 0);
1723 dict_index_copy_types(tuple, sys_index, 1);
1725 btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
1740 field = rec_get_nth_field_old(rec, 0, &len);
1748 err_msg = dict_load_table_low(name, rec, &table);
1753 fprintf(stderr,
" InnoDB: %s\n", err_msg);
1757 if (table->
space == 0) {
1759 }
else if (!fil_space_for_table_exists_in_mem(
1771 " InnoDB: error: space object of table ");
1773 fprintf(stderr,
",\n"
1774 "InnoDB: space id %lu did not exist in memory."
1775 " Retrying an open.\n",
1776 (ulong) table->
space);
1778 if (!fil_open_single_table_tablespace(
1793 dict_load_columns(table, heap);
1796 dict_table_add_to_cache(table, heap);
1798 dict_table_add_system_columns(table, heap);
1803 err = dict_load_indexes(table, heap);
1814 }
else if (err == DB_SUCCESS) {
1815 err = dict_load_foreigns(table->
name, TRUE, TRUE);
1817 if (err != DB_SUCCESS) {
1818 dict_table_remove_from_cache(table);
1823 }
else if (!srv_force_recovery) {
1824 dict_table_remove_from_cache(table);
1828 if (err != DB_SUCCESS && table != NULL) {
1830 mutex_enter(&dict_foreign_err_mutex);
1835 " InnoDB: Error: could not make a foreign key"
1836 " definition to match\n"
1837 "InnoDB: the foreign key table"
1838 " or the referenced table!\n"
1839 "InnoDB: The data dictionary of InnoDB is corrupt."
1840 " You may need to drop\n"
1841 "InnoDB: and recreate the foreign key table"
1842 " or the referenced table.\n"
1843 "InnoDB: Submit a detailed bug report"
1844 " to http://bugs.mysql.com\n"
1845 "InnoDB: Latest foreign key error printout:\n%s\n",
1846 dict_foreign_err_buf);
1848 mutex_exit(&dict_foreign_err_mutex);
1861 dict_load_table_on_id(
1863 table_id_t table_id)
1890 sys_table_ids = dict_table_get_next_index(
1891 dict_table_get_first_index(sys_tables));
1896 dfield = dtuple_get_nth_field(tuple, 0);
1902 dict_index_copy_types(tuple, sys_table_ids, 1);
1904 btr_pcur_open_on_user_rec(sys_table_ids, tuple, PAGE_CUR_GE,
1926 field = rec_get_nth_field_old(rec, 0, &len);
1935 field = rec_get_nth_field_old(rec, 1, &len);
1953 dict_load_sys_table(
1963 dict_load_indexes(table, heap);
1972 dict_load_foreign_cols(
2003 dfield = dtuple_get_nth_field(tuple, 0);
2006 dict_index_copy_types(tuple, sys_index, 1);
2008 btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
2010 for (i = 0; i < foreign->
n_fields; i++) {
2017 field = rec_get_nth_field_old(rec, 0, &len);
2021 field = rec_get_nth_field_old(rec, 1, &len);
2025 field = rec_get_nth_field_old(rec, 4, &len);
2027 foreign->
heap, (
char*) field, len);
2029 field = rec_get_nth_field_old(rec, 5, &len);
2031 foreign->
heap, (
char*) field, len);
2049 ibool check_charsets,
2051 ibool check_recursive)
2066 ulint n_fields_and_type;
2082 dfield = dtuple_get_nth_field(tuple, 0);
2085 dict_index_copy_types(tuple, sys_index, 1);
2087 btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
2096 "InnoDB: Error A: cannot load foreign constraint %s\n",
2106 field = rec_get_nth_field_old(rec, 0, &len);
2112 "InnoDB: Error B: cannot load foreign constraint %s\n",
2127 foreign = dict_mem_foreign_create();
2130 rec_get_nth_field_old(rec, 5, &len));
2136 foreign->
type = (
unsigned int) (n_fields_and_type >> 24);
2137 foreign->
n_fields = (
unsigned int) (n_fields_and_type & 0x3FFUL);
2141 field = rec_get_nth_field_old(rec, 3, &len);
2143 foreign->
heap, (
char*) field, len);
2145 field = rec_get_nth_field_old(rec, 4, &len);
2147 foreign->
heap, (
char*) field, len);
2152 dict_load_foreign_cols(
id, foreign);
2190 if (for_table && ref_table && check_recursive) {
2211 return(dict_foreign_add_to_cache(foreign, check_charsets));
2225 const char* table_name,
2226 ibool check_recursive,
2228 ibool check_charsets)
2248 if (sys_foreign == NULL) {
2252 "InnoDB: Error: no foreign key system tables"
2253 " in the database\n");
2264 sec_index = dict_table_get_next_index(
2265 dict_table_get_first_index(sys_foreign));
2270 dfield = dtuple_get_nth_field(tuple, 0);
2273 dict_index_copy_types(tuple, sec_index, 1);
2275 btr_pcur_open_on_user_rec(sec_index, tuple, PAGE_CUR_GE,
2283 goto load_next_index;
2290 field = rec_get_nth_field_old(rec, 0, &len);
2297 dfield_get_type(dfield)->prtype,
2298 static_cast<const unsigned char *>(dfield_get_data(dfield)),
2302 goto load_next_index;
2310 if (0 !=
ut_memcmp(field, table_name, len)) {
2321 field = rec_get_nth_field_old(rec, 1, &len);
2324 btr_pcur_store_position(&pcur, &mtr);
2330 err = dict_load_foreign(
id, check_charsets, check_recursive);
2332 if (err != DB_SUCCESS) {
2352 sec_index = dict_table_get_next_index(sec_index);
2354 if (sec_index != NULL) {
2361 check_recursive = FALSE;