diff options
Diffstat (limited to 'storage/innobase/include')
-rw-r--r-- | storage/innobase/include/db0err.h | 3 | ||||
-rw-r--r-- | storage/innobase/include/dict0boot.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/dict0crea.h | 13 | ||||
-rw-r--r-- | storage/innobase/include/dict0dict.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/dict0load.h | 28 | ||||
-rw-r--r-- | storage/innobase/include/pars0grm.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/pars0pars.h | 3 | ||||
-rw-r--r-- | storage/innobase/include/row0mysql.h | 12 |
8 files changed, 64 insertions, 1 deletions
diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h index 6cfc63f4a9e..0689327e1a5 100644 --- a/storage/innobase/include/db0err.h +++ b/storage/innobase/include/db0err.h @@ -163,6 +163,9 @@ enum dberr_t { DB_PAGE_CORRUPTED, /* Page read from tablespace is corrupted. */ +#ifdef WITH_INNODB_LEGACY_FOREIGN_STORAGE + DB_LEGACY_FK, +#endif /* WITH_INNODB_LEGACY_FOREIGN_STORAGE */ /* The following are partial failure codes */ DB_FAIL = 1000, DB_OVERFLOW, diff --git a/storage/innobase/include/dict0boot.h b/storage/innobase/include/dict0boot.h index 0f96df8fd9f..8a24bb0c6c0 100644 --- a/storage/innobase/include/dict0boot.h +++ b/storage/innobase/include/dict0boot.h @@ -225,6 +225,7 @@ enum dict_fld_sys_fields_enum { DICT_FLD__SYS_FIELDS__COL_NAME = 4, DICT_NUM_FIELDS__SYS_FIELDS = 5 }; +#ifdef WITH_INNODB_LEGACY_FOREIGN_STORAGE /* The columns in SYS_FOREIGN */ enum dict_col_sys_foreign_enum { DICT_COL__SYS_FOREIGN__ID = 0, @@ -267,6 +268,7 @@ enum dict_fld_sys_foreign_cols_enum { DICT_FLD__SYS_FOREIGN_COLS__REF_COL_NAME = 5, DICT_NUM_FIELDS__SYS_FOREIGN_COLS = 6 }; +#endif /* WITH_INNODB_LEGACY_FOREIGN_STORAGE */ /* The columns in SYS_TABLESPACES */ enum dict_col_sys_tablespaces_enum { DICT_COL__SYS_TABLESPACES__SPACE = 0, diff --git a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict0crea.h index e2b793a0610..ab908fdf107 100644 --- a/storage/innobase/include/dict0crea.h +++ b/storage/innobase/include/dict0crea.h @@ -113,6 +113,17 @@ dict_create_index_tree_in_mem( dict_index_t* index, /*!< in/out: index */ const trx_t* trx); /*!< in: InnoDB transaction handle */ +#ifdef WITH_INNODB_LEGACY_FOREIGN_STORAGE +/****************************************************************//** +Creates the foreign key constraints system tables inside InnoDB +at server bootstrap or server start if they are not found or are +not of the right form. +@return DB_SUCCESS or error code */ +dberr_t +dict_create_or_check_foreign_constraint_tables(void); +/*================================================*/ +#endif /* WITH_INNODB_LEGACY_FOREIGN_STORAGE */ + /********************************************************************//** Generate a foreign key constraint name when it was not named by the user. A generated constraint has a name of the format dbname/tablename_ibfk_NUMBER, @@ -171,6 +182,7 @@ dict_replace_tablespace_in_dictionary( const char* path, trx_t* trx); +#ifdef WITH_INNODB_LEGACY_FOREIGN_STORAGE /********************************************************************//** Construct foreign key constraint defintion from data dictionary information. */ @@ -180,6 +192,7 @@ dict_foreign_def_get( /*=================*/ dict_foreign_t* foreign,/*!< in: foreign */ trx_t* trx); /*!< in: trx */ +#endif /* WITH_INNODB_LEGACY_FOREIGN_STORAGE */ /* Table create node structure */ struct tab_node_t{ diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index b5319d51c9a..2edadb9ede5 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -462,6 +462,7 @@ dict_foreign_replace_index( to use table->col_names */ const dict_index_t* index) /*!< in: index to be replaced */ MY_ATTRIBUTE((nonnull(1,3), warn_unused_result)); +#ifdef WITH_INNODB_LEGACY_FOREIGN_STORAGE /**********************************************************************//** Parses the CONSTRAINT id's to be dropped in an ALTER TABLE statement. @return DB_SUCCESS or DB_CANNOT_DROP_CONSTRAINT if syntax error or the @@ -478,6 +479,7 @@ dict_foreign_parse_drop_constraints( const char*** constraints_to_drop) /*!< out: id's of the constraints to drop */ MY_ATTRIBUTE((nonnull, warn_unused_result)); +#endif /* WITH_INNODB_LEGACY_FOREIGN_STORAGE */ /**********************************************************************//** Returns a table object and increments its open handle count. NOTE! This is a high-level function to be used mainly from outside the diff --git a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict0load.h index 63661f062b7..e241b7ade71 100644 --- a/storage/innobase/include/dict0load.h +++ b/storage/innobase/include/dict0load.h @@ -201,6 +201,34 @@ dict_process_sys_fields_rec( ulint* pos, /*!< out: Field position */ index_id_t* index_id, /*!< out: current index id */ index_id_t last_id); /*!< in: previous index id */ +#ifdef WITH_INNODB_LEGACY_FOREIGN_STORAGE +/********************************************************************//** +This function parses a SYS_FOREIGN record and populate a dict_foreign_t +structure with the information from the record. For detail information +about SYS_FOREIGN fields, please refer to dict_load_foreign() function +@return error message, or NULL on success */ +const char* +dict_process_sys_foreign_rec( +/*=========================*/ + mem_heap_t* heap, /*!< in/out: heap memory */ + const rec_t* rec, /*!< in: current SYS_FOREIGN rec */ + dict_foreign_t* foreign); /*!< out: dict_foreign_t to be + filled */ +/********************************************************************//** +This function parses a SYS_FOREIGN_COLS record and extract necessary +information from the record and return to caller. +@return error message, or NULL on success */ +const char* +dict_process_sys_foreign_col_rec( +/*=============================*/ + mem_heap_t* heap, /*!< in/out: heap memory */ + const rec_t* rec, /*!< in: current SYS_FOREIGN_COLS rec */ + const char** name, /*!< out: foreign key constraint name */ + const char** for_col_name, /*!< out: referencing column name */ + const char** ref_col_name, /*!< out: referenced column name + in referenced table */ + ulint* pos); /*!< out: column position */ +#endif /* WITH_INNODB_LEGACY_FOREIGN_STORAGE */ /********************************************************************//** This function parses a SYS_TABLESPACES record, extracts necessary information from the record and returns to caller. diff --git a/storage/innobase/include/pars0grm.h b/storage/innobase/include/pars0grm.h index 58d424abfdc..4d232352efa 100644 --- a/storage/innobase/include/pars0grm.h +++ b/storage/innobase/include/pars0grm.h @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.4.2. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison interface for Yacc-like parsers in C diff --git a/storage/innobase/include/pars0pars.h b/storage/innobase/include/pars0pars.h index 03aa72d3be8..acb44598bb7 100644 --- a/storage/innobase/include/pars0pars.h +++ b/storage/innobase/include/pars0pars.h @@ -583,6 +583,9 @@ struct pars_info_t { ibool graph_owns_us; /*!< if TRUE (which is the default), que_graph_free() will free us */ +#ifdef UNIV_DEBUG + bool fatal_syntax_err; +#endif /* UNIV_DEBUG */ }; /** User-supplied function and argument. */ diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index c4163f8d2e0..8433a82fddf 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -940,4 +940,16 @@ void row_wait_for_background_drop_list_empty(); #endif /* UNIV_DEBUG */ +#ifdef WITH_INNODB_LEGACY_FOREIGN_STORAGE +struct row_drop_table_check_legacy_data +{ + char foreign_name[MAX_FULL_NAME_LEN + 1]; + bool found; + row_drop_table_check_legacy_data() : found(false) {} +}; + +dberr_t row_drop_table_check_legacy_fk(trx_t* trx, const char * table_name, + row_drop_table_check_legacy_data &d); +#endif /* WITH_INNODB_LEGACY_FOREIGN_STORAGE */ + #endif /* row0mysql.h */ |