MySQL 8.4.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"
34#include "sql/dd/impl/types/routine_impl.h" // dd::Routine_impl
36#include "sql/dd/object_id.h"
37#include "sql/dd/string_type.h"
38#include "sql/dd/types/column.h"
39#include "sql/dd/types/function.h" // dd::Function
41#include "sql/dd/types/view.h"
42
43namespace dd {
44
45///////////////////////////////////////////////////////////////////////////
46
47class Open_dictionary_tables_ctx;
48class Parameter;
49class Weak_object;
50class Object_table;
51
52class Function_impl : public Routine_impl, public Function {
53 public:
55
56 ~Function_impl() override = default;
57
59 const String_type &name) const override;
60
61 public:
62 bool validate() const override;
63
64 bool restore_attributes(const Raw_record &r) override;
65
66 bool store_attributes(Raw_record *r) override;
67
68 void debug_print(String_type &outb) const override;
69
70 public:
71 /////////////////////////////////////////////////////////////////////////
72 // result data type.
73 /////////////////////////////////////////////////////////////////////////
74
76 return m_result_data_type;
77 }
78
81 }
82
83 bool is_result_data_type_null() const override {
85 }
86
87 void set_result_data_type_null(bool is_null) override {
89 }
90
91 /////////////////////////////////////////////////////////////////////////
92 // Result display type
93 /////////////////////////////////////////////////////////////////////////
94
95 const String_type &result_data_type_utf8() const override {
97 }
98
100 const String_type &result_data_type_utf8) override {
102 }
103
104 /////////////////////////////////////////////////////////////////////////
105 // result_is_zerofill.
106 /////////////////////////////////////////////////////////////////////////
107
108 bool result_is_zerofill() const override { return m_result_is_zerofill; }
109
110 void set_result_zerofill(bool zerofill) override {
112 }
113
114 /////////////////////////////////////////////////////////////////////////
115 // result_is_unsigned.
116 /////////////////////////////////////////////////////////////////////////
117
118 bool result_is_unsigned() const override { return m_result_is_unsigned; }
119
120 void set_result_unsigned(bool unsigned_flag) override {
121 m_result_is_unsigned = unsigned_flag;
122 }
123
124 /////////////////////////////////////////////////////////////////////////
125 // result_char_length.
126 /////////////////////////////////////////////////////////////////////////
127
128 size_t result_char_length() const override { return m_result_char_length; }
129
130 void set_result_char_length(size_t char_length) override {
131 m_result_char_length = char_length;
132 }
133
134 /////////////////////////////////////////////////////////////////////////
135 // result_numeric_precision.
136 /////////////////////////////////////////////////////////////////////////
137
138 uint result_numeric_precision() const override {
140 }
141
145 }
146
147 virtual void set_result_numeric_precision_null(bool is_null) {
149 }
150
151 virtual bool is_result_numeric_precision_null() const {
153 }
154
155 /////////////////////////////////////////////////////////////////////////
156 // result_numeric_scale.
157 /////////////////////////////////////////////////////////////////////////
158
159 uint result_numeric_scale() const override { return m_result_numeric_scale; }
160
164 }
165
166 void set_result_numeric_scale_null(bool is_null) override {
168 }
169
170 bool is_result_numeric_scale_null() const override {
172 }
173
174 /////////////////////////////////////////////////////////////////////////
175 // result_datetime_precision.
176 /////////////////////////////////////////////////////////////////////////
177
178 uint result_datetime_precision() const override {
180 }
181
185 }
186
187 virtual void set_result_datetime_precision_null(bool is_null) {
189 }
190
193 }
194
195 /////////////////////////////////////////////////////////////////////////
196 // result_collation.
197 /////////////////////////////////////////////////////////////////////////
198
201 }
202
205 }
206
207 // Fix "inherits ... via dominance" warnings
209 const Entity_object_impl *impl() const override {
211 }
212 Object_id id() const override { return Entity_object_impl::id(); }
213 bool is_persistent() const override {
215 }
216 const String_type &name() const override {
218 }
219 void set_name(const String_type &name) override {
221 }
222 const Object_table &object_table() const override {
224 }
225 Object_id schema_id() const override { return Routine_impl::schema_id(); }
228 }
229 enum_routine_type type() const override { return Routine_impl::type(); }
230 const String_type &definition() const override {
232 }
233 void set_definition(const String_type &definition) override {
235 }
236 const String_type &definition_utf8() const override {
238 }
241 }
242 const String_type &parameter_str() const override {
244 }
247 }
248 bool is_deterministic() const override {
250 }
251 void set_deterministic(bool deterministic) override {
252 Routine_impl::set_deterministic(deterministic);
253 }
256 }
259 }
260 const String_type &external_language() const override {
262 }
263 void set_external_language(const String_type &el) override {
265 }
268 }
271 }
272 ulonglong sql_mode() const override { return Routine_impl::sql_mode(); }
274 const String_type &definer_user() const override {
276 }
277 const String_type &definer_host() const override {
279 }
280 void set_definer(const String_type &username,
281 const String_type &hostname) override {
282 Routine_impl::set_definer(username, hostname);
283 }
286 }
289 }
292 }
295 }
298 }
301 }
302 ulonglong created(bool convert_time) const override {
303 return Routine_impl::created(convert_time);
304 }
307 }
308 ulonglong last_altered(bool convert_time) const override {
309 return Routine_impl::last_altered(convert_time);
310 }
313 }
314 const String_type &comment() const override {
315 return Routine_impl::comment();
316 }
317 void set_comment(const String_type &comment) override {
319 }
321 const Parameter_collection &parameters() const override {
323 }
324 bool update_name_key(Name_key *key) const override {
326 }
327
328 private:
331
335
339
343
345
347
348 Function_impl(const Function_impl &src);
349 Function_impl *clone() const override { return new Function_impl(*this); }
350
351 // N.B.: returning dd::Function from this function confuses MSVC compiler
352 // thanks to diamond inheritance.
354 Function_impl *placeholder = new Function_impl();
355 placeholder->set_id(id());
356 placeholder->set_schema_id(schema_id());
357 placeholder->set_name(name());
358 return placeholder;
359 }
360};
361
362///////////////////////////////////////////////////////////////////////////
363
364} // namespace dd
365
366#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:52
Entity_object_impl * impl() override
Definition: function_impl.h:208
const String_type & definer_user() const override
Definition: function_impl.h:274
enum_routine_type type() const override
Definition: function_impl.h:229
const String_type & definition() const override
Definition: function_impl.h:230
void set_result_data_type_null(bool is_null) override
Definition: function_impl.h:87
void debug_print(String_type &outb) const override
Definition: function_impl.cc:150
const Object_table & object_table() const override
Definition: function_impl.h:222
Function_impl * clone() const override
Allocate a new object graph and invoke the copy constructor for each object.
Definition: function_impl.h:349
void set_result_numeric_scale(uint result_numeric_scale) override
Definition: function_impl.h:161
virtual void set_result_datetime_precision_null(bool is_null)
Definition: function_impl.h:187
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:329
bool m_result_numeric_precision_null
Definition: function_impl.h:336
const Entity_object_impl * impl() const override
Definition: function_impl.h:209
virtual bool is_result_numeric_precision_null() const
Definition: function_impl.h:151
void set_client_collation_id(Object_id client_collation_id) override
Definition: function_impl.h:287
void set_definition_utf8(const String_type &definition_utf8) override
Definition: function_impl.h:239
bool is_result_data_type_null() const override
Definition: function_impl.h:83
void set_sql_mode(ulonglong sm) override
Definition: function_impl.h:273
const String_type & comment() const override
Definition: function_impl.h:314
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: function_impl.h:213
const String_type & result_data_type_utf8() const override
Definition: function_impl.h:95
bool m_result_datetime_precision_null
Definition: function_impl.h:338
bool update_name_key(Name_key *key) const override
Definition: function_impl.h:324
void set_external_language(const String_type &el) override
Definition: function_impl.h:263
enum_sql_data_access sql_data_access() const override
Definition: function_impl.h:254
Object_id m_result_collation_id
Definition: function_impl.h:346
void set_created(ulonglong created) override
Definition: function_impl.h:305
void set_result_datetime_precision(uint result_datetime_precision) override
Definition: function_impl.h:182
View::enum_security_type security_type() const override
Definition: function_impl.h:266
const String_type & parameter_str() const override
Definition: function_impl.h:242
bool m_result_numeric_scale_null
Definition: function_impl.h:337
virtual void set_result_numeric_precision_null(bool is_null)
Definition: function_impl.h:147
Function_impl()
Definition: function_impl.cc:47
void set_result_numeric_scale_null(bool is_null) override
Definition: function_impl.h:166
uint m_result_numeric_precision
Definition: function_impl.h:340
size_t m_result_char_length
Definition: function_impl.h:344
void set_deterministic(bool deterministic) override
Definition: function_impl.h:251
uint result_numeric_scale() const override
Definition: function_impl.h:159
ulonglong created(bool convert_time) const override
Definition: function_impl.h:302
ulonglong last_altered(bool convert_time) const override
Definition: function_impl.h:308
const String_type & definition_utf8() const override
Definition: function_impl.h:236
void set_result_data_type_utf8(const String_type &result_data_type_utf8) override
Definition: function_impl.h:99
bool is_result_numeric_scale_null() const override
Definition: function_impl.h:170
size_t result_char_length() const override
Definition: function_impl.h:128
Object_id id() const override
The unique dictionary object id.
Definition: function_impl.h:212
void set_comment(const String_type &comment) override
Definition: function_impl.h:317
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:332
uint result_numeric_precision() const override
Definition: function_impl.h:138
const String_type & name() const override
Definition: function_impl.h:216
~Function_impl() override=default
enum_column_types result_data_type() const override
Definition: function_impl.h:75
void set_definition(const String_type &definition) override
Definition: function_impl.h:233
Parameter * add_parameter() override
Definition: function_impl.h:320
Object_id schema_id() const override
Definition: function_impl.h:225
bool result_is_zerofill() const override
Definition: function_impl.h:108
bool m_result_is_zerofill
Definition: function_impl.h:333
void set_connection_collation_id(Object_id connection_collation_id) override
Definition: function_impl.h:293
void set_definer(const String_type &username, const String_type &hostname) override
Definition: function_impl.h:280
void set_result_collation_id(Object_id result_collation_id) override
Definition: function_impl.h:203
void set_result_unsigned(bool unsigned_flag) override
Definition: function_impl.h:120
uint m_result_numeric_scale
Definition: function_impl.h:341
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:353
Object_id result_collation_id() const override
Definition: function_impl.h:199
virtual bool is_result_datetime_precision_null() const
Definition: function_impl.h:191
void set_result_data_type(enum_column_types result_data_type) override
Definition: function_impl.h:79
ulonglong sql_mode() const override
Definition: function_impl.h:272
uint m_result_datetime_precision
Definition: function_impl.h:342
void set_result_numeric_precision(uint result_numeric_precision) override
Definition: function_impl.h:142
bool result_is_unsigned() const override
Definition: function_impl.h:118
void set_schema_id(Object_id schema_id) override
Definition: function_impl.h:226
uint result_datetime_precision() const override
Definition: function_impl.h:178
void set_last_altered(ulonglong last_altered) override
Definition: function_impl.h:311
void set_result_zerofill(bool zerofill) override
Definition: function_impl.h:110
void set_security_type(View::enum_security_type security_type) override
Definition: function_impl.h:269
Object_id connection_collation_id() const override
Definition: function_impl.h:290
void set_parameter_str(const String_type &parameter_str) override
Definition: function_impl.h:245
void set_schema_collation_id(Object_id schema_collation_id) override
Definition: function_impl.h:299
Object_id client_collation_id() const override
Definition: function_impl.h:284
bool restore_attributes(const Raw_record &r) override
Definition: function_impl.cc:77
Object_id schema_collation_id() const override
Definition: function_impl.h:296
bool is_deterministic() const override
Definition: function_impl.h:248
void set_sql_data_access(enum_sql_data_access sda) override
Definition: function_impl.h:257
void set_result_char_length(size_t char_length) override
Definition: function_impl.h:130
bool m_result_is_unsigned
Definition: function_impl.h:334
const String_type & definer_host() const override
Definition: function_impl.h:277
const String_type & external_language() const override
Definition: function_impl.h:260
String_type m_result_data_type_utf8
Definition: function_impl.h:330
const Parameter_collection & parameters() const override
Definition: function_impl.h:321
void set_name(const String_type &name) override
Definition: function_impl.h:219
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
Definition: raw_record.h:46
Definition: routine_impl.h:52
void set_definer(const String_type &username, const String_type &hostname) override
Definition: routine_impl.h:186
bool is_deterministic() const override
Definition: routine_impl.h:128
Object_id schema_collation_id() const override
Definition: routine_impl.h:212
const Object_table & object_table() const override
Definition: routine_impl.cc:249
ulonglong created(bool convert_time) const override
Definition: routine_impl.h:224
void set_external_language(const String_type &el) override
Definition: routine_impl.h:154
void set_comment(const String_type &comment) override
Definition: routine_impl.h:249
void set_parameter_str(const String_type &parameter_str) override
Definition: routine_impl.h:120
void set_sql_mode(ulonglong sm) override
Definition: routine_impl.h:176
ulonglong sql_mode() const override
Definition: routine_impl.h:174
const String_type & definer_host() const override
Definition: routine_impl.h:184
enum_sql_data_access sql_data_access() const override
Definition: routine_impl.h:138
Object_id client_collation_id() const override
Definition: routine_impl.h:196
void set_security_type(View::enum_security_type security_type) override
Definition: routine_impl.h:166
View::enum_security_type security_type() const override
Definition: routine_impl.h:162
const String_type & definer_user() const override
Definition: routine_impl.h:182
const String_type & parameter_str() const override
Definition: routine_impl.h:118
ulonglong last_altered(bool convert_time) const override
Definition: routine_impl.h:234
void set_schema_collation_id(Object_id schema_collation_id) override
Definition: routine_impl.h:216
void set_deterministic(bool deterministic) override
Definition: routine_impl.h:130
void set_definition(const String_type &definition) override
Definition: routine_impl.h:102
Object_id schema_id() const override
Definition: routine_impl.h:82
void set_definition_utf8(const String_type &definition_utf8) override
Definition: routine_impl.h:110
Object_id connection_collation_id() const override
Definition: routine_impl.h:204
void set_client_collation_id(Object_id client_collation_id) override
Definition: routine_impl.h:200
const String_type & definition_utf8() const override
Definition: routine_impl.h:106
const String_type & external_language() const override
Definition: routine_impl.h:150
void set_sql_data_access(enum_sql_data_access sda) override
Definition: routine_impl.h:142
void set_created(ulonglong created) override
Definition: routine_impl.h:228
const Parameter_collection & parameters() const override
Definition: routine_impl.h:257
enum_routine_type type() const override
Definition: routine_impl.h:90
Parameter * add_parameter() override
Definition: routine_impl.cc:241
void set_schema_id(Object_id schema_id) override
Definition: routine_impl.h:84
const String_type & definition() const override
Definition: routine_impl.h:100
void set_connection_collation_id(Object_id connection_collation_id) override
Definition: routine_impl.h:208
void set_last_altered(ulonglong last_altered) override
Definition: routine_impl.h:239
const String_type & comment() const override
Definition: routine_impl.h:247
Definition: object_keys.h:435
enum_sql_data_access
Definition: routine.h:90
enum_routine_type
Definition: routine.h:88
enum_security_type
Definition: view.h:58
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
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
required string key
Definition: replication_asynchronous_connection_failover.proto:60