MySQL 8.4.0
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 { CO_NONE = 1,
51
52 enum enum_algorithm // VIEW_ALGORITHM_UNDEFINED, VIEW_ALGORITHM_TMPTABLE,
53 // VIEW_ALGORITHM_MERGE
57
59
60 public:
61 ~View() override = default;
62
63 /////////////////////////////////////////////////////////////////////////
64 // regular/system view flag.
65 /////////////////////////////////////////////////////////////////////////
66
67 /* non-virtual */ bool is_system_view() const {
69 }
70
71 virtual void set_system_view(bool system_view) = 0;
72
73 /////////////////////////////////////////////////////////////////////////
74 // collations.
75 /////////////////////////////////////////////////////////////////////////
76
77 virtual Object_id client_collation_id() const = 0;
79
83
84 /////////////////////////////////////////////////////////////////////////
85 // definition/utf8.
86 /////////////////////////////////////////////////////////////////////////
87
88 virtual const String_type &definition() const = 0;
89 virtual void set_definition(const String_type &definition) = 0;
90
91 virtual const String_type &definition_utf8() const = 0;
93
94 /////////////////////////////////////////////////////////////////////////
95 // check_option.
96 /////////////////////////////////////////////////////////////////////////
97
98 virtual enum_check_option check_option() const = 0;
100
101 /////////////////////////////////////////////////////////////////////////
102 // is_updatable.
103 /////////////////////////////////////////////////////////////////////////
104
105 virtual bool is_updatable() const = 0;
106 virtual void set_updatable(bool updatable) = 0;
107
108 /////////////////////////////////////////////////////////////////////////
109 // algorithm.
110 /////////////////////////////////////////////////////////////////////////
111
112 virtual enum_algorithm algorithm() const = 0;
114
115 /////////////////////////////////////////////////////////////////////////
116 // security_type.
117 /////////////////////////////////////////////////////////////////////////
118
121
122 /////////////////////////////////////////////////////////////////////////
123 // definer.
124 /////////////////////////////////////////////////////////////////////////
125
126 virtual const String_type &definer_user() const = 0;
127 virtual const String_type &definer_host() const = 0;
128 virtual void set_definer(const String_type &username,
129 const String_type &hostname) = 0;
130
131 /////////////////////////////////////////////////////////////////////////
132 // Explicit list of column names.
133 // It is a dictionary of string=>string, where the key is the number of the
134 // column ("1", "2", etc) and the value is the column's name.
135 /////////////////////////////////////////////////////////////////////////
136
137 virtual const Properties &column_names() const = 0;
138 virtual Properties &column_names() = 0;
139
140 /////////////////////////////////////////////////////////////////////////
141 // View-table collection.
142 /////////////////////////////////////////////////////////////////////////
143
144 virtual View_table *add_table() = 0;
145
146 virtual const View_tables &tables() const = 0;
147
148 /////////////////////////////////////////////////////////////////////////
149 // View_routine collection.
150 /////////////////////////////////////////////////////////////////////////
151
152 virtual View_routine *add_routine() = 0;
153
154 virtual const View_routines &routines() const = 0;
155
156 /**
157 Allocate a new object graph and invoke the copy constructor for
158 each object.
159
160 @return pointer to dynamically allocated copy
161 */
162 View *clone() const override = 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 Clear View columns, View_tables and View_routines collections.
174 */
175 virtual void remove_children() = 0;
176};
177
178///////////////////////////////////////////////////////////////////////////
179
180} // namespace dd
181
182#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:54
@ VA_MERGE
Definition: view.h:56
@ VA_TEMPORARY_TABLE
Definition: view.h:55
@ VA_UNDEFINED
Definition: view.h:54
virtual Object_id connection_collation_id() const =0
virtual const String_type & definer_host() const =0
bool is_system_view() const
Definition: view.h:67
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:48
@ CO_LOCAL
Definition: view.h:49
@ CO_CASCADED
Definition: view.h:50
virtual enum_check_option check_option() const =0
enum_security_type
Definition: view.h:58
@ ST_INVOKER
Definition: view.h:58
@ ST_DEFINER
Definition: view.h:58
@ ST_DEFAULT
Definition: view.h:58
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