MySQL 8.0.31
Source Code Documentation
Value_generator Class Reference

Used for storing information associated with generated column, default values generated from expression or check constraint expression. More...

#include <field.h>

Public Member Functions

enum_field_types get_real_type () const
 
void set_field_type (enum_field_types fld_type)
 
void backup_stmt_unsafe_flags (uint32 backup_binlog_stmt_flags)
 Set the binary log flags in m_backup_binlog_stmt_flags. More...
 
uint32 get_stmt_unsafe_flags ()
 Get the binary log flags from m_backup_binlog_stmt_flags. More...
 
bool get_field_stored () const
 
void set_field_stored (bool stored)
 
bool register_base_columns (TABLE *table)
 Calculate the base_columns_map and num_non_virtual_base_cols members of this generated column. More...
 
uint non_virtual_base_columns () const
 Get the number of non virtual base columns that this generated column needs. More...
 
void dup_expr_str (MEM_ROOT *root, const char *src, size_t len)
 Duplicates a string into expr_str. More...
 
void print_expr (THD *thd, String *out)
 Writes the generation expression into a String with proper syntax. More...
 

Public Attributes

Itemexpr_item {nullptr}
 Item representing the generation expression. More...
 
LEX_STRING expr_str {nullptr, 0}
 Text of the expression. More...
 
uint32 m_backup_binlog_stmt_flags {0}
 Bit field indicating the type of statement for binary logging. More...
 
Itemitem_list {nullptr}
 List of all items created when parsing and resolving generated expression. More...
 
MY_BITMAP base_columns_map
 Bitmap records base columns which a generated column depends on. More...
 

Private Attributes

enum_field_types field_type {MYSQL_TYPE_INVALID}
 Real field type. More...
 
bool stored_in_db {false}
 Indicates if the field is physically stored in the database. More...
 
uint num_non_virtual_base_cols {0}
 How many non-virtual base columns in base_columns_map. More...
 

Detailed Description

Used for storing information associated with generated column, default values generated from expression or check constraint expression.

Member Function Documentation

◆ backup_stmt_unsafe_flags()

void Value_generator::backup_stmt_unsafe_flags ( uint32  backup_binlog_stmt_flags)
inline

Set the binary log flags in m_backup_binlog_stmt_flags.

Parameters
backup_binlog_stmt_flagsthe flags to be backed up

◆ dup_expr_str()

void Value_generator::dup_expr_str ( MEM_ROOT root,
const char *  src,
size_t  len 
)

Duplicates a string into expr_str.

Parameters
rootMEM_ROOT to use for allocation
srcsource string
lenlength of 'src' in bytes

◆ get_field_stored()

bool Value_generator::get_field_stored ( ) const
inline

◆ get_real_type()

enum_field_types Value_generator::get_real_type ( ) const
inline

◆ get_stmt_unsafe_flags()

uint32 Value_generator::get_stmt_unsafe_flags ( )
inline

Get the binary log flags from m_backup_binlog_stmt_flags.

Returns
the flags backed up by unpack_value_generator

◆ non_virtual_base_columns()

uint Value_generator::non_virtual_base_columns ( ) const
inline

Get the number of non virtual base columns that this generated column needs.

Returns
number of non virtual base columns

◆ print_expr()

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

Writes the generation expression into a String with proper syntax.

Parameters
thdTHD
outoutput String

◆ register_base_columns()

bool Value_generator::register_base_columns ( TABLE table)

Calculate the base_columns_map and num_non_virtual_base_cols members of this generated column.

Parameters
tableTable with the checked field
Return values
trueif error

◆ set_field_stored()

void Value_generator::set_field_stored ( bool  stored)
inline

◆ set_field_type()

void Value_generator::set_field_type ( enum_field_types  fld_type)
inline

Member Data Documentation

◆ base_columns_map

MY_BITMAP Value_generator::base_columns_map

Bitmap records base columns which a generated column depends on.

◆ expr_item

Item* Value_generator::expr_item {nullptr}

Item representing the generation expression.

This is non-NULL for every Field of a TABLE, if that field is a generated column. Contrast this with the Field of a TABLE_SHARE, which has expr_item==NULL even if it's a generated column; that makes sense, as an Item tree cannot be shared.

◆ expr_str

LEX_STRING Value_generator::expr_str {nullptr, 0}

Text of the expression.

Used in only one case:

  • the text read from the DD is put into the Value_generator::expr_str of the Field of the TABLE_SHARE; then this expr_str is used as source to produce expr_item for the Field of every TABLE derived from this TABLE_SHARE.

◆ field_type

enum_field_types Value_generator::field_type {MYSQL_TYPE_INVALID}
private

Real field type.

◆ item_list

Item* Value_generator::item_list {nullptr}

List of all items created when parsing and resolving generated expression.

◆ m_backup_binlog_stmt_flags

uint32 Value_generator::m_backup_binlog_stmt_flags {0}

Bit field indicating the type of statement for binary logging.

It needs to be saved because this is determined only once when it is parsed but it needs to be set on the lex for each statement that uses this value generator. And since unpacking is done once on table open, it will be set for the rest of the statements in bind_value_generator_to_fields.

◆ num_non_virtual_base_cols

uint Value_generator::num_non_virtual_base_cols {0}
private

How many non-virtual base columns in base_columns_map.

◆ stored_in_db

bool Value_generator::stored_in_db {false}
private

Indicates if the field is physically stored in the database.


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