MySQL 8.0.30
Source Code Documentation
function_impl.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 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__FUNCTION_IMPL_INCLUDED
24#define DD__FUNCTION_IMPL_INCLUDED
25
26#include <stddef.h>
27#include <sys/types.h>
28#include <new>
29
30#include "my_inttypes.h"
33#include "sql/dd/impl/types/routine_impl.h" // dd::Routine_impl
35#include "sql/dd/object_id.h"
36#include "sql/dd/string_type.h"
37#include "sql/dd/types/column.h"
38#include "sql/dd/types/function.h" // dd::Function
40#include "sql/dd/types/view.h"
41
42namespace dd {
43
44///////////////////////////////////////////////////////////////////////////
45
46class Open_dictionary_tables_ctx;
47class Parameter;
48class Weak_object;
49class Object_table;
50
51class Function_impl : public Routine_impl, public Function {
52 public:
54
55 ~Function_impl() override = default;
56
58 const String_type &name) const override;
59
60 public:
61 bool validate() const override;
62
63 bool restore_attributes(const Raw_record &r) override;
64
65 bool store_attributes(Raw_record *r) override;
66
67 void debug_print(String_type &outb) const override;
68
69 public:
70 /////////////////////////////////////////////////////////////////////////
71 // result data type.
72 /////////////////////////////////////////////////////////////////////////
73
75 return m_result_data_type;
76 }
77
80 }
81
82 bool is_result_data_type_null() const override {
84 }
85
86 void set_result_data_type_null(bool is_null) override {
88 }
89
90 /////////////////////////////////////////////////////////////////////////
91 // Result display type
92 /////////////////////////////////////////////////////////////////////////
93
94 const String_type &result_data_type_utf8() const override {
96 }
97
99 const String_type &result_data_type_utf8) override {
101 }
102
103 /////////////////////////////////////////////////////////////////////////
104 // result_is_zerofill.
105 /////////////////////////////////////////////////////////////////////////
106
107 bool result_is_zerofill() const override { return m_result_is_zerofill; }
108
109 void set_result_zerofill(bool zerofill) override {
111 }
112
113 /////////////////////////////////////////////////////////////////////////
114 // result_is_unsigned.
115 /////////////////////////////////////////////////////////////////////////
116
117 bool result_is_unsigned() const override { return m_result_is_unsigned; }
118
119 void set_result_unsigned(bool unsigned_flag) override {
120 m_result_is_unsigned = unsigned_flag;
121 }
122
123 /////////////////////////////////////////////////////////////////////////
124 // result_char_length.
125 /////////////////////////////////////////////////////////////////////////
126
127 size_t result_char_length() const override { return m_result_char_length; }
128
129 void set_result_char_length(size_t char_length) override {
130 m_result_char_length = char_length;
131 }
132
133 /////////////////////////////////////////////////////////////////////////
134 // result_numeric_precision.
135 /////////////////////////////////////////////////////////////////////////
136
139 }
140
144 }
145
146 virtual void set_result_numeric_precision_null(bool is_null) {
148 }
149
150 virtual bool is_result_numeric_precision_null() const {
152 }
153
154 /////////////////////////////////////////////////////////////////////////
155 // result_numeric_scale.
156 /////////////////////////////////////////////////////////////////////////
157
159
163 }
164
165 void set_result_numeric_scale_null(bool is_null) override {
167 }
168
169 bool is_result_numeric_scale_null() const override {
171 }
172
173 /////////////////////////////////////////////////////////////////////////
174 // result_datetime_precision.
175 /////////////////////////////////////////////////////////////////////////
176
179 }
180
184 }
185
186 virtual void set_result_datetime_precision_null(bool is_null) {
188 }
189
192 }
193
194 /////////////////////////////////////////////////////////////////////////
195 // result_collation.
196 /////////////////////////////////////////////////////////////////////////
197
200 }
201
204 }
205
206 // Fix "inherits ... via dominance" warnings
208 const Entity_object_impl *impl() const override {
210 }
211 Object_id id() const override { return Entity_object_impl::id(); }
212 bool is_persistent() const override {
214 }
215 const String_type &name() const override {
217 }
218 void set_name(const String_type &name) override {
220 }
221 const Object_table &object_table() const override {
223 }
224 Object_id schema_id() const override { return Routine_impl::schema_id(); }
227 }
228 enum_routine_type type() const override { return Routine_impl::type(); }
229 const String_type &definition() const override {
231 }
232 void set_definition(const String_type &definition) override {
234 }
235 const String_type &definition_utf8() const override {
237 }
240 }
241 const String_type &parameter_str() const override {
243 }
246 }
247 bool is_deterministic() const override {
249 }
250 void set_deterministic(bool deterministic) override {
251 Routine_impl::set_deterministic(deterministic);
252 }
255 }
258 }
261 }
264 }
265 ulonglong sql_mode() const override { return Routine_impl::sql_mode(); }
267 const String_type &definer_user() const override {
269 }
270 const String_type &definer_host() const override {
272 }
273 void set_definer(const String_type &username,
274 const String_type &hostname) override {
275 Routine_impl::set_definer(username, hostname);
276 }
279 }
282 }
285 }
288 }
291 }
294 }
295 ulonglong created(bool convert_time) const override {
296 return Routine_impl::created(convert_time);
297 }
300 }
301 ulonglong last_altered(bool convert_time) const override {
302 return Routine_impl::last_altered(convert_time);
303 }
306 }
307 const String_type &comment() const override {
308 return Routine_impl::comment();
309 }
310 void set_comment(const String_type &comment) override {
312 }
314 const Parameter_collection &parameters() const override {
316 }
317 bool update_name_key(Name_key *key) const override {
319 }
320
321 private:
324
328
332
336
338
340
341 Function_impl(const Function_impl &src);
342 Function_impl *clone() const override { return new Function_impl(*this); }
343
344 // N.B.: returning dd::Function from this function confuses MSVC compiler
345 // thanks to diamond inheritance.
347 Function_impl *placeholder = new Function_impl();
348 placeholder->set_id(id());
349 placeholder->set_schema_id(schema_id());
350 placeholder->set_name(name());
351 return placeholder;
352 }
353};
354
355///////////////////////////////////////////////////////////////////////////
356
357} // namespace dd
358
359#endif // DD__FUNCTION_IMPL_INCLUDED
Definition: collection.h:43
Definition: entity_object_impl.h:43
void set_name(const String_type &name) override
Definition: entity_object_impl.h:61
void set_id(Object_id id)
Definition: entity_object_impl.h:50
Object_id id() const override
The unique dictionary object id.
Definition: entity_object_impl.h:48
const String_type & name() const override
Definition: entity_object_impl.h:59
Entity_object_impl * impl() override
Definition: entity_object_impl.h:67
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: entity_object_impl.h:56
Definition: function_impl.h:51
Entity_object_impl * impl() override
Definition: function_impl.h:207
const String_type & definer_user() const override
Definition: function_impl.h:267
enum_routine_type type() const override
Definition: function_impl.h:228
const String_type & definition() const override
Definition: function_impl.h:229
void set_result_data_type_null(bool is_null) override
Definition: function_impl.h:86
void debug_print(String_type &outb) const override
Definition: function_impl.cc:149
const Object_table & object_table() const override
Definition: function_impl.h:221
Function_impl * clone() const override
Allocate a new object graph and invoke the copy constructor for each object.
Definition: function_impl.h:342
void set_result_numeric_scale(uint result_numeric_scale) override
Definition: function_impl.h:160
virtual void set_result_datetime_precision_null(bool is_null)
Definition: function_impl.h:186
bool store_attributes(Raw_record *r) override
Definition: function_impl.cc:108
bool validate() const override
Definition: function_impl.cc:64
enum_column_types m_result_data_type
Definition: function_impl.h:322
bool m_result_numeric_precision_null
Definition: function_impl.h:329
const Entity_object_impl * impl() const override
Definition: function_impl.h:208
virtual bool is_result_numeric_precision_null() const
Definition: function_impl.h:150
void set_client_collation_id(Object_id client_collation_id) override
Definition: function_impl.h:280
void set_definition_utf8(const String_type &definition_utf8) override
Definition: function_impl.h:238
bool is_result_data_type_null() const override
Definition: function_impl.h:82
void set_sql_mode(ulonglong sm) override
Definition: function_impl.h:266
const String_type & comment() const override
Definition: function_impl.h:307
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: function_impl.h:212
const String_type & result_data_type_utf8() const override
Definition: function_impl.h:94
bool m_result_datetime_precision_null
Definition: function_impl.h:331
bool update_name_key(Name_key *key) const override
Definition: function_impl.h:317
enum_sql_data_access sql_data_access() const override
Definition: function_impl.h:253
Object_id m_result_collation_id
Definition: function_impl.h:339
void set_created(ulonglong created) override
Definition: function_impl.h:298
void set_result_datetime_precision(uint result_datetime_precision) override
Definition: function_impl.h:181
View::enum_security_type security_type() const override
Definition: function_impl.h:259
const String_type & parameter_str() const override
Definition: function_impl.h:241
bool m_result_numeric_scale_null
Definition: function_impl.h:330
virtual void set_result_numeric_precision_null(bool is_null)
Definition: function_impl.h:146
Function_impl()
Definition: function_impl.cc:46
void set_result_numeric_scale_null(bool is_null) override
Definition: function_impl.h:165
uint m_result_numeric_precision
Definition: function_impl.h:333
size_t m_result_char_length
Definition: function_impl.h:337
void set_deterministic(bool deterministic) override
Definition: function_impl.h:250
uint result_numeric_scale() const override
Definition: function_impl.h:158
ulonglong created(bool convert_time) const override
Definition: function_impl.h:295
ulonglong last_altered(bool convert_time) const override
Definition: function_impl.h:301
const String_type & definition_utf8() const override
Definition: function_impl.h:235
void set_result_data_type_utf8(const String_type &result_data_type_utf8) override
Definition: function_impl.h:98
bool is_result_numeric_scale_null() const override
Definition: function_impl.h:169
size_t result_char_length() const override
Definition: function_impl.h:127
Object_id id() const override
The unique dictionary object id.
Definition: function_impl.h:211
void set_comment(const String_type &comment) override
Definition: function_impl.h:310
bool update_routine_name_key(Name_key *key, Object_id schema_id, const String_type &name) const override
Definition: function_impl.cc:133
bool m_result_data_type_null
Definition: function_impl.h:325
uint result_numeric_precision() const override
Definition: function_impl.h:137
const String_type & name() const override
Definition: function_impl.h:215
~Function_impl() override=default
enum_column_types result_data_type() const override
Definition: function_impl.h:74
void set_definition(const String_type &definition) override
Definition: function_impl.h:232
Parameter * add_parameter() override
Definition: function_impl.h:313
Object_id schema_id() const override
Definition: function_impl.h:224
bool result_is_zerofill() const override
Definition: function_impl.h:107
bool m_result_is_zerofill
Definition: function_impl.h:326
void set_connection_collation_id(Object_id connection_collation_id) override
Definition: function_impl.h:286
void set_definer(const String_type &username, const String_type &hostname) override
Definition: function_impl.h:273
void set_result_collation_id(Object_id result_collation_id) override
Definition: function_impl.h:202
void set_result_unsigned(bool unsigned_flag) override
Definition: function_impl.h:119
uint m_result_numeric_scale
Definition: function_impl.h:334
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:346
Object_id result_collation_id() const override
Definition: function_impl.h:198
virtual bool is_result_datetime_precision_null() const
Definition: function_impl.h:190
void set_result_data_type(enum_column_types result_data_type) override
Definition: function_impl.h:78
ulonglong sql_mode() const override
Definition: function_impl.h:265
uint m_result_datetime_precision
Definition: function_impl.h:335
void set_result_numeric_precision(uint result_numeric_precision) override
Definition: function_impl.h:141
bool result_is_unsigned() const override
Definition: function_impl.h:117
void set_schema_id(Object_id schema_id) override
Definition: function_impl.h:225
uint result_datetime_precision() const override
Definition: function_impl.h:177
void set_last_altered(ulonglong last_altered) override
Definition: function_impl.h:304
void set_result_zerofill(bool zerofill) override
Definition: function_impl.h:109
void set_security_type(View::enum_security_type security_type) override
Definition: function_impl.h:262
Object_id connection_collation_id() const override
Definition: function_impl.h:283
void set_parameter_str(const String_type &parameter_str) override
Definition: function_impl.h:244
void set_schema_collation_id(Object_id schema_collation_id) override
Definition: function_impl.h:292
Object_id client_collation_id() const override
Definition: function_impl.h:277
bool restore_attributes(const Raw_record &r) override
Definition: function_impl.cc:76
Object_id schema_collation_id() const override
Definition: function_impl.h:289
bool is_deterministic() const override
Definition: function_impl.h:247
void set_sql_data_access(enum_sql_data_access sda) override
Definition: function_impl.h:256
void set_result_char_length(size_t char_length) override
Definition: function_impl.h:129
bool m_result_is_unsigned
Definition: function_impl.h:327
const String_type & definer_host() const override
Definition: function_impl.h:270
String_type m_result_data_type_utf8
Definition: function_impl.h:323
const Parameter_collection & parameters() const override
Definition: function_impl.h:314
void set_name(const String_type &name) override
Definition: function_impl.h:218
Definition: function.h:38
bool update_name_key(Name_key *key) const override
Definition: function.h:42
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:71
Definition: parameter.h:44
Definition: raw_record.h:45
Definition: routine_impl.h:51
void set_definer(const String_type &username, const String_type &hostname) override
Definition: routine_impl.h:173
bool is_deterministic() const override
Definition: routine_impl.h:127
Object_id schema_collation_id() const override
Definition: routine_impl.h:199
const Object_table & object_table() const override
Definition: routine_impl.cc:243
ulonglong created(bool convert_time) const override
Definition: routine_impl.h:211
void set_comment(const String_type &comment) override
Definition: routine_impl.h:236
void set_parameter_str(const String_type &parameter_str) override
Definition: routine_impl.h:119
void set_sql_mode(ulonglong sm) override
Definition: routine_impl.h:163
ulonglong sql_mode() const override
Definition: routine_impl.h:161
const String_type & definer_host() const override
Definition: routine_impl.h:171
enum_sql_data_access sql_data_access() const override
Definition: routine_impl.h:137
Object_id client_collation_id() const override
Definition: routine_impl.h:183
void set_security_type(View::enum_security_type security_type) override
Definition: routine_impl.h:153
View::enum_security_type security_type() const override
Definition: routine_impl.h:149
const String_type & definer_user() const override
Definition: routine_impl.h:169
const String_type & parameter_str() const override
Definition: routine_impl.h:117
ulonglong last_altered(bool convert_time) const override
Definition: routine_impl.h:221
void set_schema_collation_id(Object_id schema_collation_id) override
Definition: routine_impl.h:203
void set_deterministic(bool deterministic) override
Definition: routine_impl.h:129
void set_definition(const String_type &definition) override
Definition: routine_impl.h:101
Object_id schema_id() const override
Definition: routine_impl.h:81
void set_definition_utf8(const String_type &definition_utf8) override
Definition: routine_impl.h:109
Object_id connection_collation_id() const override
Definition: routine_impl.h:191
void set_client_collation_id(Object_id client_collation_id) override
Definition: routine_impl.h:187
const String_type & definition_utf8() const override
Definition: routine_impl.h:105
void set_sql_data_access(enum_sql_data_access sda) override
Definition: routine_impl.h:141
void set_created(ulonglong created) override
Definition: routine_impl.h:215
const Parameter_collection & parameters() const override
Definition: routine_impl.h:244
enum_routine_type type() const override
Definition: routine_impl.h:89
Parameter * add_parameter() override
Definition: routine_impl.cc:235
void set_schema_id(Object_id schema_id) override
Definition: routine_impl.h:83
const String_type & definition() const override
Definition: routine_impl.h:99
void set_connection_collation_id(Object_id connection_collation_id) override
Definition: routine_impl.h:195
void set_last_altered(ulonglong last_altered) override
Definition: routine_impl.h:226
const String_type & comment() const override
Definition: routine_impl.h:234
Definition: object_keys.h:434
enum_sql_data_access
Definition: routine.h:89
enum_routine_type
Definition: routine.h:87
enum_security_type
Definition: view.h:57
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
constexpr value_type zerofill
Definition: classic_protocol_constants.h:269
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
unsigned long long Object_id
Definition: object_id.h:30
enum_column_types
Definition: column.h:52
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:85
required string key
Definition: replication_asynchronous_connection_failover.proto:59
unsigned int uint
Definition: uca-dump.cc:29