MySQL 9.1.0
Source Code Documentation
|
Classes | |
struct | Handlerton_pair |
class | Replace_field_processor_arg |
This class is used as an input argument to Item::walk, and takes care of replacing the field pointer in Item_field with pointers to a Create_field_wrapper. More... | |
struct | sort_keys |
struct | Viability |
Typedefs | |
using | Viability_error_emitter = std::function< void(const char *engine_name)> |
using | Viability_substitution_warning_emitter = std::function< void(THD *, const char *requested_engine_name, const char *substituted_engine_name, const char *table_name)> |
Functions | |
bool | is_temp_table (const HA_CREATE_INFO &ci) |
bool | is_engine_specified (const HA_CREATE_INFO &ci) |
handlerton * | default_handlerton (THD *thd, const HA_CREATE_INFO &ci) |
handlerton * | requested_handlerton (THD *thd, const HA_CREATE_INFO &ci) |
Viability | get_viability (const handlerton &hton, const HA_CREATE_INFO &ci) |
handlerton * | get_viable_handlerton_for_create_impl (THD *thd, const char *table_name, const HA_CREATE_INFO &ci, Handlerton_pair hp) |
handlerton * | get_viable_handlerton_for_create_like (THD *thd, const char *table_name, const HA_CREATE_INFO &ci, handlerton *source) |
Check if source is enabled AND NOT explicitly disabled (listed in the disabled_storages_engines system variable. More... | |
handlerton * | get_viable_handlerton_for_alter (THD *thd, const HA_CREATE_INFO &ci, handlerton *existing) |
Does nothing (returns existing) unless ALTER changes the ENGINE. More... | |
const dd::Index * | find_fk_parent_key (THD *thd, handlerton *hton, const dd::Index *supporting_key, const dd::Table *parent_table_def, const dd::Foreign_key *fk) |
Find parent key which matches the foreign key. More... | |
bool | fk_is_key_exact_match_order (Alter_info *alter_info, FOREIGN_KEY *fk, const KEY *key) |
Check if candidate parent key contains exactly the same columns as the foreign key in same order. More... | |
void | report_fk_index_error (THD *thd, const char *fk_name, const char *table_name) |
Report new error code ER_FK_NO_UNIQUE_INDEX_PARENT when session variable restrict_fk_on_non_standard_key is ON and ER_FK_NO_INDEX_PARENT when it if OFF. More... | |
void | warn_fk_on_non_standard_key (THD *thd, const char *key_name) |
Raise warning when foreign key is created on non-unique key or partial key, increment the deprecated fk usage count, and last time stamp it occurred. More... | |
template<class F > | |
bool | fk_is_key_exact_match_order (uint fk_col_count, const F &fk_columns, const dd::Index *idx) |
Check if candidate parent/supporting key contains exactly the same columns as the foreign key in same order. More... | |
template<class F > | |
const dd::Index * | find_fk_parent_key (THD *thd, handlerton *hton, const dd::Index *supporting_key, const dd::Table *parent_table_def, const char *fk_name, uint fk_col_count, const F &fk_columns) |
Find parent key which matches the foreign key. More... | |
bool | prepare_fk_parent_key (THD *thd, handlerton *hton, const dd::Table *parent_table_def, FOREIGN_KEY *fk) |
using anonymous_namespace{sql_table.cc}::Viability_error_emitter = typedef std::function<void(const char *engine_name)> |
using anonymous_namespace{sql_table.cc}::Viability_substitution_warning_emitter = typedef std::function<void( THD *, const char *requested_engine_name, const char *substituted_engine_name, const char *table_name)> |
handlerton * anonymous_namespace{sql_table.cc}::default_handlerton | ( | THD * | thd, |
const HA_CREATE_INFO & | ci | ||
) |
const dd::Index * anonymous_namespace{sql_table.cc}::find_fk_parent_key | ( | THD * | thd, |
handlerton * | hton, | ||
const dd::Index * | supporting_key, | ||
const dd::Table * | parent_table_def, | ||
const char * | fk_name, | ||
uint | fk_col_count, | ||
const F & | fk_columns | ||
) |
Find parent key which matches the foreign key.
Prefer unique key if possible.
F | Function class which returns foreign key's column name by its index. |
thd | Thread handle. |
hton | Handlerton for tables' storage engine. Used to figure out what kind of parent keys are supported by the storage engine.. |
supporting_key | Supporting key of the child. Needed to skip supporting keys as candidate parent keys for self referencing FKs. |
parent_table_def | dd::Table object describing the parent table. |
fk_name | Foreign key name. |
fk_col_count | Number of columns in the foreign key. |
fk_columns | Object of F type bound to the specific foreign key for which parent key check is carried out. |
non-nullptr | - pointer to dd::Index object describing the parent key. |
nullptr | - if no parent key were found. |
const dd::Index *anonymous_namespace sql_table anonymous_namespace{sql_table.cc}::cc::find_fk_parent_key | ( | THD * | thd, |
handlerton * | hton, | ||
const dd::Index * | supporting_key, | ||
const dd::Table * | parent_table_def, | ||
const dd::Foreign_key * | fk | ||
) |
Find parent key which matches the foreign key.
Prefer unique key if possible.
hton | Handlerton for tables' storage engine. |
supporting_key | Supporting key of the child. Needed to skip supporting keys as candidate parent keys for self referencing FKs. |
parent_table_def | dd::Table object describing the parent table. |
fk | dd::Foreign_key object describing the foreign key. |
non-nullptr | - pointer to dd::Index object describing the parent key. |
nullptr | - if no parent key were found. |
bool anonymous_namespace{sql_table.cc}::fk_is_key_exact_match_order | ( | Alter_info * | alter_info, |
FOREIGN_KEY * | fk, | ||
const KEY * | key | ||
) |
Check if candidate parent key contains exactly the same columns as the foreign key in same order.
alter_info | Alter_info object describing parent table. |
fk | FOREIGN_KEY object describing the foreign key. |
key | Pointer to KEY representing the parent index. |
True | - Key is proper parent key for the foreign key. |
False | - Key can't be parent key for the foreign key. |
bool anonymous_namespace{sql_table.cc}::fk_is_key_exact_match_order | ( | uint | fk_col_count, |
const F & | fk_columns, | ||
const dd::Index * | idx | ||
) |
Check if candidate parent/supporting key contains exactly the same columns as the foreign key in same order.
F | Function class which returns foreign key's referenced or referencing (depending on whether we check candidate parent or supporting key) column name by its index. |
fk_col_count | Number of columns in the foreign key. |
fk_columns | Object of F type bound to the specific foreign key for which parent/supporting key check is carried out. |
idx | dd::Index object describing candidate parent/ supporting key. |
True | - Key is proper parent/supporting key for the foreign key. |
False | - Key can't be parent/supporting key for the foreign key. |
Viability anonymous_namespace{sql_table.cc}::get_viability | ( | const handlerton & | hton, |
const HA_CREATE_INFO & | ci | ||
) |
handlerton * anonymous_namespace{sql_table.cc}::get_viable_handlerton_for_alter | ( | THD * | thd, |
const HA_CREATE_INFO & | ci, | ||
handlerton * | existing | ||
) |
Does nothing (returns existing) unless ALTER changes the ENGINE.
The handlerton for the specified ENGINE is considered viable if it is enabled AND NOT explicitly disabled (listed in the disabled_storages_engines system variable).
If the specified handleton is not viable it falls back to existing if substitution is allowed. existing is used without further checking, and ER_UNKNOWN_STORAGE_ENGINE is emitted as warning.
thd | Thread handler. |
ci | create info struct from parser. |
existing | Handlerton requested by query. |
existing | if ENGINE is not specified or is the same as existing, or if ENGINE is not viable and substitution is permitted. |
Handlerton | of specified engine if this is viable. |
nullptr | if error (specified engine not viable and substitution not permitted). |
handlerton * anonymous_namespace{sql_table.cc}::get_viable_handlerton_for_create_impl | ( | THD * | thd, |
const char * | table_name, | ||
const HA_CREATE_INFO & | ci, | ||
Handlerton_pair | hp | ||
) |
handlerton * anonymous_namespace{sql_table.cc}::get_viable_handlerton_for_create_like | ( | THD * | thd, |
const char * | table_name, | ||
const HA_CREATE_INFO & | ci, | ||
handlerton * | source | ||
) |
Check if source is enabled AND NOT explicitly disabled (listed in the disabled_storages_engines system variable.
If not; falls back to the default (tmp) storage engine if substitution is allowed, unless this is also disabled.
Otherwise, if substitution does take place, ER_DISABLED_STORAGE_ENGINE and ER_USING_OTHER_HANDLER are emitted as warnings.
For temporary tables the above also applies, and in addition the source handlerton is checked to see if it supports temporary tables.
Note that this substitution is allowed even when no_substitution is ON, but will fail if the default handlerton for temporary tables is disabled or does not support temporary tables (unlikely).
thd | Thread handler. |
table_name | Table name. |
ci | create info struct from parser. |
source | Handlerton requested by query. |
source | if this is viable. |
The | default hton if viable and engine substitution is allowed. |
The | default temp hton if viable and a temporary table and source does not support temporary tables. |
nullptr | if error (source not viable and substitution not possible). |
bool anonymous_namespace{sql_table.cc}::is_engine_specified | ( | const HA_CREATE_INFO & | ci | ) |
bool anonymous_namespace{sql_table.cc}::is_temp_table | ( | const HA_CREATE_INFO & | ci | ) |
bool anonymous_namespace{sql_table.cc}::prepare_fk_parent_key | ( | THD * | thd, |
handlerton * | hton, | ||
const dd::Table * | parent_table_def, | ||
FOREIGN_KEY * | fk | ||
) |
void anonymous_namespace{sql_table.cc}::report_fk_index_error | ( | THD * | thd, |
const char * | fk_name, | ||
const char * | table_name | ||
) |
Report new error code ER_FK_NO_UNIQUE_INDEX_PARENT when session variable restrict_fk_on_non_standard_key is ON and ER_FK_NO_INDEX_PARENT when it if OFF.
thd | Thread handle. |
fk_name | Name of the foreign key. |
table_name | Name of the referenced table name. |
handlerton * anonymous_namespace{sql_table.cc}::requested_handlerton | ( | THD * | thd, |
const HA_CREATE_INFO & | ci | ||
) |
void anonymous_namespace{sql_table.cc}::warn_fk_on_non_standard_key | ( | THD * | thd, |
const char * | key_name | ||
) |
Raise warning when foreign key is created on non-unique key or partial key, increment the deprecated fk usage count, and last time stamp it occurred.
thd | Thread handle. |
key_name | Name of the index key name. |