MySQL 8.0.39
Source Code Documentation
Foreign_key_spec Class Reference

#include <key_spec.h>

Inheritance diagram for Foreign_key_spec:
[legend]

Public Member Functions

 Foreign_key_spec (MEM_ROOT *mem_root, const LEX_CSTRING &name_arg, List< Key_part_spec > cols, const LEX_CSTRING &ref_db_arg, const LEX_CSTRING &orig_ref_db_arg, const LEX_CSTRING &ref_table_arg, const LEX_CSTRING &orig_ref_table_arg, List< Key_part_spec > *ref_cols, fk_option delete_opt_arg, fk_option update_opt_arg, fk_match_opt match_opt_arg)
 
bool validate (THD *thd, const char *table_name, List< Create_field > &table_fields) const
 Check if the foreign key name has valid length and its options are compatible with columns on which the FK is created. More...
 
- Public Member Functions inherited from Key_spec
 Key_spec (MEM_ROOT *mem_root, keytype type_par, const LEX_CSTRING &name_arg, const KEY_CREATE_INFO *key_info_arg, bool generated_arg, bool check_for_duplicate_indexes_arg, List< Key_part_spec > &cols)
 
virtual ~Key_spec ()=default
 

Public Attributes

const LEX_CSTRING ref_db
 
const LEX_CSTRING orig_ref_db
 
const LEX_CSTRING ref_table
 
const LEX_CSTRING orig_ref_table
 
Mem_root_array< Key_part_spec * > ref_columns
 
const fk_option delete_opt
 
const fk_option update_opt
 
const fk_match_opt match_opt
 
const bool has_explicit_name
 Indicates whether foreign key name was provided explicitly or was generated automatically. More...
 
- Public Attributes inherited from Key_spec
const keytype type
 
const KEY_CREATE_INFO key_create_info
 
Mem_root_array< Key_part_spec * > columns
 
LEX_CSTRING name
 
const bool generated
 
const bool check_for_duplicate_indexes
 A flag to determine if we will check for duplicate indexes. More...
 

Constructor & Destructor Documentation

◆ Foreign_key_spec()

Foreign_key_spec::Foreign_key_spec ( MEM_ROOT mem_root,
const LEX_CSTRING name_arg,
List< Key_part_spec cols,
const LEX_CSTRING ref_db_arg,
const LEX_CSTRING orig_ref_db_arg,
const LEX_CSTRING ref_table_arg,
const LEX_CSTRING orig_ref_table_arg,
List< Key_part_spec > *  ref_cols,
fk_option  delete_opt_arg,
fk_option  update_opt_arg,
fk_match_opt  match_opt_arg 
)
inline

Member Function Documentation

◆ validate()

bool Foreign_key_spec::validate ( THD thd,
const char *  table_name,
List< Create_field > &  table_fields 
) const

Check if the foreign key name has valid length and its options are compatible with columns on which the FK is created.

Parameters
thdThread handle
table_nameTable name (for error reporting)
table_fieldsList of columns
Return values
falseKey valid
trueKey invalid

Member Data Documentation

◆ delete_opt

const fk_option Foreign_key_spec::delete_opt

◆ has_explicit_name

const bool Foreign_key_spec::has_explicit_name

Indicates whether foreign key name was provided explicitly or was generated automatically.

See also
prepare_foreign_key().

◆ match_opt

const fk_match_opt Foreign_key_spec::match_opt

◆ orig_ref_db

const LEX_CSTRING Foreign_key_spec::orig_ref_db

◆ orig_ref_table

const LEX_CSTRING Foreign_key_spec::orig_ref_table

◆ ref_columns

Mem_root_array<Key_part_spec *> Foreign_key_spec::ref_columns

◆ ref_db

const LEX_CSTRING Foreign_key_spec::ref_db

◆ ref_table

const LEX_CSTRING Foreign_key_spec::ref_table

◆ update_opt

const fk_option Foreign_key_spec::update_opt

The documentation for this class was generated from the following files: