MySQL 9.2.0
Source Code Documentation
schema.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__SCHEMA_INCLUDED
25#define DD__SCHEMA_INCLUDED
26
27#include "my_inttypes.h"
28#include "sql/dd/impl/raw/object_keys.h" // IWYU pragma: keep
29#include "sql/dd/properties.h"
30#include "sql/dd/sdi_fwd.h" // RJ_Document
31#include "sql/dd/types/entity_object.h" // dd::Entity_object
32
33class THD;
34
35namespace dd {
36
37///////////////////////////////////////////////////////////////////////////
38
39class Item_name_key;
40class Primary_id_key;
41class Schema_impl;
42class Table;
43class View;
44class Event;
45class Function;
46class Procedure;
47class Library;
48class Void_key;
49class Time_zone;
50class Properties;
51
52namespace tables {
53class Schemata;
54}
55
56/////////////////////////////////////////////////////////////////////////
57// enum_encryption_type.
58/////////////////////////////////////////////////////////////////////////
59
60enum class enum_encryption_type { ET_NO = 1, ET_YES };
61
62///////////////////////////////////////////////////////////////////////////
63
64class Schema : virtual public Entity_object {
65 public:
72
73 // We need a set of functions to update a preallocated key.
74 virtual bool update_id_key(Id_key *key) const {
75 return update_id_key(key, id());
76 }
77
78 static bool update_id_key(Id_key *key, Object_id id);
79
80 virtual bool update_name_key(Name_key *key) const {
81 return update_name_key(key, name());
82 }
83
84 static bool update_name_key(Name_key *key, const String_type &name);
85
86 virtual bool update_aux_key(Aux_key *) const { return true; }
87
88 /////////////////////////////////////////////////////////////////////////
89 // options
90 /////////////////////////////////////////////////////////////////////////
91
92 virtual const Properties &options() const = 0;
93 virtual Properties &options() = 0;
94 virtual bool set_options(const String_type &options_raw) = 0;
95 virtual bool set_options(const Properties &options) = 0;
96
97 public:
98 /////////////////////////////////////////////////////////////////////////
99 // Default collation.
100 /////////////////////////////////////////////////////////////////////////
101
102 virtual Object_id default_collation_id() const = 0;
104
105 /////////////////////////////////////////////////////////////////////////
106 // Default encryption.
107 /////////////////////////////////////////////////////////////////////////
108
109 virtual bool default_encryption() const = 0;
111
112 /////////////////////////////////////////////////////////////////////////
113 // Read only.
114 /////////////////////////////////////////////////////////////////////////
115 virtual bool read_only() const = 0;
116 virtual void set_read_only(bool state) = 0;
117
118 /////////////////////////////////////////////////////////////////////////
119 // created
120 /////////////////////////////////////////////////////////////////////////
121
122 virtual ulonglong created(bool convert_time) const = 0;
123 virtual void set_created(ulonglong created) = 0;
124
125 /////////////////////////////////////////////////////////////////////////
126 // last_altered
127 /////////////////////////////////////////////////////////////////////////
128
129 virtual ulonglong last_altered(bool convert_time) const = 0;
131
132 /////////////////////////////////////////////////////////////////////////
133 // se_private_data.
134 /////////////////////////////////////////////////////////////////////////
135
136 virtual const Properties &se_private_data() const = 0;
137
139 virtual bool set_se_private_data(const String_type &se_private_data_raw) = 0;
141
142 public:
143 virtual Event *create_event(THD *thd) const = 0;
144
145 virtual Function *create_function(THD *thd) const = 0;
146
147 virtual Procedure *create_procedure(THD *thd) const = 0;
148
149 virtual Library *create_library(THD *thd) const = 0;
150
151 virtual Table *create_table(THD *thd) const = 0;
152
153 virtual View *create_view(THD *thd) const = 0;
154
155 virtual View *create_system_view(THD *thd) const = 0;
156
157 /**
158 Allocate a new object and invoke the copy constructor.
159
160 @return pointer to dynamically allocated copy
161 */
162 virtual Schema *clone() const = 0;
163
164 /**
165 Allocate a new object which can serve as a placeholder for the original
166 object in the Dictionary_client's dropped registry. Such object has the
167 same keys as the original but has no other info and as result occupies
168 less memory.
169 */
171};
172
173///////////////////////////////////////////////////////////////////////////
174
175} // namespace dd
176
177#endif // DD__SCHEMA_INCLUDE
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
This class represents abstract time zone and provides basic interface for MYSQL_TIME <-> my_time_t co...
Definition: tztime.h:49
Base class for dictionary objects which has single column integer primary key.
Definition: entity_object.h:48
virtual const String_type & name() const =0
Definition: event.h:48
Definition: function.h:39
Definition: object_keys.h:166
Definition: library.h:37
Definition: object_keys.h:77
Definition: procedure.h:37
The Properties class defines an interface for storing key=value pairs, where both key and value may b...
Definition: properties.h:74
Definition: schema_impl.h:64
Definition: schema.h:64
tables::Schemata DD_table
Definition: schema.h:68
virtual bool update_name_key(Name_key *key) const
Definition: schema.h:80
virtual View * create_system_view(THD *thd) const =0
virtual bool set_se_private_data(const String_type &se_private_data_raw)=0
virtual bool set_options(const String_type &options_raw)=0
virtual Properties & options()=0
Void_key Aux_key
Definition: schema.h:71
virtual ulonglong last_altered(bool convert_time) const =0
virtual Object_id default_collation_id() const =0
virtual void set_read_only(bool state)=0
virtual bool update_id_key(Id_key *key) const
Definition: schema.h:74
virtual Event * create_event(THD *thd) const =0
Schema_impl Impl
Definition: schema.h:66
virtual bool read_only() const =0
virtual Function * create_function(THD *thd) const =0
virtual Properties & se_private_data()=0
virtual void set_default_collation_id(Object_id default_collation_id)=0
virtual Schema * clone_dropped_object_placeholder() const =0
Allocate a new object which can serve as a placeholder for the original object in the Dictionary_clie...
Primary_id_key Id_key
Definition: schema.h:69
virtual void set_created(ulonglong created)=0
Schema Cache_partition
Definition: schema.h:67
virtual ulonglong created(bool convert_time) const =0
virtual void set_default_encryption(bool default_encryption)=0
virtual bool default_encryption() const =0
virtual Table * create_table(THD *thd) const =0
virtual bool set_se_private_data(const Properties &se_private_data)=0
virtual const Properties & options() const =0
virtual bool set_options(const Properties &options)=0
virtual Schema * clone() const =0
Allocate a new object and invoke the copy constructor.
virtual void set_last_altered(ulonglong last_altered)=0
Item_name_key Name_key
Definition: schema.h:70
virtual Library * create_library(THD *thd) const =0
virtual Procedure * create_procedure(THD *thd) const =0
virtual View * create_view(THD *thd) const =0
virtual bool update_aux_key(Aux_key *) const
Definition: schema.h:86
virtual const Properties & se_private_data() const =0
Definition: table.h:47
Definition: view.h:39
Definition: object_keys.h:54
Definition: schemata.h:46
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
std::function< void(const Type)> Function
Definition: ut0counter.h:241
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_encryption_type
Definition: schema.h:60
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:51
Definition: options.cc:57
required string key
Definition: replication_asynchronous_connection_failover.proto:60
This header provides Rapidjson Type Aliases.