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