MySQL 9.2.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
routine_impl.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 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__ROUTINE_IMPL_INCLUDED
25#define DD__ROUTINE_IMPL_INCLUDED
26
27#include <stddef.h>
28#include <memory> // std::unique_ptr
29#include <string>
30
31#include "my_dbug.h"
32#include "my_inttypes.h"
33#include "sql/dd/impl/properties_impl.h" // dd::Properties_impl
35#include "sql/dd/impl/types/entity_object_impl.h" // dd::Entity_object_impl
37#include "sql/dd/object_id.h"
38#include "sql/dd/string_type.h"
39#include "sql/dd/types/parameter.h" // dd::Parameter
40#include "sql/dd/types/routine.h" // dd::Routine
41#include "sql/dd/types/view.h"
42#include "sql/sql_time.h" // gmt_time_to_local_time
43
44namespace dd {
45class Open_dictionary_tables_ctx;
46class Parameter;
47class Parameter_collection;
48class Weak_object;
49class Object_table;
50
51///////////////////////////////////////////////////////////////////////////
52
53class Routine_impl : public Entity_object_impl, virtual public Routine {
54 public:
56
57 ~Routine_impl() override;
58
59 public:
60 const Object_table &object_table() const override;
61
62 bool validate() const override;
63
65
67
68 bool drop_children(Open_dictionary_tables_ctx *otx) const override;
69
70 bool restore_attributes(const Raw_record &r) override;
71
72 bool store_attributes(Raw_record *r) override;
73
74 void debug_print(String_type &outb) const override;
75
76 public:
78
79 /////////////////////////////////////////////////////////////////////////
80 // schema.
81 /////////////////////////////////////////////////////////////////////////
82
83 Object_id schema_id() const override { return m_schema_id; }
84
86
87 /////////////////////////////////////////////////////////////////////////
88 // routine Partition type
89 /////////////////////////////////////////////////////////////////////////
90
91 enum_routine_type type() const override { return m_routine_type; }
92
93 virtual void set_type(enum_routine_type routine_type) {
94 m_routine_type = routine_type;
95 }
96
97 /////////////////////////////////////////////////////////////////////////
98 // definition/utf8.
99 /////////////////////////////////////////////////////////////////////////
100
101 const String_type &definition() const override { return m_definition; }
102
103 void set_definition(const String_type &definition) override {
105 }
106
107 const String_type &definition_utf8() const override {
108 return m_definition_utf8;
109 }
110
113 }
114
115 /////////////////////////////////////////////////////////////////////////
116 // parameter_str
117 /////////////////////////////////////////////////////////////////////////
118
119 const String_type &parameter_str() const override { return m_parameter_str; }
120
123 }
124
125 /////////////////////////////////////////////////////////////////////////
126 // is_deterministic.
127 /////////////////////////////////////////////////////////////////////////
128
129 bool is_deterministic() const override { return m_is_deterministic; }
130
131 void set_deterministic(bool deterministic) override {
132 m_is_deterministic = deterministic;
133 }
134
135 /////////////////////////////////////////////////////////////////////////
136 // sql data access.
137 /////////////////////////////////////////////////////////////////////////
138
140 return m_sql_data_access;
141 }
142
144 m_sql_data_access = sda;
145 }
146
147 /////////////////////////////////////////////////////////////////////////
148 // external language.
149 /////////////////////////////////////////////////////////////////////////
150
151 const String_type &external_language() const override {
152 return m_external_language;
153 }
154
155 void set_external_language(const String_type &el) override {
157 }
158
159 /////////////////////////////////////////////////////////////////////////
160 // security_type.
161 /////////////////////////////////////////////////////////////////////////
162
164 return m_security_type;
165 }
166
169 }
170
171 /////////////////////////////////////////////////////////////////////////
172 // sql_mode
173 /////////////////////////////////////////////////////////////////////////
174
175 ulonglong sql_mode() const override { return m_sql_mode; }
176
177 void set_sql_mode(ulonglong sm) override { m_sql_mode = sm; }
178
179 /////////////////////////////////////////////////////////////////////////
180 // definer.
181 /////////////////////////////////////////////////////////////////////////
182
183 const String_type &definer_user() const override { return m_definer_user; }
184
185 const String_type &definer_host() const override { return m_definer_host; }
186
187 void set_definer(const String_type &username,
188 const String_type &hostname) override {
189 m_definer_user = username;
190 m_definer_host = hostname;
191 }
192
193 /////////////////////////////////////////////////////////////////////////
194 // collation.
195 /////////////////////////////////////////////////////////////////////////
196
199 }
200
203 }
204
207 }
208
211 }
212
215 }
216
219 }
220
221 /////////////////////////////////////////////////////////////////////////
222 // created.
223 /////////////////////////////////////////////////////////////////////////
224
225 ulonglong created(bool convert_time) const override {
226 return convert_time ? gmt_time_to_local_time(m_created) : m_created;
227 }
228
230
231 /////////////////////////////////////////////////////////////////////////
232 // last altered.
233 /////////////////////////////////////////////////////////////////////////
234
235 ulonglong last_altered(bool convert_time) const override {
236 return convert_time ? gmt_time_to_local_time(m_last_altered)
238 }
239
242 }
243
244 /////////////////////////////////////////////////////////////////////////
245 // comment.
246 /////////////////////////////////////////////////////////////////////////
247
248 const String_type &comment() const override { return m_comment; }
249
250 void set_comment(const String_type &comment) override { m_comment = comment; }
251
252 /////////////////////////////////////////////////////////////////////////
253 // Parameter collection.
254 /////////////////////////////////////////////////////////////////////////
255
256 Parameter *add_parameter() override;
257
258 const Parameter_collection &parameters() const override {
259 return m_parameters;
260 }
261
262 /////////////////////////////////////////////////////////////////////////
263 // options.
264 /////////////////////////////////////////////////////////////////////////
265
266 const Properties &options() const override { return m_options; }
267
268 Properties &options() override { return m_options; }
269
270 bool set_options(const Properties &options) override {
272 }
273
274 bool set_options(const String_type &options_raw) override {
275 return m_options.insert_values(options_raw);
276 }
277
278 // Fix "inherits ... via dominance" warnings
280 const Entity_object_impl *impl() const override {
282 }
283 Object_id id() const override { return Entity_object_impl::id(); }
284 bool is_persistent() const override {
286 }
287 const String_type &name() const override {
289 }
290 void set_name(const String_type &name) override {
292 }
293
294 private:
298
300
304
313
314 // Collections.
315
317
318 // References.
319
324
325 protected:
326 Routine_impl(const Routine_impl &src);
327};
328
329///////////////////////////////////////////////////////////////////////////
330
331} // namespace dd
332
333#endif // DD__ROUTINE_IMPL_INCLUDED
Definition: collection.h:44
Definition: entity_object_impl.h:44
void set_name(const String_type &name) override
Definition: entity_object_impl.h:62
Object_id id() const override
The unique dictionary object id.
Definition: entity_object_impl.h:49
const String_type & name() const override
Definition: entity_object_impl.h:60
Entity_object_impl * impl() override
Definition: entity_object_impl.h:68
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: entity_object_impl.h:57
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:72
Auxiliary class for opening dictionary tables.
Definition: transaction_impl.h:77
Definition: parameter.h:45
The Properties_impl class implements the Properties interface.
Definition: properties_impl.h:77
bool insert_values(const Properties &properties) override
Insert key/value pairs from a different property object.
Definition: properties_impl.cc:104
The Properties class defines an interface for storing key=value pairs, where both key and value may b...
Definition: properties.h:74
Definition: raw_record.h:46
Definition: routine_impl.h:53
void set_definer(const String_type &username, const String_type &hostname) override
Definition: routine_impl.h:187
bool is_deterministic() const override
Definition: routine_impl.h:129
Properties & options() override
Definition: routine_impl.h:268
Object_id schema_collation_id() const override
Definition: routine_impl.h:213
const Object_table & object_table() const override
Definition: routine_impl.cc:256
ulonglong created(bool convert_time) const override
Definition: routine_impl.h:225
String_type m_definition
Definition: routine_impl.h:305
ulonglong m_sql_mode
Definition: routine_impl.h:301
void set_external_language(const String_type &el) override
Definition: routine_impl.h:155
void set_comment(const String_type &comment) override
Definition: routine_impl.h:250
void set_parameter_str(const String_type &parameter_str) override
Definition: routine_impl.h:121
String_type m_definer_user
Definition: routine_impl.h:308
void set_sql_mode(ulonglong sm) override
Definition: routine_impl.h:177
ulonglong sql_mode() const override
Definition: routine_impl.h:175
const String_type & definer_host() const override
Definition: routine_impl.h:185
enum_sql_data_access sql_data_access() const override
Definition: routine_impl.h:139
ulonglong m_last_altered
Definition: routine_impl.h:303
Parameter_collection m_parameters
Definition: routine_impl.h:316
void debug_print(String_type &outb) const override
Definition: routine_impl.cc:210
Object_id client_collation_id() const override
Definition: routine_impl.h:197
bool restore_children(Open_dictionary_tables_ctx *otx) override
Definition: routine_impl.cc:92
bool set_options(const Properties &options) override
Definition: routine_impl.h:270
void set_security_type(View::enum_security_type security_type) override
Definition: routine_impl.h:167
Object_id m_schema_id
Definition: routine_impl.h:320
View::enum_security_type security_type() const override
Definition: routine_impl.h:163
Object_id m_connection_collation_id
Definition: routine_impl.h:322
bool store_children(Open_dictionary_tables_ctx *otx) override
Definition: routine_impl.cc:100
const String_type & definer_user() const override
Definition: routine_impl.h:183
virtual void set_type(enum_routine_type routine_type)
Definition: routine_impl.h:93
bool drop_children(Open_dictionary_tables_ctx *otx) const override
Definition: routine_impl.cc:106
Object_id id() const override
The unique dictionary object id.
Definition: routine_impl.h:283
enum_sql_data_access m_sql_data_access
Definition: routine_impl.h:296
Object_id m_schema_collation_id
Definition: routine_impl.h:323
bool store_attributes(Raw_record *r) override
Definition: routine_impl.cc:173
String_type m_definer_host
Definition: routine_impl.h:309
String_type m_parameter_str
Definition: routine_impl.h:307
const Entity_object_impl * impl() const override
Definition: routine_impl.h:280
const String_type & parameter_str() const override
Definition: routine_impl.h:119
ulonglong last_altered(bool convert_time) const override
Definition: routine_impl.h:235
void set_schema_collation_id(Object_id schema_collation_id) override
Definition: routine_impl.h:217
View::enum_security_type m_security_type
Definition: routine_impl.h:297
void set_deterministic(bool deterministic) override
Definition: routine_impl.h:131
void set_definition(const String_type &definition) override
Definition: routine_impl.h:103
Object_id schema_id() const override
Definition: routine_impl.h:83
bool validate() const override
Definition: routine_impl.cc:80
~Routine_impl() override
void set_definition_utf8(const String_type &definition_utf8) override
Definition: routine_impl.h:111
bool m_is_deterministic
Definition: routine_impl.h:299
Routine_impl()
Definition: routine_impl.cc:61
Object_id connection_collation_id() const override
Definition: routine_impl.h:205
void set_client_collation_id(Object_id client_collation_id) override
Definition: routine_impl.h:201
const String_type & definition_utf8() const override
Definition: routine_impl.h:107
Object_id m_client_collation_id
Definition: routine_impl.h:321
Entity_object_impl * impl() override
Definition: routine_impl.h:279
enum_routine_type m_routine_type
Definition: routine_impl.h:295
const String_type & external_language() const override
Definition: routine_impl.h:151
void set_sql_data_access(enum_sql_data_access sda) override
Definition: routine_impl.h:143
void set_created(ulonglong created) override
Definition: routine_impl.h:229
const Parameter_collection & parameters() const override
Definition: routine_impl.h:258
enum_routine_type type() const override
Definition: routine_impl.h:91
Parameter * add_parameter() override
Definition: routine_impl.cc:248
bool set_options(const String_type &options_raw) override
Definition: routine_impl.h:274
String_type m_external_language
Definition: routine_impl.h:311
void set_schema_id(Object_id schema_id) override
Definition: routine_impl.h:85
bool restore_attributes(const Raw_record &r) override
Definition: routine_impl.cc:114
ulonglong m_created
Definition: routine_impl.h:302
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: routine_impl.h:284
String_type m_comment
Definition: routine_impl.h:310
const String_type & definition() const override
Definition: routine_impl.h:101
Properties_impl m_options
Definition: routine_impl.h:312
void set_connection_collation_id(Object_id connection_collation_id) override
Definition: routine_impl.h:209
void set_last_altered(ulonglong last_altered) override
Definition: routine_impl.h:240
const String_type & comment() const override
Definition: routine_impl.h:248
const Properties & options() const override
Definition: routine_impl.h:266
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: routine_impl.cc:262
const String_type & name() const override
Definition: routine_impl.h:287
String_type m_definition_utf8
Definition: routine_impl.h:306
void set_name(const String_type &name) override
Definition: routine_impl.h:290
Abstract base class for functions and procedures.
Definition: routine.h:61
enum_sql_data_access
Definition: routine.h:90
enum_routine_type
Definition: routine.h:88
enum_security_type
Definition: view.h:62
ulonglong gmt_time_to_local_time(ulonglong gmt_time)
This function gets GMT time and adds value of time_zone to get the local time.
Definition: sql_time.cc:868
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
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
Definition: options.cc:57
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
Interface for server time utilities.