MySQL 8.0.39
Source Code Documentation
|
Base class to resolve constraints type for the constraints specified in the ALTER TABLE ... DROP/ALTER CONSTRAINT operation. More...
#include <sql_constraint.h>
Public Member Functions | |
Constraint_type_resolver (Alter_info *alter_info) | |
virtual | ~Constraint_type_resolver ()=default |
virtual bool | is_type_resolution_needed () const =0 |
Method to check if constraint type resolution is needed. More... | |
virtual bool | resolve_constraints_type (THD *thd, const TABLE *src_table, const dd::Table *dd_src_table)=0 |
Method to resolve constraints type. More... | |
Protected Member Functions | |
KEY * | is_primary_or_unique_constraint (const TABLE *src_table, const char *name) |
Helper method to check if "name" type is PRIMARY or UNIQUE constraint. More... | |
bool | is_referential_constraint (const dd::Table *dd_src_table, const char *name) |
Helper method to check if "name" type is REFERENTIAL constraint. More... | |
bool | is_check_constraint (const TABLE *src_table, const char *name) |
Helper method to check if "name" type is CHECK constraint. More... | |
Protected Attributes | |
Alter_info * | m_alter_info |
Alter_info instance describing table being altered. More... | |
Base class to resolve constraints type for the constraints specified in the ALTER TABLE ... DROP/ALTER CONSTRAINT operation.
For a constraint specified in the DROP/ALTER CONSTRAINT operations of a ALTER TABLE statement, actual constraint type is unknown. This is the class to resolve the actual constraint type (PRIMARY, UNIQUE, FOREIGN KEY or CHECK) of a constraint by name. Changes to Alter_info instance are reverted in the destructor to make operation safe for re-execution of a stored routines and prepared statements.
|
inlineexplicit |
|
virtualdefault |
|
protected |
Helper method to check if "name" type is CHECK constraint.
src_table | TABLE instance of a source table. |
name | Constraint name. |
true | If "name" type is CHECK. |
false | Otherwise. |
|
protected |
Helper method to check if "name" type is PRIMARY or UNIQUE constraint.
src_table | TABLE instance of a source table. |
name | Constraint name. |
non-nullptr | Returns pointer to KEY instance if "name" is PRIMARY or UNIQUE constraint. |
nullptr | Otherwise. |
|
protected |
Helper method to check if "name" type is REFERENTIAL constraint.
dd_src_table | Data-dictionary table instance of a source table. |
name | Constraint name. |
true | If "name" type is REFERENTIAL. |
false | Otherwise. |
|
pure virtual |
Method to check if constraint type resolution is needed.
true | if ALTER TABLE statement has DROP/ALTER CONSTRAINT operations. |
false | Otherwise. |
Implemented in Drop_constraint_type_resolver, and Enforce_constraint_type_resolver.
|
pure virtual |
Method to resolve constraints type.
thd | Thread handle. |
src_table | TABLE instance of a source table. |
dd_src_table | Data-dictionary table instance of a source table. |
false | Success. |
true | Failure. |
Implemented in Drop_constraint_type_resolver, and Enforce_constraint_type_resolver.
|
protected |
Alter_info instance describing table being altered.