MySQL  8.0.22
Source Code Documentation
dd::Object_table_definition_impl Class Reference

#include <object_table_definition_impl.h>

Inheritance diagram for dd::Object_table_definition_impl:
dd::Object_table_definition

Public Types

typedef std::map< String_type, int > Element_numbers
 
typedef std::map< int, String_typeElement_definitions
 

Public Member Functions

 Object_table_definition_impl ()
 
 Object_table_definition_impl (const String_type &schema_name, const String_type &table_name, const String_type &ddl_statement)
 
 ~Object_table_definition_impl () override
 
const String_typeget_table_name () const
 
void set_table_name (const String_type &name) override
 Set the name of the table. More...
 
void set_schema_name (const String_type &name)
 
void add_field (int field_number, const String_type &field_name, const String_type field_definition) override
 Add a field to the object table definition. More...
 
void add_sql_mode_field (int field_number, const String_type &field_name)
 
void add_index (int index_number, const String_type &index_name, const String_type &index_definition) override
 Add an index to the object table definition. More...
 
virtual void add_foreign_key (int foreign_key_number, const String_type &foreign_key_name, const String_type &foreign_key_definition)
 
virtual void add_option (int option_number, const String_type &option_name, const String_type &option_definition)
 
virtual void add_populate_statement (const String_type &statement)
 
virtual int field_number (const String_type &field_name) const
 
virtual int index_number (const String_type &index_name) const
 
virtual int option_number (const String_type &option_name) const
 
String_type get_ddl () const override
 Get the SQL DDL statement for creating the dictionary table. More...
 
const std::vector< String_type > & get_dml () const override
 Get the SQL DML statements for populating the table. More...
 
void store_into_properties (Properties *table_def_properties) const override
 Store the elements of the object table definition into a property object. More...
 
virtual bool restore_from_string (const String_type &ddl_statement)
 
bool restore_from_properties (const Properties &table_def_properties) override
 Restore the elements of the object table definition from a property object. More...
 
- Public Member Functions inherited from dd::Object_table_definition
virtual ~Object_table_definition ()
 

Static Public Member Functions

static void set_dd_tablespace_encrypted (bool is_encrypted)
 
static bool is_dd_tablespace_encrypted ()
 
