MySQL 9.1.0
Source Code Documentation
dictionary_impl.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef DD__DICTIONARY_IMPL_INCLUDED
25#define DD__DICTIONARY_IMPL_INCLUDED
26
27#include <stddef.h>
28#include <sys/types.h>
29#include <string>
30
31#include "lex_string.h"
32#include "sql/dd/dictionary.h" // dd::Dictionary
33#include "sql/dd/object_id.h" // dd::Object_id
34#include "sql/dd/string_type.h" // dd::String_type
35#include "sql/table.h" // MYSQL_SCHEMA_NAME
36
37class THD;
38
39namespace dd {
40class Object_table;
41} // namespace dd
42
44class SchemaTest;
45}
46
47namespace my_testing {
48class DD_initializer;
49}
50
52template <typename T>
54}
55namespace dd {
56
57///////////////////////////////////////////////////////////////////////////
58
59enum class enum_dd_init_type;
60
61///////////////////////////////////////////////////////////////////////////
62
66 template <typename T>
68
69 /////////////////////////////////////////////////////////////////////////
70 // Implementation details.
71 /////////////////////////////////////////////////////////////////////////
72
73 private:
75
76 public:
77 static bool init(enum_dd_init_type dd_init);
78 static bool shutdown();
79
80 static Dictionary_impl *instance();
81
82 private:
83 Dictionary_impl() = default;
84
85 public:
86 ~Dictionary_impl() override = default;
87
88 public:
89 static uint get_target_dd_version();
90
91 virtual uint get_actual_dd_version(THD *thd);
92
93 static uint get_target_I_S_version();
94
95 virtual uint get_actual_I_S_version(THD *thd);
96
97 static uint get_target_P_S_version();
98
99 virtual uint get_actual_P_S_version(THD *thd);
100
101 virtual bool get_actual_ndbinfo_schema_version(THD *thd, uint *version);
102
103 uint set_I_S_version(THD *thd, uint version);
104
105 uint set_P_S_version(THD *thd, uint version);
106
107 uint set_ndbinfo_schema_version(THD *thd, uint version);
108
110 const String_type &schema_name,
111 const String_type &table_name) const override;
112
113 public:
114 bool is_dd_schema_name(const String_type &schema_name) const override {
115 return (schema_name == MYSQL_SCHEMA_NAME.str);
116 }
117
118 bool is_dd_table_name(const String_type &schema_name,
119 const String_type &table_name) const override;
120
121 bool is_system_table_name(const String_type &schema_name,
122 const String_type &table_name) const override;
123
124 int table_type_error_code(const String_type &schema_name,
125 const String_type &table_name) const override;
126
127 bool is_dd_table_access_allowed(bool is_dd_internal_thread,
128 bool is_ddl_statement,
129 const char *schema_name, size_t schema_length,
130 const char *table_name) const override;
131
132 bool is_system_view_name(const char *schema_name, const char *table_name,
133 bool *hidden) const override;
134
135 bool is_system_view_name(const char *schema_name,
136 const char *table_name) const override {
137 bool hidden;
138 return is_system_view_name(schema_name, table_name, &hidden);
139 }
140
141 public:
143
145
148 }
149
150 private:
154};
155
156///////////////////////////////////////////////////////////////////////////
157
158} // namespace dd
159
160#endif // DD__DICTIONARY_IMPL_INCLUDED
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Definition: dictionary_impl.h:63
static bool shutdown()
Definition: dictionary_impl.cc:184
static Object_id DEFAULT_CATALOG_ID
Definition: dictionary_impl.h:151
static uint get_target_dd_version()
Definition: dictionary_impl.cc:197
static bool init(enum_dd_init_type dd_init)
Definition: dictionary_impl.cc:103
static Dictionary_impl * instance()
Definition: dictionary_impl.cc:95
uint set_P_S_version(THD *thd, uint version)
Definition: dictionary_impl.cc:267
static uint get_target_P_S_version()
Definition: dictionary_impl.cc:237
bool is_system_view_name(const char *schema_name, const char *table_name, bool *hidden) const override
Check if given table name is a system view name.
Definition: dictionary_impl.cc:376
bool is_system_table_name(const String_type &schema_name, const String_type &table_name) const override
Check if given table name is a system table name.
Definition: dictionary_impl.cc:299
static Dictionary_impl * s_instance
Definition: dictionary_impl.h:74
const Object_table * get_dd_table(const String_type &schema_name, const String_type &table_name) const override
Get dictionary object for a given dictionary table name.
Definition: dictionary_impl.cc:273
static Object_id DD_TABLESPACE_ID
Definition: dictionary_impl.h:152
virtual uint get_actual_P_S_version(THD *thd)
Definition: dictionary_impl.cc:241
static const String_type DEFAULT_CATALOG_NAME
Definition: dictionary_impl.h:153
bool is_dd_table_name(const String_type &schema_name, const String_type &table_name) const override
Check if given table name is a dictionary table name.
Definition: dictionary_impl.cc:282
int table_type_error_code(const String_type &schema_name, const String_type &table_name) const override
Get the error code representing the type name string for a dictionary or system table.
Definition: dictionary_impl.cc:312
static const String_type & default_catalog_name()
Definition: dictionary_impl.h:146
~Dictionary_impl() override=default
static uint get_target_I_S_version()
Definition: dictionary_impl.cc:213
friend class dd_schema_unittest::SchemaTest
Definition: dictionary_impl.h:64
virtual bool get_actual_ndbinfo_schema_version(THD *thd, uint *version)
Definition: dictionary_impl.cc:253
Dictionary_impl()=default
virtual uint get_actual_dd_version(THD *thd)
Definition: dictionary_impl.cc:201
bool is_system_view_name(const char *schema_name, const char *table_name) const override
Check if given table name is a system view name.
Definition: dictionary_impl.h:135
static Object_id dd_tablespace_id()
Definition: dictionary_impl.h:144
bool is_dd_table_access_allowed(bool is_dd_internal_thread, bool is_ddl_statement, const char *schema_name, size_t schema_length, const char *table_name) const override
Check if given table name can be accessed by the given thread type.
Definition: dictionary_impl.cc:322
uint set_ndbinfo_schema_version(THD *thd, uint version)
Definition: dictionary_impl.cc:261
uint set_I_S_version(THD *thd, uint version)
Definition: dictionary_impl.cc:231
friend class my_testing::DD_initializer
Definition: dictionary_impl.h:65
static Object_id default_catalog_id()
Definition: dictionary_impl.h:142
bool is_dd_schema_name(const String_type &schema_name) const override
Check if the given schema name is 'mysql', which where the DD tables are stored.
Definition: dictionary_impl.h:114
virtual uint get_actual_I_S_version(THD *thd)
Definition: dictionary_impl.cc:219
Main interface class enabling users to operate on data dictionary.
Definition: dictionary.h:51
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:72
Definition: dictionary_impl.h:51
Definition: dictionary_impl.h:43
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
unsigned long long Object_id
Definition: object_id.h:31
enum_dd_init_type
Definition: dd.h:32
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:51
Definition: dictionary_impl.h:47
const char * table_name
Definition: rules_table_service.cc:56
required uint64 version
Definition: replication_group_member_actions.proto:41
LEX_CSTRING MYSQL_SCHEMA_NAME
Definition: table.cc:144
const char * str
Definition: mysql_lex_string.h:41