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