MySQL 9.0.0
Source Code Documentation
dd::Object_table Class Referenceabstract

This class represents all data dictionary table like mysql.tables, mysql.columns and more. More...

#include <object_table.h>

Inheritance diagram for dd::Object_table:
[legend]

Public Member Functions

virtual const String_typename () const =0
 Get the table name used by the target definition for the dictionary table. More...
 
virtual Object_table_definitiontarget_table_definition ()=0
 Get the target definition for the dictionary table. More...
 
virtual const Object_table_definitiontarget_table_definition () const =0
 
virtual void set_abandoned (uint last_dd_version) const =0
 Mark the target definition for the dictionary table as abandoned. More...
 
virtual bool is_abandoned () const =0
 Check if the dictionary table is abandoned. More...
 
virtual const Object_table_definitionactual_table_definition () const =0
 Get the actual definition for the dictionary table. More...
 
virtual bool set_actual_table_definition (const Properties &table_def_properties) const =0
 Set the actual definition for the dictionary table. More...
 
virtual int field_number (const String_type &field_label) const =0
 Get the field ordinal position in the object table. More...
 
virtual bool populate (THD *thd) const =0
 Execute low level code for populating the table. More...
 
virtual bool is_hidden () const =0
 Check if the table should be hidden. More...
 
virtual void set_hidden (bool hidden)=0
 Mark the dictionary table as hidden or visible. More...
 
virtual ~Object_table ()=default
 

Static Public Member Functions

static Object_tablecreate_object_table ()
 Allocate a new Object_table instance on the heap. More...
 

Detailed Description

This class represents all data dictionary table like mysql.tables, mysql.columns and more.

This is the base class of all the classes defined in sql/dd/impl/tables/ headers. This class is also the base class of tables requested by the DDSE and by plugins.

The server code should contain a Object_table subclass for each DD table which is a target table for at least one of the supported DD versions (i.e., the DD versions from which this server can upgrade). So even if a previous DD version stops using a DD table, the later servers which can upgrade need to keep the Object_table subclass for that table. The motivation for that is to be able to recognize the table, and to be able to remove it.

Instances of this class will contain one or two table definitions, depending on the context:

  • The actual table definition reflects the persistently stored DD table, i.e., what is reflected in the persistently stored mete data.
  • The target table definition reflects the DD table which the server is using during normal operation.

If the actual DD version is different from the target DD version, upgrade is required. The actual table definition is used only in situations where we have an upgrade or downgrade.

Note
This class may be inherited along different paths for some subclasses due to the diamond shaped inheritance hierarchy; thus, direct subclasses must inherit this class virtually.

Constructor & Destructor Documentation

◆ ~Object_table()

virtual dd::Object_table::~Object_table ( )
virtualdefault

Member Function Documentation

◆ actual_table_definition()

virtual const Object_table_definition * dd::Object_table::actual_table_definition ( ) const
pure virtual

Get the actual definition for the dictionary table.

The actual definition is the definition which is used by a DD table which is stored persistently. Normally, for an ordinary running server, the actual table definitions are equal to the target table definitions. In an upgrade context, they may differ.

Returns
Pointer to the definition of the table.

Implemented in dd::Entity_object_table_impl, and dd::Object_table_impl.

◆ create_object_table()

Object_table * dd::Object_table::create_object_table ( )
static

Allocate a new Object_table instance on the heap.

The new instance has the predefined options that all DD tables share:

ENGINE=INNODB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC STATS_PERSISTENT=0 TABLESPACE=mysql

Note
The object is owned by the caller.
Returns
pointer to new Object_table instance.

◆ field_number()

virtual int dd::Object_table::field_number ( const String_type field_label) const
pure virtual

Get the field ordinal position in the object table.

Returns
Integer ordinal position.

Implemented in dd::Entity_object_table_impl, and dd::Object_table_impl.

◆ is_abandoned()

virtual bool dd::Object_table::is_abandoned ( ) const
pure virtual

Check if the dictionary table is abandoned.

Returns
true if the table is abandoned.

Implemented in dd::Entity_object_table_impl, and dd::Object_table_impl.

◆ is_hidden()

virtual bool dd::Object_table::is_hidden ( ) const
pure virtual

Check if the table should be hidden.

Most of Object tables (alias DD tables) are hidden from users, but some of them are expected to be visible (not hidden) to user and be able to update them, e.g., innodb_index_stats/innodb_table_stats.

Returns
true if the table should be hidden.

Implemented in dd::Entity_object_table_impl, and dd::Object_table_impl.

◆ name()

virtual const String_type & dd::Object_table::name ( ) const
pure virtual

Get the table name used by the target definition for the dictionary table.

Returns
table name.

Implemented in dd::Entity_object_table_impl, and dd::Object_table_impl.

◆ populate()

virtual bool dd::Object_table::populate ( THD thd) const
pure virtual

Execute low level code for populating the table.

Returns
Boolean operation outcome, false if success.

Implemented in dd::Object_table_impl, dd::tables::Character_sets, dd::tables::Collations, and dd::Entity_object_table_impl.

◆ set_abandoned()

virtual void dd::Object_table::set_abandoned ( uint  last_dd_version) const
pure virtual

Mark the target definition for the dictionary table as abandoned.

Parameters
last_dd_versionLast version where this object table was used.

Implemented in dd::Entity_object_table_impl, and dd::Object_table_impl.

◆ set_actual_table_definition()

virtual bool dd::Object_table::set_actual_table_definition ( const Properties table_def_properties) const
pure virtual

Set the actual definition for the dictionary table.

Parameters
table_def_propertiesActual table definition represented as a set of properties.
Returns
false if no error.

Implemented in dd::Entity_object_table_impl, and dd::Object_table_impl.

◆ set_hidden()

virtual void dd::Object_table::set_hidden ( bool  hidden)
pure virtual

Mark the dictionary table as hidden or visible.

Parameters
hiddenSet to 'true' if the table should be hidden.

Implemented in dd::Entity_object_table_impl, and dd::Object_table_impl.

◆ target_table_definition() [1/2]

virtual const Object_table_definition * dd::Object_table::target_table_definition ( ) const
pure virtual

◆ target_table_definition() [2/2]

virtual Object_table_definition * dd::Object_table::target_table_definition ( )
pure virtual

Get the target definition for the dictionary table.

Note
There are const and non-const variants.
Returns
Pointer to the definition of the table.

Implemented in dd::Entity_object_table_impl, and dd::Object_table_impl.


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