MySQL 9.0.0
Source Code Documentation
dd::tables::DD_properties Class Reference

#include <dd_properties.h>

Inheritance diagram for dd::tables::DD_properties:
[legend]

Public Types

enum  enum_fields { FIELD_PROPERTIES }
 
enum class  DD_property {
  ID , DATA , SPACE_ID , IDX ,
  COL , DEF
}
 The 'mysql.dd_properties' table will store key=value pairs. More...
 
- Public Types inherited from dd::Object_table_impl
enum class  Common_option {
  ENGINE , CHARSET , COLLATION , ROW_FORMAT ,
  STATS_PERSISTENT , TABLESPACE
}
 
enum class  Common_index { PK_ID , UK_NAME }
 
enum class  Common_field { ID }
 

Public Member Functions

 DD_properties ()
 
bool get (THD *thd, const String_type &key, uint *value, bool *exists)
 Get the integer value of the property key. More...
 
bool set (THD *thd, const String_type &key, uint value)
 Set the integer value of the property key. More...
 
bool get (THD *thd, const String_type &key, String_type *value, bool *exists)
 Get the character string value of the property key. More...
 
bool set (THD *thd, const String_type &key, const String_type &value)
 Set the character string value of the property key. More...
 
bool get (THD *thd, const String_type &key, std::unique_ptr< Properties > *properties, bool *exists)
 Get the properties object associated with a key. More...
 
bool set (THD *thd, const String_type &key, const dd::Properties &properties)
 Set the properties object associated with a key. More...
 
bool remove (THD *thd, const String_type &key)
 Remove a property key. More...
 
- Public Member Functions inherited from dd::Object_table_impl
 Object_table_impl (const String_type &schema_name, const String_type &table_name, const String_type &ddl_statement)
 
 Object_table_impl ()
 
const String_typename () const override
 Get the table name used by the target definition for the dictionary table. More...
 
Object_table_definition_impltarget_table_definition () override
 Get the target definition for the dictionary table. More...
 
const Object_table_definition_impltarget_table_definition () const override
 
void set_abandoned (uint last_dd_version) const override
 Mark the target definition for the dictionary table as abandoned. More...
 
bool is_abandoned () const override
 Check if the dictionary table is abandoned. More...
 
const Object_table_definition_implactual_table_definition () const override
 Get the actual definition for the dictionary table. More...
 
bool set_actual_table_definition (const Properties &table_def_properties) const override
 Set the actual definition for the dictionary table. More...
 
virtual int field_number (int target_field_number, const String_type &field_label) const
 
int field_number (const String_type &field_label) const override
 Get the field ordinal position in the object table. More...
 
bool populate (THD *) const override
 Execute low level code for populating the table. More...
 
bool is_hidden () const override
 Check if the table should be hidden. More...
 
void set_hidden (bool hidden) override
 Mark the dictionary table as hidden or visible. More...
 
 ~Object_table_impl () override=default
 
- Public Member Functions inherited from dd::Object_table
virtual ~Object_table ()=default
 

Static Public Member Functions

static DD_propertiesinstance ()
 
static const char * dd_key (DD_property label)
 Property key names for DD table properties. More...
 
- Static Public Member Functions inherited from dd::Object_table
static Object_tablecreate_object_table ()
 Allocate a new Object_table instance on the heap. More...
 

Private Types

enum class  Property_type { UNSIGNED_INT_32 , CHARACTER_STRING , PROPERTIES }
 

Private Member Functions

bool init_cached_properties (THD *thd)
 Initialize the cached properties by reading from disk. More...
 
bool flush_cached_properties (THD *thd)
 Flush the cached properties to disk. More...
 
bool unchecked_get (THD *thd, const String_type &key, String_type *value, bool *exists)
 Get the value of the property key. More...
 
bool unchecked_set (THD *thd, const String_type &key, const String_type &value)
 Set the value of the property key. More...
 

Private Attributes

Properties_impl m_properties
 
std::map< String_type, Property_typem_property_desc
 

Additional Inherited Members

- Protected Attributes inherited from dd::Object_table_impl
uint m_last_dd_version
 
Object_table_definition_impl m_target_def
 
bool m_actual_present
 
Object_table_definition_impl m_actual_def
 
bool m_hidden
 

Member Enumeration Documentation

◆ DD_property

The 'mysql.dd_properties' table will store key=value pairs.

The valid keys are predefined, and represented in an internal map as pairs of 'key name','type'. This is used in get() and set() to verify that the key is valid, and that the type of the value we are getting or setting is correct.

One of the keys is 'SYSTEM_TABLES'. This is itself a property object where the keys are names of DD tables, and the values are property objects containing information about each table. These property objects will also have a set of predefined keys. These are defined by an enumeration, and there is a function that returns keys for each enumeration value. The purpose of this is to avoid directly entering keys in the source code, which is prone to mistyping etc.

The two structures of valid keys are separate because they are used for different purposes. The top level keys defined in the internal map are used when properties at the top level are being looked up. The keys for the DD tables are used to lookup in the property object which is associated with a table DD name. Enumeration used to lookup the valid keys for the DD table properties.

