MySQL 9.2.0
Source Code Documentation
function_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__FUNCTION_IMPL_INCLUDED
25#define DD__FUNCTION_IMPL_INCLUDED
26
27#include <stddef.h>
28#include <sys/types.h>
29#include <new>
30
31#include "my_inttypes.h"
32#include "routine_impl.h"
35#include "sql/dd/impl/types/routine_impl.h" // dd::Routine_impl
37#include "sql/dd/object_id.h"
38#include "sql/dd/string_type.h"
39#include "sql/dd/types/column.h"
40#include "sql/dd/types/function.h" // dd::Function
42#include "sql/dd/types/view.h"
43
44namespace dd {
45
46///////////////////////////////////////////////////////////////////////////
47
48class Open_dictionary_tables_ctx;
49class Parameter;
50class Weak_object;
51class Object_table;
52
53class Function_impl : public Routine_impl, public Function {
54 public:
56
57 ~Function_impl() override = default;
58
60 const String_type &name) const override;
61
62 public:
63 bool validate() const override;
64
65 bool restore_attributes(const Raw_record &r) override;
66
67 bool store_attributes(Raw_record *r) override;
68
69 void debug_print(String_type &outb) const override;
70
71 public:
72 /////////////////////////////////////////////////////////////////////////
73 // result data type.
74 /////////////////////////////////////////////////////////////////////////
75
77 return m_result_data_type;
78 }
79
82 }
83
84 bool is_result_data_type_null() const override {
86 }
87
88 void set_result_data_type_null(bool is_null) override {
90 }
91
92 /////////////////////////////////////////////////////////////////////////
93 // Result display type
94 /////////////////////////////////////////////////////////////////////////
95
96 const String_type &result_data_type_utf8() const override {
98 }
99
101 const String_type &result_data_type_utf8) override {
103 }
104
105 /////////////////////////////////////////////////////////////////////////
106 // result_is_zerofill.
107 /////////////////////////////////////////////////////////////////////////
108
109 bool result_is_zerofill() const override { return m_result_is_zerofill; }
110
111 void set_result_zerofill(bool zerofill) override {
113 }
114
115 /////////////////////////////////////////////////////////////////////////
116 // result_is_unsigned.
117 /////////////////////////////////////////////////////////////////////////
118
119 bool result_is_unsigned() const override { return m_result_is_unsigned; }
120
121 void set_result_unsigned(bool unsigned_flag) override {
122 m_result_is_unsigned = unsigned_flag;
123 }
124
125 /////////////////////////////////////////////////////////////////////////
126 // result_char_length.
127 /////////////////////////////////////////////////////////////////////////
128
129 size_t result_char_length() const override { return m_result_char_length; }
130
131 void set_result_char_length(size_t char_length) override {
132 m_result_char_length = char_length;
133 }
134
135 /////////////////////////////////////////////////////////////////////////
136 // result_numeric_precision.
137 /////////////////////////////////////////////////////////////////////////
138
139 uint result_numeric_precision() const override {
141 }
142
146 }
147
148 virtual void set_result_numeric_precision_null(bool is_null) {
150 }
151
152 virtual bool is_result_numeric_precision_null() const {
154 }
155
156 /////////////////////////////////////////////////////////////////////////
157 // result_numeric_scale.
158 /////////////////////////////////////////////////////////////////////////
159
160 uint result_numeric_scale() const override { return m_result_numeric_scale; }
161
165 }
166
167 void set_result_numeric_scale_null(bool is_null) override {
169 }
170
171 bool is_result_numeric_scale_null() const override {
173 }
174
175 /////////////////////////////////////////////////////////////////////////
176 // result_datetime_precision.
177 /////////////////////////////////////////////////////////////////////////
178
179 uint result_datetime_precision() const override {
181 }
182
186 }
187
188 virtual void set_result_datetime_precision_null(bool is_null) {
190 }
191
194 }
195
196 /////////////////////////////////////////////////////////////////////////
197 // result_collation.
198 /////////////////////////////////////////////////////////////////////////
199
202 }
203
206 }
207
208 // Fix "inherits ... via dominance" warnings
210 const Entity_object_impl *impl() const override {
212 }
213 Object_id id() const override { return Entity_object_impl::id(); }
214 bool is_persistent() const override {
216 }
217 const String_type &name() const override {
219 }
220 void set_name(const String_type &name) override {
222 }
223 const Object_table &object_table() const override {
225 }
226 Object_id schema_id() const override { return Routine_impl::schema_id(); }
229 }
230 enum_routine_type type() const override { return Routine_impl::type(); }
231 const String_type &definition() const override {
233 }
234 void set_definition(const String_type &definition) override {
236 }
237 const String_type &definition_utf8() const override {
239 }
242 }
243 const String_type &parameter_str() const override {
245 }
248 }
249 bool is_deterministic() const override {
251 }
252 void set_deterministic(bool deterministic) override {
253 Routine_impl::set_deterministic(deterministic);
254 }
257 }
260 }
261 const String_type &external_language() const override {
263 }
264 void set_external_language(const String_type &el) override {
266 }
269 }
272 }
273 ulonglong sql_mode() const override { return Routine_impl::sql_mode(); }
275 const String_type &definer_user() const override {
277 }
278 const String_type &definer_host() const override {
280 }
281 void set_definer(const String_type &username,
282 const String_type &hostname) override {
283 Routine_impl::set_definer(username, hostname);
284 }
287 }
290 }
293 }
296 }
299 }
302 }
303 ulonglong created(bool convert_time) const override {
304 return Routine_impl::created(convert_time);
305 }
308 }
309 ulonglong last_altered(bool convert_time) const override {
310 return Routine_impl::last_altered(convert_time);
311 }
314 }
315 const String_type &comment() const override {
316 return Routine_impl::comment();
317 }
318 void set_comment(const String_type &comment) override {
320 }
322 const Parameter_collection &parameters() const override {
324 }
325 bool update_name_key(Name_key *key) const override {
327 }
328 const Properties &options() const override { return Routine_impl::options(); }
329 Properties &options() override { return Routine_impl::options(); }
330 bool set_options(const Properties &options) override {
332 }
333 bool set_options(const String_type &options_raw) override {
334 return Routine_impl::set_options(options_raw);
335 }
336
337 private:
340
344
348
352
354
356
357 Function_impl(const Function_impl &src);
358 Function_impl *clone() const override { return new Function_impl(*this); }
359
360 // N.B.: returning dd::Function from this function confuses MSVC compiler
361 // thanks to diamond inheritance.
363 Function_impl *placeholder = new Function_impl();
364 placeholder->set_id(id());
365 placeholder->set_schema_id(schema_id());
366 placeholder->set_name(name());
367 return placeholder;
368 }
369};
370
371///////////////////////////////////////////////////////////////////////////
372
373} // namespace dd
374
375#endif // DD__FUNCTION_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
void set_id(Object_id id)
Definition: entity_object_impl.h:51
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
Definition: function_impl.h:53
Entity_object_impl * impl() override
Definition: function_impl.h:209
const String_type & definer_user() const override
Definition: function_impl.h:275
enum_routine_type type() const override
Definition: function_impl.h:230
const String_type & definition() const override
Definition: function_impl.h:231
void set_result_data_type_null(bool is_null) override
Definition: function_impl.h:88
void debug_print(String_type &outb) const override
Definition: function_impl.cc:150
const Object_table & object_table() const override
Definition: function_impl.h:223
Function_impl * clone() const override
Allocate a new object graph and invoke the copy constructor for each object.
Definition: function_impl.h:358
void set_result_numeric_scale(uint result_numeric_scale) override
Definition: function_impl.h:162
virtual void set_result_datetime_precision_null(bool is_null)
Definition: function_impl.h:188
bool store_attributes(Raw_record *r) override
Definition: function_impl.cc:109
bool validate() const override
Definition: function_impl.cc:65
enum_column_types m_result_data_type
Definition: function_impl.h:338
bool m_result_numeric_precision_null
Definition: function_impl.h:345
const Properties & options() const override
Definition: function_impl.h:328
const Entity_object_impl * impl() const override
Definition: function_impl.h:210
virtual bool is_result_numeric_precision_null() const
Definition: function_impl.h:152
void set_client_collation_id(Object_id client_collation_id) override
Definition: function_impl.h:288
void set_definition_utf8(const String_type &definition_utf8) override
Definition: function_impl.h:240
bool is_result_data_type_null() const override
Definition: function_impl.h:84
void set_sql_mode(ulonglong sm) override
Definition: function_impl.h:274
const String_type & comment() const override
Definition: function_impl.h:315
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: function_impl.h:214
const String_type & result_data_type_utf8() const override
Definition: function_impl.h:96
bool m_result_datetime_precision_null
Definition: function_impl.h:347
bool update_name_key(Name_key *key) const override
Definition: function_impl.h:325
void set_external_language(const String_type &el) override
Definition: function_impl.h:264
enum_sql_data_access sql_data_access() const override
Definition: function_impl.h:255
Object_id m_result_collation_id
Definition: function_impl.h:355
void set_created(ulonglong created) override
Definition: function_impl.h:306
void set_result_datetime_precision(uint result_datetime_precision) override
Definition: function_impl.h:183
View::enum_security_type security_type() const override
Definition: function_impl.h:267
const String_type & parameter_str() const override
Definition: function_impl.h:243
bool m_result_numeric_scale_null
Definition: function_impl.h:346
virtual void set_result_numeric_precision_null(bool is_null)
Definition: function_impl.h:148
Function_impl()
Definition: function_impl.cc:47
void set_result_numeric_scale_null(bool is_null) override
Definition: function_impl.h:167
uint m_result_numeric_precision
Definition: function_impl.h:349
size_t m_result_char_length
Definition: function_impl.h:353
bool set_options(const Properties &options) override
Definition: function_impl.h:330
void set_deterministic(bool deterministic) override
Definition: function_impl.h:252
uint result_numeric_scale() const override
Definition: function_impl.h:160
ulonglong created(bool convert_time) const override
Definition: function_impl.h:303
ulonglong last_altered(bool convert_time) const override
Definition: function_impl.h:309
const String_type & definition_utf8() const override
Definition: function_impl.h:237
void set_result_data_type_utf8(const String_type &result_data_type_utf8) override
Definition: function_impl.h:100
bool is_result_numeric_scale_null() const override
Definition: function_impl.h:171
size_t result_char_length() const override
Definition: function_impl.h:129
Object_id id() const override
The unique dictionary object id.
Definition: function_impl.h:213
void set_comment(const String_type &comment) override
Definition: function_impl.h:318
bool update_routine_name_key(Name_key *key, Object_id schema_id, const String_type &name) const override
Definition: function_impl.cc:134
bool m_result_data_type_null
Definition: function_impl.h:341
uint result_numeric_precision() const override
Definition: function_impl.h:139
const String_type & name() const override
Definition: function_impl.h:217
~Function_impl() override=default
enum_column_types result_data_type() const override
Definition: function_impl.h:76
void set_definition(const String_type &definition) override
Definition: function_impl.h:234
Parameter * add_parameter() override
Definition: function_impl.h:321
Object_id schema_id() const override
Definition: function_impl.h:226
bool result_is_zerofill() const override
Definition: function_impl.h:109
bool m_result_is_zerofill
Definition: function_impl.h:342
void set_connection_collation_id(Object_id connection_collation_id) override
Definition: function_impl.h:294
bool set_options(const String_type &options_raw) override
Definition: function_impl.h:333
void set_definer(const String_type &username, const String_type &hostname) override
Definition: function_impl.h:281
void set_result_collation_id(Object_id result_collation_id) override
Definition: function_impl.h:204
void set_result_unsigned(bool unsigned_flag) override
Definition: function_impl.h:121
uint m_result_numeric_scale
Definition: function_impl.h:350
Properties & options() override
Definition: function_impl.h:329
Function_impl * clone_dropped_object_placeholder() const override
Allocate a new object which can serve as a placeholder for the original object in the Dictionary_clie...
Definition: function_impl.h:362
Object_id result_collation_id() const override
Definition: function_impl.h:200
virtual bool is_result_datetime_precision_null() const
Definition: function_impl.h:192
void set_result_data_type(enum_column_types result_data_type) override
Definition: function_impl.h:80
ulonglong sql_mode() const override
Definition: function_impl.h:273
uint m_result_datetime_precision
Definition: function_impl.h:351
void set_result_numeric_precision(uint result_numeric_precision) override
Definition: function_impl.h:143
bool result_is_unsigned() const override
Definition: function_impl.h:119
void set_schema_id(Object_id schema_id) override
Definition: function_impl.h:227
uint result_datetime_precision() const override
Definition: function_impl.h:179
void set_last_altered(ulonglong last_altered) override
Definition: function_impl.h:312
void set_result_zerofill(bool zerofill) override
Definition: function_impl.h:111
void set_security_type(View::enum_security_type security_type) override
Definition: function_impl.h:270
Object_id connection_collation_id() const override
Definition: function_impl.h:291
void set_parameter_str(const String_type &parameter_str) override
Definition: function_impl.h:246
void set_schema_collation_id(Object_id schema_collation_id) override
Definition: function_impl.h:300
Object_id client_collation_id() const override
Definition: function_impl.h:285
bool restore_attributes(const Raw_record &r) override
Definition: function_impl.cc:77
Object_id schema_collation_id() const override
Definition: function_impl.h:297
bool is_deterministic() const override
Definition: function_impl.h:249
void set_sql_data_access(enum_sql_data_access sda) override
Definition: function_impl.h:258
void set_result_char_length(size_t char_length) override
Definition: function_impl.h:131
bool m_result_is_unsigned
Definition: function_impl.h:343
const String_type & definer_host() const override
Definition: function_impl.h:278
const String_type & external_language() const override
Definition: function_impl.h:261
String_type m_result_data_type_utf8
Definition: function_impl.h:339
const Parameter_collection & parameters() const override
Definition: function_impl.h:322
void set_name(const String_type &name) override
Definition: function_impl.h:220
Definition: function.h:39
bool update_name_key(Name_key *key) const override
Definition: function.h:43
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:72
Definition: parameter.h:45
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
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
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
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
Object_id client_collation_id() const override
Definition: routine_impl.h:197
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
View::enum_security_type security_type() const override
Definition: routine_impl.h:163
const String_type & definer_user() const override
Definition: routine_impl.h:183
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
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
void set_definition_utf8(const String_type &definition_utf8) override
Definition: routine_impl.h:111
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
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
void set_schema_id(Object_id schema_id) override
Definition: routine_impl.h:85
const String_type & definition() const override
Definition: routine_impl.h:101
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
Definition: object_keys.h:434
enum_sql_data_access
Definition: routine.h:90
enum_routine_type
Definition: routine.h:88
enum_security_type
Definition: view.h:62
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
constexpr value_type zerofill
Definition: classic_protocol_constants.h:274
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
unsigned long long Object_id
Definition: object_id.h:31
enum_column_types
Definition: column.h:53
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
required string key
Definition: replication_asynchronous_connection_failover.proto:60