MySQL 9.1.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 Void_key;
48class Time_zone;
49class Properties;
50
51namespace tables {
52class Schemata;
53}
54
55/////////////////////////////////////////////////////////////////////////
56// enum_encryption_type.
57/////////////////////////////////////////////////////////////////////////
58
59enum class enum_encryption_type { ET_NO = 1, ET_YES };
60
61///////////////////////////////////////////////////////////////////////////
62
63class Schema : virtual public Entity_object {
64 public:
71
72 // We need a set of functions to update a preallocated key.
73 virtual bool update_id_key(Id_key *key) const {
74 return update_id_key(key, id());
75 }
76
77 static bool update_id_key(Id_key *key, Object_id id);
78
79 virtual bool update_name_key(Name_key *key) const {
80 return update_name_key(key, name());
81 }
82
83 static bool update_name_key(Name_key *key, const String_type &name);
84
85 virtual bool update_aux_key(Aux_key *) const { return true; }
86
87 /////////////////////////////////////////////////////////////////////////
88 // options
89 /////////////////////////////////////////////////////////////////////////
90
91 virtual const Properties &options() const = 0;
92 virtual Properties &options() = 0;
93 virtual bool set_options(const String_type &options_raw) = 0;
94 virtual bool set_options(const Properties &options) = 0;
95
96 public:
97 /////////////////////////////////////////////////////////////////////////
98 // Default collation.
99 /////////////////////////////////////////////////////////////////////////
100
101 virtual Object_id default_collation_id() const = 0;
103
104 /////////////////////////////////////////////////////////////////////////
105 // Default encryption.
106 /////////////////////////////////////////////////////////////////////////
107
108 virtual bool default_encryption() const = 0;
110
111 /////////////////////////////////////////////////////////////////////////
112 // Read only.
113 /////////////////////////////////////////////////////////////////////////
114 virtual bool read_only() const = 0;
115 virtual void set_read_only(bool state) = 0;
116
117 /////////////////////////////////////////////////////////////////////////
118 // created
119 /////////////////////////////////////////////////////////////////////////
120
121 virtual ulonglong created(bool convert_time) const = 0;
122 virtual void set_created(ulonglong created) = 0;
123
124 /////////////////////////////////////////////////////////////////////////
125 // last_altered
126 /////////////////////////////////////////////////////////////////////////
127
128 virtual ulonglong last_altered(bool convert_time) const = 0;
130
131 /////////////////////////////////////////////////////////////////////////
132 // se_private_data.
133 /////////////////////////////////////////////////////////////////////////
134
135 virtual const Properties &se_private_data() const = 0;
136
138 virtual bool set_se_private_data(const String_type &se_private_data_raw) = 0;
140
141 public:
142 virtual Event *create_event(THD *thd) const = 0;
143
144 virtual Function *create_function(THD *thd) const = 0;
145
146 virtual Procedure *create_procedure(THD *thd) const = 0;
147
148 virtual Table *create_table(THD *thd) const = 0;
149
150 virtual View *create_view(THD *thd) const = 0;
151
152 virtual View *create_system_view(THD *thd) const = 0;
153
154 /**
155 Allocate a new object and invoke the copy constructor.
156
157 @return pointer to dynamically allocated copy
158 */
159 virtual Schema *clone() const = 0;
160
161 /**
162 Allocate a new object which can serve as a placeholder for the original
163 object in the Dictionary_client's dropped registry. Such object has the
164 same keys as the original but has no other info and as result occupies
165 less memory.
166 */
168};
169
170///////////////////////////////////////////////////////////////////////////
171
172} // namespace dd
173
174#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: 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:63
Definition: schema.h:63
tables::Schemata DD_table
Definition: schema.h:67
virtual bool update_name_key(Name_key *key) const
Definition: schema.h:79
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:70
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:73
virtual Event * create_event(THD *thd) const =0
Schema_impl Impl
Definition: schema.h:65
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:68
virtual void set_created(ulonglong created)=0
Schema Cache_partition
Definition: schema.h:66
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:69
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:85
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:59
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.