MySQL 9.1.0
Source Code Documentation
Sql_check_constraint_spec Class Reference

Class to represent the check constraint specifications obtained from the SQL statement parse. More...

#include <sql_check_constraint.h>

Public Member Functions

bool pre_validate ()
 Validate check constraint name, perform per item-type to check if the expression is allowed for the check constraint. More...
 
void print_expr (THD *thd, String &out)
 Write check constraint expression into a String with proper syntax. More...
 
bool expr_refers_column (const char *column_name)
 Method to check if column "column_name" referred in the check constraint expression. More...
 

Public Attributes

LEX_STRING name {nullptr, 0}
 Name of the check constraint. More...
 
Itemcheck_expr {nullptr}
 Check constraint expression. More...
 
LEX_STRING column_name {nullptr, 0}
 Name of the column if check clause is defined at the column level. More...
 
bool is_enforced {true}
 Check constraint state (enforced/not enforced) More...
 
bool is_alter_mode {false}
 During ALTER TABLE operation, the state of the Sql_check_constraint_spec instance(s) is set to alter mode in new table definition. More...
 
LEX_STRING alias_name {nullptr, 0}
 Alias name for check constraints. More...
 

Detailed Description

Class to represent the check constraint specifications obtained from the SQL statement parse.

Member Function Documentation

◆ expr_refers_column()

bool Sql_check_constraint_spec::expr_refers_column ( const char *  column_name)

Method to check if column "column_name" referred in the check constraint expression.

Parameters
[in]column_nameColumn name.
Return values
trueIf column name is referenced in the check expression.
falseOtherwise.

◆ pre_validate()

bool Sql_check_constraint_spec::pre_validate ( )

Validate check constraint name, perform per item-type to check if the expression is allowed for the check constraint.

Check expression is pre-validated at this stage. Validation of specific functions in expression is done later in the method open_table_from_share.

Return values
falseSuccess.
trueFailure.

◆ print_expr()

void Sql_check_constraint_spec::print_expr ( THD thd,
String out 
)

Write check constraint expression into a String with proper syntax.

Parameters
[in]thdThread handle.
[out]outCheck constraint expression.

Member Data Documentation

◆ alias_name

LEX_STRING Sql_check_constraint_spec::alias_name {nullptr, 0}

Alias name for check constraints.

◆ check_expr

Item* Sql_check_constraint_spec::check_expr {nullptr}

Check constraint expression.

◆ column_name

LEX_STRING Sql_check_constraint_spec::column_name {nullptr, 0}

Name of the column if check clause is defined at the column level.

◆ is_alter_mode

bool Sql_check_constraint_spec::is_alter_mode {false}

During ALTER TABLE operation, the state of the Sql_check_constraint_spec instance(s) is set to alter mode in new table definition.

In this mode, alias_name is stored to data-dictionary tables to avoid name conflicts. The name of the check constraint is updated to actual name after older table version is either dropped or when new version of table is renamed to actual table name.

◆ is_enforced

bool Sql_check_constraint_spec::is_enforced {true}

Check constraint state (enforced/not enforced)

◆ name

LEX_STRING Sql_check_constraint_spec::name {nullptr, 0}

Name of the check constraint.


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