Enumerator
ID 
DATA 
SPACE_ID 
IDX 
COL 
DEF 

◆ enum_fields

Enumerator
FIELD_PROPERTIES 

◆ Property_type

enum class dd::tables::DD_properties::Property_type
strongprivate
Enumerator
UNSIGNED_INT_32 
CHARACTER_STRING 
PROPERTIES 

Constructor & Destructor Documentation

◆ DD_properties()

dd::tables::DD_properties::DD_properties ( )

Member Function Documentation

◆ dd_key()

static const char * dd::tables::DD_properties::dd_key ( DD_property  label)
inlinestatic

Property key names for DD table properties.

Parameters
labelEnumeration label of the key.
Returns
Key character string.

◆ flush_cached_properties()

bool dd::tables::DD_properties::flush_cached_properties ( THD thd)
private

Flush the cached properties to disk.

Parameters
thdThread context.
Returns
false on success otherwise true.

◆ get() [1/3]

bool dd::tables::DD_properties::get ( THD thd,
const String_type key,
std::unique_ptr< Properties > *  properties,
bool *  exists 
)

Get the properties object associated with a key.

Will validate the key before retrieving the properties. Used to get hold of SE private data for the DD tables.

Parameters
thdThread context.
keyKey name.
[out]propertiesProperties object associated with the key.
[out]existsWill be 'false' if key is not present.
Returns
false on success otherwise true.

◆ get() [2/3]

bool dd::tables::DD_properties::get ( THD thd,
const String_type key,
String_type value,
bool *  exists 
)

Get the character string value of the property key.

Will validate the key before retrieving the value.

Parameters
thdThread context.
keyThe key representing the property.
[out]valueCorresponding value, if it exists, otherwise undefined.
[out]existsWill be 'false' if key is not present.
Returns
false on success otherwise true.

◆ get() [3/3]

bool dd::tables::DD_properties::get ( THD thd,
const String_type key,
uint *  value,
bool *  exists 
)

Get the integer value of the property key.

Will validate the key before retrieving the value.

Parameters
thdThread context.
keyThe key representing the property.
[out]valueCorresponding value, if it exists, otherwise undefined.
[out]existsWill be 'false' if key is not present.
Returns
false on success otherwise true.

◆ init_cached_properties()

bool dd::tables::DD_properties::init_cached_properties ( THD thd)
private

Initialize the cached properties by reading from disk.

Parameters
thdThread context.
Returns
false on success otherwise true.

◆ instance()

DD_properties & dd::tables::DD_properties::instance ( )
static

◆ remove()

bool dd::tables::DD_properties::remove ( THD thd,
const String_type key 
)

Remove a property key.

Parameters
thdThread context.
keyKey name.
Returns
false on success otherwise true.

◆ set() [1/3]

bool dd::tables::DD_properties::set ( THD thd,
const String_type key,
const dd::Properties properties 
)

Set the properties object associated with a key.

Will validate the key before setting the properties. Used to store SE private data for the DD tables.

Parameters
thdThread context.
keyKey name.
propertiesProperties object associated with the key.
Returns
false on success otherwise true.

◆ set() [2/3]

bool dd::tables::DD_properties::set ( THD thd,
const String_type key,
const String_type value 
)

Set the character string value of the property key.

Will validate the key before setting the value.

Parameters
thdThread context.
keyThe key representing the property.
valueThe value to be stored for 'key'.
Returns
false on success otherwise true.

◆ set() [3/3]

bool dd::tables::DD_properties::set ( THD thd,
const String_type key,
uint  value 
)

Set the integer value of the property key.

Will validate the key before setting the value.

Parameters
thdThread context.
keyThe key representing the property.
valueThe value to be stored for 'key'.
Returns
false on success otherwise true.

◆ unchecked_get()

bool dd::tables::DD_properties::unchecked_get ( THD thd,
const String_type key,
String_type value,
bool *  exists 
)
private

Get the value of the property key.

Will initialize the cached properties stored in the DD_properties instance if not already done. No key validation is done, this is expected to be done before this function is called.

Parameters
thdThread context.
keyThe key representing the property.
[out]valueCorresponding value, if it exists, otherwise undefined.
[out]existsWill be 'false' if key is not present.
Returns
false on success otherwise true.

◆ unchecked_set()

bool dd::tables::DD_properties::unchecked_set ( THD thd,
const String_type key,
const String_type value 
)
private

Set the value of the property key.

Will initialize the cached properties stored in the DD_properties instance if not already done. No key validation is done, this is expected to be done before this function is called. Properties are flushed to disk after the cache is updated.

Parameters
thdThread context.
keyThe key representing the property.
valueThe value to be stored for 'key'.
Returns
false on success otherwise true.

Member Data Documentation

◆ m_properties

Properties_impl dd::tables::DD_properties::m_properties
private

◆ m_property_desc

std::map<String_type, Property_type> dd::tables::DD_properties::m_property_desc
private

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