MySQL 9.0.0
Source Code Documentation
Constraint_type_resolver Class Referenceabstract

Base class to resolve constraints type for the constraints specified in the ALTER TABLE ... DROP/ALTER CONSTRAINT operation. More...

#include <sql_constraint.h>

Inheritance diagram for Constraint_type_resolver:
[legend]

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

KEYis_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_infom_alter_info
 Alter_info instance describing table being altered. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Constraint_type_resolver()

Constraint_type_resolver::Constraint_type_resolver ( Alter_info alter_info)
inlineexplicit

◆ ~Constraint_type_resolver()

virtual Constraint_type_resolver::~Constraint_type_resolver ( )
virtualdefault

Member Function Documentation

◆ is_check_constraint()

bool Constraint_type_resolver::is_check_constraint ( const TABLE src_table,
const char *  name 
)
protected

Helper method to check if "name" type is CHECK constraint.

Parameters
src_tableTABLE instance of a source table.
nameConstraint name.
Return values
trueIf "name" type is CHECK.
falseOtherwise.

◆ is_primary_or_unique_constraint()

KEY * Constraint_type_resolver::is_primary_or_unique_constraint ( const TABLE src_table,
const char *  name 
)
protected

Helper method to check if "name" type is PRIMARY or UNIQUE constraint.

Parameters
src_tableTABLE instance of a source table.
nameConstraint name.
Return values
non-nullptrReturns pointer to KEY instance if "name" is PRIMARY or UNIQUE constraint.
nullptrOtherwise.

◆ is_referential_constraint()

bool Constraint_type_resolver::is_referential_constraint ( const dd::Table dd_src_table,
const char *  name 
)
protected

Helper method to check if "name" type is REFERENTIAL constraint.

Parameters
dd_src_tableData-dictionary table instance of a source table.
nameConstraint name.
Return values
trueIf "name" type is REFERENTIAL.
falseOtherwise.

◆ is_type_resolution_needed()

virtual bool Constraint_type_resolver::is_type_resolution_needed ( ) const
pure virtual

Method to check if constraint type resolution is needed.

Return values
trueif ALTER TABLE statement has DROP/ALTER CONSTRAINT operations.
falseOtherwise.

Implemented in Drop_constraint_type_resolver, and Enforce_constraint_type_resolver.

◆ resolve_constraints_type()

virtual bool Constraint_type_resolver::resolve_constraints_type ( THD thd,
const TABLE src_table,
const dd::Table dd_src_table 
)
pure virtual

Method to resolve constraints type.

Parameters
thdThread handle.
src_tableTABLE instance of a source table.
dd_src_tableData-dictionary table instance of a source table.
Return values
falseSuccess.
trueFailure.

Implemented in Drop_constraint_type_resolver, and Enforce_constraint_type_resolver.

Member Data Documentation

◆ m_alter_info

Alter_info* Constraint_type_resolver::m_alter_info
protected

Alter_info instance describing table being altered.


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