MySQL  8.0.19
Source Code Documentation
schema.h
Go to the documentation of this file.
1 /* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
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/sdi_fwd.h" // RJ_Document
29 #include "sql/dd/types/entity_object.h" // dd::Entity_object
30 
31 class THD;
32 
33 namespace dd {
34 
35 ///////////////////////////////////////////////////////////////////////////
36 
37 class Item_name_key;
38 class Primary_id_key;
39 class Schema_impl;
40 class Table;
41 class View;
42 class Event;
43 class Function;
44 class Procedure;
45 class Void_key;
46 class Time_zone;
47 class Properties;
48 
49 namespace tables {
50 class Schemata;
51 }
52 
53 /////////////////////////////////////////////////////////////////////////
54 // enum_encryption_type.
55 /////////////////////////////////////////////////////////////////////////
56 
57 enum class enum_encryption_type { ET_NO = 1, ET_YES };
58 
59 ///////////////////////////////////////////////////////////////////////////
60 
61 class Schema : virtual public Entity_object {
62  public:
63  typedef Schema_impl Impl;
68  typedef Void_key Aux_key;
69 
70  // We need a set of functions to update a preallocated key.
71  virtual bool update_id_key(Id_key *key) const {
72  return update_id_key(key, id());
73  }
74 
75  static bool update_id_key(Id_key *key, Object_id id);
76 
77  virtual bool update_name_key(Name_key *key) const {
78  return update_name_key(key, name());
79  }
80 
81  static bool update_name_key(Name_key *key, const String_type &name);
82 
83  virtual bool update_aux_key(Aux_key *) const { return true; }
84 
85  public:
86  /////////////////////////////////////////////////////////////////////////
87  // Default collation.
88  /////////////////////////////////////////////////////////////////////////
89 
90  virtual Object_id default_collation_id() const = 0;
92 
93  /////////////////////////////////////////////////////////////////////////
94  // Default encryption.
95  /////////////////////////////////////////////////////////////////////////
96 
97  virtual bool default_encryption() const = 0;
98  virtual void set_default_encryption(bool default_encryption) = 0;
99 
100  /////////////////////////////////////////////////////////////////////////
101  // created
102  /////////////////////////////////////////////////////////////////////////
103 
104  virtual ulonglong created(bool convert_time) const = 0;
105  virtual void set_created(ulonglong created) = 0;
106 
107  /////////////////////////////////////////////////////////////////////////
108  // last_altered
109  /////////////////////////////////////////////////////////////////////////
110 
111  virtual ulonglong last_altered(bool convert_time) const = 0;
112  virtual void set_last_altered(ulonglong last_altered) = 0;
113 
114  /////////////////////////////////////////////////////////////////////////
115  // se_private_data.
116  /////////////////////////////////////////////////////////////////////////
117 
118  virtual const Properties &se_private_data() const = 0;
119 
120  virtual Properties &se_private_data() = 0;
121  virtual bool set_se_private_data(const String_type &se_private_data_raw) = 0;
122  virtual bool set_se_private_data(const Properties &se_private_data) = 0;
123 
124  public:
125  virtual Event *create_event(THD *thd) const = 0;
126 
127  virtual Function *create_function(THD *thd) const = 0;
128 
129  virtual Procedure *create_procedure(THD *thd) const = 0;
130 
131  virtual Table *create_table(THD *thd) const = 0;
132 
133  virtual View *create_view(THD *thd) const = 0;
134 
135  virtual View *create_system_view(THD *thd) const = 0;
136 
137  /**
138  Allocate a new object and invoke the copy contructor.
139 
140  @return pointer to dynamically allocated copy
141  */
142  virtual Schema *clone() const = 0;
143 };
144 
145 ///////////////////////////////////////////////////////////////////////////
146 
147 } // namespace dd
148 
149 #endif // DD__SCHEMA_INCLUDE
dd::Schema::create_event
virtual Event * create_event(THD *thd) const =0
dd::tables::Schemata
Definition: schemata.h:43
dd::Schema::update_id_key
virtual bool update_id_key(Id_key *key) const
Definition: schema.h:71
dd::Properties
The Properties class defines an interface for storing key=value pairs, where both key and value may b...
Definition: properties.h:73
dd::Schema::update_aux_key
virtual bool update_aux_key(Aux_key *) const
Definition: schema.h:83
dd::enum_encryption_type::ET_YES
@ ET_YES
dd::Schema::created
virtual ulonglong created(bool convert_time) const =0
THD
Definition: sql_class.h:764
dd::Schema::create_view
virtual View * create_view(THD *thd) const =0
dd::Entity_object
Base class for dictionary objects which has single column integer primary key.
Definition: entity_object.h:47
dd::String_type
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
dd::Schema
Definition: schema.h:61
dd::Procedure
Definition: procedure.h:36
dd::Schema::update_name_key
virtual bool update_name_key(Name_key *key) const
Definition: schema.h:77
dd::Event
Definition: event.h:47
dd::Schema::set_default_encryption
virtual void set_default_encryption(bool default_encryption)=0
dd::Schema::set_se_private_data
virtual bool set_se_private_data(const String_type &se_private_data_raw)=0
dd::Schema::Name_key
Item_name_key Name_key
Definition: schema.h:67
object_keys.h
dd::Schema::clone
virtual Schema * clone() const =0
Allocate a new object and invoke the copy contructor.
dd
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:39
dd::enum_encryption_type::ET_NO
@ ET_NO
key
static const char * key
Definition: suite_stubs.c:14
Table
Definition: test_sql_stmt.cc:150
dd::Schema::Id_key
Primary_id_key Id_key
Definition: schema.h:66
dd::enum_encryption_type
enum_encryption_type
Definition: schema.h:57
my_inttypes.h
dd::Schema::create_system_view
virtual View * create_system_view(THD *thd) const =0
dd::Schema::create_function
virtual Function * create_function(THD *thd) const =0
dd::Schema::create_procedure
virtual Procedure * create_procedure(THD *thd) const =0
dd::Schema::last_altered
virtual ulonglong last_altered(bool convert_time) const =0
dd::Schema::set_last_altered
virtual void set_last_altered(ulonglong last_altered)=0
dd::Schema::Aux_key
Void_key Aux_key
Definition: schema.h:68
dd::Entity_object::name
virtual const String_type & name() const =0
dd::Schema::create_table
virtual Table * create_table(THD *thd) const =0
dd::Primary_id_key
Definition: object_keys.h:76
dd::Table
Definition: table.h:45
dd::Schema::Cache_partition
Schema Cache_partition
Definition: schema.h:64
dd::View
Definition: view.h:38
Time_zone
This class represents abstract time zone and provides basic interface for MYSQL_TIME <-> my_time_t co...
Definition: tztime.h:51
dd::Schema::DD_table
tables::Schemata DD_table
Definition: schema.h:65
dd::Schema::se_private_data
virtual const Properties & se_private_data() const =0
dd::Object_id
unsigned long long Object_id
Definition: object_id.h:30
sdi_fwd.h
dd::Schema::default_encryption
virtual bool default_encryption() const =0
Counter::Function
std::function< void(const Type)> Function
Definition: ut0counter.h:249
dd::Function
Definition: function.h:38
dd::Schema::set_default_collation_id
virtual void set_default_collation_id(Object_id default_collation_id)=0
dd::Void_key
Definition: object_keys.h:53
ulonglong
unsigned long long int ulonglong
Definition: my_inttypes.h:55
entity_object.h
dd::Schema_impl
Definition: schema_impl.h:62
dd::Schema::Impl
Schema_impl Impl
Definition: schema.h:63
dd::Schema::default_collation_id
virtual Object_id default_collation_id() const =0
dd::Schema::set_created
virtual void set_created(ulonglong created)=0
dd::Item_name_key
Definition: object_keys.h:165