static const CHARSET_INFOfs_name_collation ()
 Get the collation which is used for names related to the file system (e.g. More...
 
static const CHARSET_INFOname_collation ()
 Get the collation which is used for the name field in the table. More...
 
static const char * fs_name_case (const String_type &src, char *buf)
 Convert to lowercase if lower_case_table_names == 2. More...
 

Private Types

enum  Label {
  Label::NAME, Label::FIELDS, Label::INDEXES, Label::FOREIGN_KEYS,
  Label::OPTIONS, Label::LABEL, Label::POSITION, Label::DEFINITION,
  Label::ELEMENT
}
 

Private Member Functions

void add_element (int element_number, const String_type &element_name, const String_type &element_definition, Element_numbers *element_numbers, Element_definitions *element_definitions)
 
int element_number (const String_type &element_name, const Element_numbers &element_numbers) const
 
void get_element_properties (dd::Properties *properties, const Element_numbers &element_numbers, const Element_definitions &element_defs) const
 
bool set_element_properties (const String_type &prop_str, Element_numbers *element_numbers, Element_definitions *element_defs)
 

Static Private Member Functions

static const char * key (Label label)
 

Private Attributes

String_type m_schema_name
 
String_type m_table_name
 
String_type m_ddl_statement
 
Element_numbers m_field_numbers
 
Element_definitions m_field_definitions
 
Element_numbers m_index_numbers
 
Element_definitions m_index_definitions
 
Element_numbers m_foreign_key_numbers
 
Element_definitions m_foreign_key_definitions
 
Element_numbers m_option_numbers
 
Element_definitions m_option_definitions
 
std::vector< String_typem_dml_statements
 

Static Private Attributes

static bool s_dd_tablespace_encrypted = false
 

Member Typedef Documentation

◆ Element_definitions

◆ Element_numbers

Member Enumeration Documentation

◆ Label

Enumerator
NAME 
FIELDS 
INDEXES 
FOREIGN_KEYS 
OPTIONS 
LABEL 
POSITION 
DEFINITION 
ELEMENT 

Constructor & Destructor Documentation

◆ Object_table_definition_impl() [1/2]

dd::Object_table_definition_impl::Object_table_definition_impl ( )
inline

◆ Object_table_definition_impl() [2/2]

dd::Object_table_definition_impl::Object_table_definition_impl ( const String_type schema_name,
const String_type table_name,
const String_type ddl_statement 
)
inline

◆ ~Object_table_definition_impl()

dd::Object_table_definition_impl::~Object_table_definition_impl ( )
inlineoverride

Member Function Documentation

◆ add_element()

void dd::Object_table_definition_impl::add_element ( int  element_number,
const String_type element_name,
const String_type element_definition,
Element_numbers element_numbers,
Element_definitions element_definitions 
)
inlineprivate

◆ add_field()

void dd::Object_table_definition_impl::add_field ( int  field_number,
const String_type field_name,
const String_type  field_definition 
)
inlineoverridevirtual

Add a field to the object table definition.

Parameters
field_numberPositional index of the field.
field_nameLabel which can be used to refer to the field.
field_definitionComplete field definition with name, type etc.

Implements dd::Object_table_definition.

◆ add_foreign_key()

virtual void dd::Object_table_definition_impl::add_foreign_key ( int  foreign_key_number,
const String_type foreign_key_name,
const String_type foreign_key_definition 
)
inlinevirtual

◆ add_index()

void dd::Object_table_definition_impl::add_index ( int  index_number,
const String_type index_name,
const String_type index_definition 
)
inlineoverridevirtual

Add an index to the object table definition.

Parameters
index_numberPositional index (sic!) of the index.
index_nameLabel which can be used to refer to the index.
index_definitionComplete index definition.

Implements dd::Object_table_definition.

◆ add_option()

virtual void dd::Object_table_definition_impl::add_option ( int  option_number,
const String_type option_name,
const String_type option_definition 
)
inlinevirtual

◆ add_populate_statement()

virtual void dd::Object_table_definition_impl::add_populate_statement ( const String_type statement)
inlinevirtual

◆ add_sql_mode_field()

void dd::Object_table_definition_impl::add_sql_mode_field ( int  field_number,
const String_type field_name 
)

◆ element_number()

int dd::Object_table_definition_impl::element_number ( const String_type element_name,
const Element_numbers element_numbers 
) const
inlineprivate

◆ field_number()

virtual int dd::Object_table_definition_impl::field_number ( const String_type field_name) const
inlinevirtual

◆ fs_name_case()

static const char* dd::Object_table_definition_impl::fs_name_case ( const String_type src,
char *  buf 
)
inlinestatic

Convert to lowercase if lower_case_table_names == 2.

This is needed e.g when reconstructing name keys from a dictionary object in order to remove the object.

Parameters
srcString to possibly convert to lowercase.
[in,out]bufBuffer for storing lowercase'd string. Supplied by the caller.
Return values
Apointer to the src string if l_c_t_n != 2
Apointer to the buf supplied by the caller, into which the src string has been copied and lowercase'd, if l_c_t_n == 2

◆ fs_name_collation()

static const CHARSET_INFO* dd::Object_table_definition_impl::fs_name_collation ( )
inlinestatic

Get the collation which is used for names related to the file system (e.g.

a schema name or table name). This collation is case sensitive or not, depending on the setting of lower_case- table_names.

Returns
Pointer to CHARSET_INFO.

◆ get_ddl()

String_type dd::Object_table_definition_impl::get_ddl ( ) const
overridevirtual

Get the SQL DDL statement for creating the dictionary table.

Returns
String containing the SQL DDL statement for the target table.

Implements dd::Object_table_definition.

◆ get_dml()

const std::vector<String_type>& dd::Object_table_definition_impl::get_dml ( ) const
inlineoverridevirtual

Get the SQL DML statements for populating the table.

Returns
Vector of strings containing SQL DML statements

Implements dd::Object_table_definition.

◆ get_element_properties()

void dd::Object_table_definition_impl::get_element_properties ( dd::Properties properties,
const Element_numbers element_numbers,
const Element_definitions element_defs 
) const
private

◆ get_table_name()

const String_type& dd::Object_table_definition_impl::get_table_name ( ) const
inline

◆ index_number()

virtual int dd::Object_table_definition_impl::index_number ( const String_type index_name) const
inlinevirtual

◆ is_dd_tablespace_encrypted()

static bool dd::Object_table_definition_impl::is_dd_tablespace_encrypted ( )
inlinestatic

◆ key()

static const char* dd::Object_table_definition_impl::key ( Label  label)
inlinestaticprivate

◆ name_collation()

static const CHARSET_INFO* dd::Object_table_definition_impl::name_collation ( )
inlinestatic

Get the collation which is used for the name field in the table.

Table collation UTF8_BIN is used when collation for the name field is not specified. Tables using different collation must override this method.

TODO: Changing table collation is not supporting during upgrade as of now. To support this, static definition of this method should be avoided and should provide a possibility to have different collations for actual and target table definition.

Returns
Pointer to CHARSET_INFO.

◆ option_number()

virtual int dd::Object_table_definition_impl::option_number ( const String_type option_name) const
inlinevirtual

◆ restore_from_properties()

bool dd::Object_table_definition_impl::restore_from_properties ( const Properties table_def_properties)
overridevirtual

Restore the elements of the object table definition from a property object.

Parameters
table_def_propertiesProperties object containing the definition.
Returns
Operation outcome, false if no error.

Implements dd::Object_table_definition.

◆ restore_from_string()

virtual bool dd::Object_table_definition_impl::restore_from_string ( const String_type ddl_statement)
inlinevirtual

◆ set_dd_tablespace_encrypted()

static void dd::Object_table_definition_impl::set_dd_tablespace_encrypted ( bool  is_encrypted)
inlinestatic

◆ set_element_properties()

bool dd::Object_table_definition_impl::set_element_properties ( const String_type prop_str,
Element_numbers element_numbers,
Element_definitions element_defs 
)
private

◆ set_schema_name()

void dd::Object_table_definition_impl::set_schema_name ( const String_type name)
inline

◆ set_table_name()

void dd::Object_table_definition_impl::set_table_name ( const String_type name)
inlineoverridevirtual

Set the name of the table.

Parameters
nameTable name.

Implements dd::Object_table_definition.

◆ store_into_properties()

void dd::Object_table_definition_impl::store_into_properties ( Properties table_def_properties) const
overridevirtual

Store the elements of the object table definition into a property object.

Parameters
[out]table_def_propertiesProperties object containing the definition.

Implements dd::Object_table_definition.

Member Data Documentation

◆ m_ddl_statement

String_type dd::Object_table_definition_impl::m_ddl_statement
private

◆ m_dml_statements

std::vector<String_type> dd::Object_table_definition_impl::m_dml_statements
private

◆ m_field_definitions

Element_definitions dd::Object_table_definition_impl::m_field_definitions
private

◆ m_field_numbers

Element_numbers dd::Object_table_definition_impl::m_field_numbers
private

◆ m_foreign_key_definitions

Element_definitions dd::Object_table_definition_impl::m_foreign_key_definitions
private

◆ m_foreign_key_numbers

Element_numbers dd::Object_table_definition_impl::m_foreign_key_numbers
private

◆ m_index_definitions

Element_definitions dd::Object_table_definition_impl::m_index_definitions
private

◆ m_index_numbers

Element_numbers dd::Object_table_definition_impl::m_index_numbers
private

◆ m_option_definitions

Element_definitions dd::Object_table_definition_impl::m_option_definitions
private

◆ m_option_numbers

Element_numbers dd::Object_table_definition_impl::m_option_numbers
private

◆ m_schema_name

String_type dd::Object_table_definition_impl::m_schema_name
private

◆ m_table_name

String_type dd::Object_table_definition_impl::m_table_name
private

◆ s_dd_tablespace_encrypted

bool dd::Object_table_definition_impl::s_dd_tablespace_encrypted = false
staticprivate

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