MySQL 8.4.2
Source Code Documentation
|
#include <dd_properties.h>
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_type & | name () const override |
Get the table name used by the target definition for the dictionary table. More... | |
Object_table_definition_impl * | target_table_definition () override |
Get the target definition for the dictionary table. More... | |
const Object_table_definition_impl * | target_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_impl * | actual_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_properties & | instance () |
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_table * | create_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_type > | m_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 |
|
strong |
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 |
|
strongprivate |
dd::tables::DD_properties::DD_properties | ( | ) |
|
inlinestatic |
Property key names for DD table properties.
label | Enumeration label of the key. |
|
private |
Flush the cached properties to disk.
thd | Thread context. |
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.
thd | Thread context. | |
key | Key name. | |
[out] | properties | Properties object associated with the key. |
[out] | exists | Will be 'false' if key is not present. |
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.
thd | Thread context. | |
key | The key representing the property. | |
[out] | value | Corresponding value, if it exists, otherwise undefined. |
[out] | exists | Will be 'false' if key is not present. |
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.
thd | Thread context. | |
key | The key representing the property. | |
[out] | value | Corresponding value, if it exists, otherwise undefined. |
[out] | exists | Will be 'false' if key is not present. |
|
private |
Initialize the cached properties by reading from disk.
thd | Thread context. |
|
static |
bool dd::tables::DD_properties::remove | ( | THD * | thd, |
const String_type & | key | ||
) |
Remove a property key.
thd | Thread context. |
key | Key name. |
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.
thd | Thread context. |
key | Key name. |
properties | Properties object associated with the key. |
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.
thd | Thread context. |
key | The key representing the property. |
value | The value to be stored for 'key'. |
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.
thd | Thread context. |
key | The key representing the property. |
value | The value to be stored for 'key'. |
|
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.
thd | Thread context. | |
key | The key representing the property. | |
[out] | value | Corresponding value, if it exists, otherwise undefined. |
[out] | exists | Will be 'false' if key is not present. |
|
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.
thd | Thread context. |
key | The key representing the property. |
value | The value to be stored for 'key'. |
|
private |
|
private |