MySQL 8.4.3
Source Code Documentation
view.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__VIEW_INCLUDED
25#define DD__VIEW_INCLUDED
26
27#include "sql/dd/types/abstract_table.h" // dd::Abstract_table
28
29namespace dd {
30
31///////////////////////////////////////////////////////////////////////////
32
33class View_impl;
34class View_table;
35class View_routine;
36
37///////////////////////////////////////////////////////////////////////////
38
39class View : virtual public Abstract_table {
40 public:
43 typedef View_impl Impl;
44
45 public:
46 enum enum_check_option // VIEW_CHECK_NONE, VIEW_CHECK_LOCAL,
47 // VIEW_CHECK_CASCADED
48 {
52 };
53
54 enum enum_algorithm // VIEW_ALGORITHM_UNDEFINED, VIEW_ALGORITHM_TMPTABLE,
55 // VIEW_ALGORITHM_MERGE
56 {
60 };
61
63
64 public:
65 ~View() override = default;
66
67 /////////////////////////////////////////////////////////////////////////
68 // regular/system view flag.
69 /////////////////////////////////////////////////////////////////////////
70
71 /* non-virtual */ bool is_system_view() const {
73 }
74
75 virtual void set_system_view(bool system_view) = 0;
76
77 /////////////////////////////////////////////////////////////////////////
78 // collations.
79 /////////////////////////////////////////////////////////////////////////
80
81 virtual Object_id client_collation_id() const = 0;
83
87
88 /////////////////////////////////////////////////////////////////////////
89 // definition/utf8.
90 /////////////////////////////////////////////////////////////////////////
91
92 virtual const String_type &definition() const = 0;
93 virtual void set_definition(const String_type &definition) = 0;
94
95 virtual const String_type &definition_utf8() const = 0;
97
98 /////////////////////////////////////////////////////////////////////////
99 // check_option.
100 /////////////////////////////////////////////////////////////////////////
101
102 virtual enum_check_option check_option() const = 0;
104
105 /////////////////////////////////////////////////////////////////////////
106 // is_updatable.
107 /////////////////////////////////////////////////////////////////////////
108
109 virtual bool is_updatable() const = 0;
110 virtual void set_updatable(bool updatable) = 0;
111
112 /////////////////////////////////////////////////////////////////////////
113 // algorithm.
114 /////////////////////////////////////////////////////////////////////////
115
116 virtual enum_algorithm algorithm() const = 0;
118
119 /////////////////////////////////////////////////////////////////////////
120 // security_type.
121 /////////////////////////////////////////////////////////////////////////
122
125
126 /////////////////////////////////////////////////////////////////////////
127 // definer.
128 /////////////////////////////////////////////////////////////////////////
129
130 virtual const String_type &definer_user() const = 0;
131 virtual const String_type &definer_host() const = 0;
132 virtual void set_definer(const String_type &username,
133 const String_type &hostname) = 0;
134
135 /////////////////////////////////////////////////////////////////////////
136 // Explicit list of column names.
137 // It is a dictionary of string=>string, where the key is the number of the
138 // column ("1", "2", etc) and the value is the column's name.
139 /////////////////////////////////////////////////////////////////////////
140
141 virtual const Properties &column_names() const = 0;
142 virtual Properties &column_names() = 0;
143
144 /////////////////////////////////////////////////////////////////////////
145 // View-table collection.
146 /////////////////////////////////////////////////////////////////////////
147
148 virtual View_table *add_table() = 0;
149
150 virtual const View_tables &tables() const = 0;
151
152 /////////////////////////////////////////////////////////////////////////
153 // View_routine collection.
154 /////////////////////////////////////////////////////////////////////////
155
156 virtual View_routine *add_routine() = 0;
157
158 virtual const View_routines &routines() const = 0;
159
160 /**
161 Allocate a new object graph and invoke the copy constructor for
162 each object.
163
164 @return pointer to dynamically allocated copy
165 */
166 View *clone() const override = 0;
167
168 /**
169 Allocate a new object which can serve as a placeholder for the original
170 object in the Dictionary_client's dropped registry. Such object has the
171 same keys as the original but has no other info and as result occupies
172 less memory.
173 */
175
176 /**
177 Clear View columns, View_tables and View_routines collections.
178 */
179 virtual void remove_children() = 0;
180};
181
182///////////////////////////////////////////////////////////////////////////
183
184} // namespace dd
185
186#endif // DD__VIEW_INCLUDED
Abstract base class for tables and views.
Definition: abstract_table.h:69
virtual enum_table_type type() const =0
Definition: collection.h:44
The Properties class defines an interface for storing key=value pairs, where both key and value may b...
Definition: properties.h:74
Definition: view_impl.h:55
Definition: view_routine.h:42
Definition: view_table.h:42
Definition: view.h:39
enum_algorithm
Definition: view.h:56
@ VA_MERGE
Definition: view.h:59
@ VA_TEMPORARY_TABLE
Definition: view.h:58
@ VA_UNDEFINED
Definition: view.h:57
virtual Object_id connection_collation_id() const =0
virtual const String_type & definer_host() const =0
bool is_system_view() const
Definition: view.h:71
View * clone_dropped_object_placeholder() const override=0
Allocate a new object which can serve as a placeholder for the original object in the Dictionary_clie...
Collection< View_table * > View_tables
Definition: view.h:41
virtual void set_client_collation_id(Object_id client_collation_id)=0
~View() override=default
virtual const View_tables & tables() const =0
Collection< View_routine * > View_routines
Definition: view.h:42
virtual const View_routines & routines() const =0
virtual void set_algorithm(enum_algorithm algorithm)=0
virtual View_routine * add_routine()=0
virtual void set_updatable(bool updatable)=0
virtual void set_connection_collation_id(Object_id connection_collation_id)=0
virtual const String_type & definer_user() const =0
virtual void remove_children()=0
Clear View columns, View_tables and View_routines collections.
virtual void set_definition(const String_type &definition)=0
enum_check_option
Definition: view.h:48
@ CO_NONE
Definition: view.h:49
@ CO_LOCAL
Definition: view.h:50
@ CO_CASCADED
Definition: view.h:51
virtual enum_check_option check_option() const =0
enum_security_type
Definition: view.h:62
@ ST_INVOKER
Definition: view.h:62
@ ST_DEFINER
Definition: view.h:62
@ ST_DEFAULT
Definition: view.h:62
View * clone() const override=0
Allocate a new object graph and invoke the copy constructor for each object.
virtual void set_definer(const String_type &username, const String_type &hostname)=0
virtual Object_id client_collation_id() const =0
virtual enum_security_type security_type() const =0
virtual Properties & column_names()=0
virtual const String_type & definition_utf8() const =0
View_impl Impl
Definition: view.h:43
virtual enum_algorithm algorithm() const =0
virtual void set_check_option(enum_check_option check_option)=0
virtual bool is_updatable() const =0
virtual void set_security_type(enum_security_type security_type)=0
virtual void set_definition_utf8(const String_type &definition_utf8)=0
virtual void set_system_view(bool system_view)=0
virtual View_table * add_table()=0
virtual const Properties & column_names() const =0
virtual const String_type & definition() const =0
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
unsigned long long Object_id
Definition: object_id.h:31
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:51