MySQL 8.3.0
Source Code Documentation
dictionary_impl.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2023, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef DD__DICTIONARY_IMPL_INCLUDED
24#define DD__DICTIONARY_IMPL_INCLUDED
25
26#include <stddef.h>
27#include <sys/types.h>
28#include <string>
29
30#include "lex_string.h"
31#include "sql/dd/dictionary.h" // dd::Dictionary
32#include "sql/dd/object_id.h" // dd::Object_id
33#include "sql/dd/string_type.h" // dd::String_type
34#include "sql/table.h" // MYSQL_SCHEMA_NAME
35
36class THD;
37
38namespace dd {
39class Object_table;
40} // namespace dd
41
43class SchemaTest;
44}
45
46namespace my_testing {
47class DD_initializer;
48}
49
51template <typename T>
53}
54namespace dd {
55
56///////////////////////////////////////////////////////////////////////////
57
58enum class enum_dd_init_type;
59
60///////////////////////////////////////////////////////////////////////////
61
65 template <typename T>
67
68 /////////////////////////////////////////////////////////////////////////
69 // Implementation details.
70 /////////////////////////////////////////////////////////////////////////
71
72 private:
74
75 public:
76 static bool init(enum_dd_init_type dd_init);
77 static bool shutdown();
78
79 static Dictionary_impl *instance();
80
81 private:
82 Dictionary_impl() = default;
83
84 public:
85 ~Dictionary_impl() override = default;
86
87 public:
88 static uint get_target_dd_version();
89
90 virtual uint get_actual_dd_version(THD *thd);
91
92 static uint get_target_I_S_version();
93
94 virtual uint get_actual_I_S_version(THD *thd);
95
96 static uint get_target_P_S_version();
97
98 virtual uint get_actual_P_S_version(THD *thd);
99
100 virtual bool get_actual_ndbinfo_schema_version(THD *thd, uint *version);
101
102 uint set_I_S_version(THD *thd, uint version);
103
104 uint set_P_S_version(THD *thd, uint version);
105
106 uint set_ndbinfo_schema_version(THD *thd, uint version);
107
109 const String_type &schema_name,
110 const String_type &table_name) const override;
111
112 public:
113 bool is_dd_schema_name(const String_type &schema_name) const override {
114 return (schema_name == MYSQL_SCHEMA_NAME.str);
115 }
116
117 bool is_dd_table_name(const String_type &schema_name,
118 const String_type &table_name) const override;
119
120 bool is_system_table_name(const String_type &schema_name,
121 const String_type &table_name) const override;
122
123 int table_type_error_code(const String_type &schema_name,
124 const String_type &table_name) const override;
125
126 bool is_dd_table_access_allowed(bool is_dd_internal_thread,
127 bool is_ddl_statement,
128 const char *schema_name, size_t schema_length,
129 const char *table_name) const override;
130
131 bool is_system_view_name(const char *schema_name, const char *table_name,
132 bool *hidden) const override;
133
134 bool is_system_view_name(const char *schema_name,
135 const char *table_name) const override {
136 bool hidden;
137 return is_system_view_name(schema_name, table_name, &hidden);
138 }
139
140 public:
142
144
147 }
148
149 private:
153};
154
155///////////////////////////////////////////////////////////////////////////
156
157} // namespace dd
158
159#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:35
Definition: dictionary_impl.h:62
static bool shutdown()
Definition: dictionary_impl.cc:195
static Object_id DEFAULT_CATALOG_ID
Definition: dictionary_impl.h:150
static uint get_target_dd_version()
Definition: dictionary_impl.cc:208
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:278
static uint get_target_P_S_version()
Definition: dictionary_impl.cc:248
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:387
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:310
static Dictionary_impl * s_instance
Definition: dictionary_impl.h:73
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:284
static Object_id DD_TABLESPACE_ID
Definition: dictionary_impl.h:151
virtual uint get_actual_P_S_version(THD *thd)
Definition: dictionary_impl.cc:252
static const String_type DEFAULT_CATALOG_NAME
Definition: dictionary_impl.h:152
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:293
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:323
static const String_type & default_catalog_name()
Definition: dictionary_impl.h:145
~Dictionary_impl() override=default
static uint get_target_I_S_version()
Definition: dictionary_impl.cc:224
friend class dd_schema_unittest::SchemaTest
Definition: dictionary_impl.h:63
virtual bool get_actual_ndbinfo_schema_version(THD *thd, uint *version)
Definition: dictionary_impl.cc:264
Dictionary_impl()=default
virtual uint get_actual_dd_version(THD *thd)
Definition: dictionary_impl.cc:212
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:134
static Object_id dd_tablespace_id()
Definition: dictionary_impl.h:143
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:333
uint set_ndbinfo_schema_version(THD *thd, uint version)
Definition: dictionary_impl.cc:272
uint set_I_S_version(THD *thd, uint version)
Definition: dictionary_impl.cc:242
friend class my_testing::DD_initializer
Definition: dictionary_impl.h:64
static Object_id default_catalog_id()
Definition: dictionary_impl.h:141
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:113
virtual uint get_actual_I_S_version(THD *thd)
Definition: dictionary_impl.cc:230
Main interface class enabling users to operate on data dictionary.
Definition: dictionary.h:50
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:71
Definition: dictionary_impl.h:50
Definition: dictionary_impl.h:42
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
unsigned long long Object_id
Definition: object_id.h:30
enum_dd_init_type
Definition: dd.h:31
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
Definition: dictionary_impl.h:46
const char * table_name
Definition: rules_table_service.cc:55
required uint64 version
Definition: replication_group_member_actions.proto:40
LEX_CSTRING MYSQL_SCHEMA_NAME
Definition: table.cc:141
const char * str
Definition: mysql_lex_string.h:40