MySQL 8.0.31
Source Code Documentation
parameter_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__PARAMETER_IMPL_INCLUDED
24#define DD__PARAMETER_IMPL_INCLUDED
25
26#include <assert.h>
27#include <stddef.h>
28#include <sys/types.h>
29#include <memory> // std::unique_ptr
30#include <new>
31
32#include "sql/dd/impl/properties_impl.h" // dd::Properties_imp
34#include "sql/dd/impl/types/entity_object_impl.h" // dd::Entity_object_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/parameter.h" // dd::Parameter
40#include "sql/dd/types/parameter_type_element.h" // IWYU pragma: keep
41
42namespace dd {
43
44///////////////////////////////////////////////////////////////////////////
45
46class Object_table;
47class Open_dictionary_tables_ctx;
48class Routine;
49class Routine_impl;
50class Weak_object;
51
52///////////////////////////////////////////////////////////////////////////
53
55 public:
57
59
60 Parameter_impl(const Parameter_impl &src, Routine_impl *parent);
61
62 ~Parameter_impl() override = default;
63
64 public:
65 const Object_table &object_table() const override;
66
67 bool validate() const override;
68
70
72
73 bool drop_children(Open_dictionary_tables_ctx *otx) const override;
74
75 bool store_attributes(Raw_record *r) override;
76
77 bool restore_attributes(const Raw_record &r) override;
78
79 void debug_print(String_type &outb) const override;
80
83 }
84
85 public:
87
88 /////////////////////////////////////////////////////////////////////////
89 // Name is nullable in case of function return type.
90 /////////////////////////////////////////////////////////////////////////
91
92 void set_name_null(bool is_null) override { m_is_name_null = is_null; }
93
94 bool is_name_null() const override { return m_is_name_null; }
95
96 /////////////////////////////////////////////////////////////////////////
97 // ordinal_position.
98 /////////////////////////////////////////////////////////////////////////
99
100 uint ordinal_position() const override { return m_ordinal_position; }
101
102 /////////////////////////////////////////////////////////////////////////
103 // parameter_mode.
104 /////////////////////////////////////////////////////////////////////////
105
106 enum_parameter_mode mode() const override { return m_parameter_mode; }
107
109
110 void set_parameter_mode_null(bool is_null) override {
111 m_parameter_mode_null = is_null;
112 }
113
114 bool is_parameter_mode_null() const override { return m_parameter_mode_null; }
115
116 /////////////////////////////////////////////////////////////////////////
117 // parameter_mode.
118 /////////////////////////////////////////////////////////////////////////
119
120 enum_column_types data_type() const override { return m_data_type; }
121
123
124 /////////////////////////////////////////////////////////////////////////
125 // display type
126 /////////////////////////////////////////////////////////////////////////
127
128 const String_type &data_type_utf8() const override {
129 return m_data_type_utf8;
130 }
131
134 }
135
136 /////////////////////////////////////////////////////////////////////////
137 // is_zerofill.
138 /////////////////////////////////////////////////////////////////////////
139
140 bool is_zerofill() const override { return m_is_zerofill; }
141
142 void set_zerofill(bool zerofill) override { m_is_zerofill = zerofill; }
143
144 /////////////////////////////////////////////////////////////////////////
145 // is_unsigned.
146 /////////////////////////////////////////////////////////////////////////
147
148 bool is_unsigned() const override { return m_is_unsigned; }
149
150 void set_unsigned(bool unsigned_flag) override {
151 m_is_unsigned = unsigned_flag;
152 }
153
154 /////////////////////////////////////////////////////////////////////////
155 // char_length.
156 /////////////////////////////////////////////////////////////////////////
157
158 size_t char_length() const override { return m_char_length; }
159
160 void set_char_length(size_t char_length) override {
162 }
163
164 /////////////////////////////////////////////////////////////////////////
165 // numeric_precision.
166 /////////////////////////////////////////////////////////////////////////
167
168 uint numeric_precision() const override { return m_numeric_precision; }
169
173 }
174
175 virtual void set_numeric_precision_null(bool is_null) {
176 m_numeric_precision_null = is_null;
177 }
178
179 virtual bool is_numeric_precision_null() const {
181 }
182
183 /////////////////////////////////////////////////////////////////////////
184 // numeric_scale.
185 /////////////////////////////////////////////////////////////////////////
186
187 uint numeric_scale() const override { return m_numeric_scale; }
188
190 m_numeric_scale_null = false;
192 }
193
194 void set_numeric_scale_null(bool is_null) override {
195 m_numeric_scale_null = is_null;
196 }
197
198 bool is_numeric_scale_null() const override { return m_numeric_scale_null; }
199
200 /////////////////////////////////////////////////////////////////////////
201 // datetime_precision.
202 /////////////////////////////////////////////////////////////////////////
203
204 uint datetime_precision() const override { return m_datetime_precision; }
205
209 }
210
211 virtual void set_datetime_precision_null(bool is_null) {
213 }
214
215 virtual bool is_datetime_precision_null() const {
217 }
218
219 /////////////////////////////////////////////////////////////////////////
220 // collation.
221 /////////////////////////////////////////////////////////////////////////
222
223 Object_id collation_id() const override { return m_collation_id; }
224
227 }
228
229 /////////////////////////////////////////////////////////////////////////
230 // Options.
231 /////////////////////////////////////////////////////////////////////////
232
233 const Properties &options() const override { return m_options; }
234
235 Properties &options() override { return m_options; }
236
237 bool set_options(const String_type &options_raw) override {
238 return m_options.insert_values(options_raw);
239 }
240
241 /////////////////////////////////////////////////////////////////////////
242 // routine.
243 /////////////////////////////////////////////////////////////////////////
244
245 const Routine &routine() const override;
246
247 Routine &routine() override;
248
249 /////////////////////////////////////////////////////////////////////////
250 // Elements.
251 /////////////////////////////////////////////////////////////////////////
252
254
258 return m_elements;
259 }
260
261 size_t elements_count() const override { return m_elements.size(); }
262
263 // Fix "inherits ... via dominance" warnings
265 const Entity_object_impl *impl() const override {
267 }
268 Object_id id() const override { return Entity_object_impl::id(); }
269 bool is_persistent() const override {
271 }
272 const String_type &name() const override {
274 }
275 void set_name(const String_type &name) override {
277 }
278
279 public:
281 return new (std::nothrow) Parameter_impl(routine);
282 }
283
284 static Parameter_impl *clone(const Parameter_impl &other,
286 return new (std::nothrow) Parameter_impl(other, routine);
287 }
288
289 private:
290 // Fields
292
297
300
309
311
313
314 // References to other tightly coupled objects
316
317 // References to loosely-coupled objects.
318
320};
321
322///////////////////////////////////////////////////////////////////////////
323
324} // namespace dd
325
326#endif // DD__PARAMETER_IMPL_INCLUDED
Definition: collection.h:43
size_t size() const
Definition: collection.h:228
Definition: entity_object_impl.h:43
void set_name(const String_type &name) override
Definition: entity_object_impl.h:61
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
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:71
Auxiliary class for opening dictionary tables.
Definition: transaction_impl.h:75
Definition: parameter_impl.h:54
virtual void set_datetime_precision_null(bool is_null)
Definition: parameter_impl.h:211
void set_collation_id(Object_id collation_id) override
Definition: parameter_impl.h:225
static Parameter_impl * restore_item(Routine_impl *routine)
Definition: parameter_impl.h:280
void set_numeric_scale_null(bool is_null) override
Definition: parameter_impl.h:194
bool set_options(const String_type &options_raw) override
Definition: parameter_impl.h:237
bool m_is_name_null
Definition: parameter_impl.h:291
void set_zerofill(bool zerofill) override
Definition: parameter_impl.h:142
void set_numeric_precision(uint numeric_precision) override
Definition: parameter_impl.h:170
bool m_numeric_precision_null
Definition: parameter_impl.h:304
size_t m_char_length
Definition: parameter_impl.h:302
bool is_numeric_scale_null() const override
Definition: parameter_impl.h:198
const Entity_object_impl * impl() const override
Definition: parameter_impl.h:265
void set_name(const String_type &name) override
Definition: parameter_impl.h:275
bool m_is_unsigned
Definition: parameter_impl.h:299
size_t char_length() const override
Definition: parameter_impl.h:158
enum_column_types data_type() const override
Definition: parameter_impl.h:120
enum_column_types m_data_type
Definition: parameter_impl.h:295
Object_id collation_id() const override
Definition: parameter_impl.h:223
bool m_parameter_mode_null
Definition: parameter_impl.h:294
enum_parameter_mode mode() const override
Definition: parameter_impl.h:106
virtual bool is_numeric_precision_null() const
Definition: parameter_impl.h:179
uint m_numeric_scale
Definition: parameter_impl.h:305
void set_unsigned(bool unsigned_flag) override
Definition: parameter_impl.h:150
uint m_ordinal_position
Definition: parameter_impl.h:301
void set_mode(enum_parameter_mode mode) override
Definition: parameter_impl.h:108
bool restore_attributes(const Raw_record &r) override
Definition: parameter_impl.cc:160
bool is_name_null() const override
Definition: parameter_impl.h:94
void set_data_type_utf8(const String_type &data_type_utf8) override
Definition: parameter_impl.h:132
Parameter_type_element_collection m_elements
Definition: parameter_impl.h:310
void set_data_type(enum_column_types type) override
Definition: parameter_impl.h:122
bool m_numeric_scale_null
Definition: parameter_impl.h:306
Properties & options() override
Definition: parameter_impl.h:235
bool is_zerofill() const override
Definition: parameter_impl.h:140
Routine_impl * m_routine
Definition: parameter_impl.h:315
Parameter_impl()
Definition: parameter_impl.cc:57
bool m_is_zerofill
Definition: parameter_impl.h:298
Object_id id() const override
The unique dictionary object id.
Definition: parameter_impl.h:268
const String_type & name() const override
Definition: parameter_impl.h:272
const Routine & routine() const override
Definition: parameter_impl.cc:100
bool is_unsigned() const override
Definition: parameter_impl.h:148
Entity_object_impl * impl() override
Definition: parameter_impl.h:264
bool drop_children(Open_dictionary_tables_ctx *otx) const override
Definition: parameter_impl.cc:148
Object_id m_collation_id
Definition: parameter_impl.h:319
virtual void set_numeric_precision_null(bool is_null)
Definition: parameter_impl.h:175
Parameter_type_element * add_element() override
Definition: parameter_impl.cc:266
void set_numeric_scale(uint numeric_scale) override
Definition: parameter_impl.h:189
void set_name_null(bool is_null) override
Definition: parameter_impl.h:92
bool store_children(Open_dictionary_tables_ctx *otx) override
Definition: parameter_impl.cc:142
size_t elements_count() const override
Definition: parameter_impl.h:261
bool m_datetime_precision_null
Definition: parameter_impl.h:308
const Object_table & object_table() const override
Definition: parameter_impl.cc:305
virtual bool is_datetime_precision_null() const
Definition: parameter_impl.h:215
bool restore_children(Open_dictionary_tables_ctx *otx) override
Definition: parameter_impl.cc:125
void debug_print(String_type &outb) const override
Definition: parameter_impl.cc:220
uint m_numeric_precision
Definition: parameter_impl.h:303
uint ordinal_position() const override
Definition: parameter_impl.h:100
void set_char_length(size_t char_length) override
Definition: parameter_impl.h:160
Properties_impl m_options
Definition: parameter_impl.h:312
uint numeric_scale() const override
Definition: parameter_impl.h:187
enum_parameter_mode m_parameter_mode
Definition: parameter_impl.h:293
bool validate() const override
Definition: parameter_impl.cc:107
const Parameter_type_element_collection & elements() const override
Definition: parameter_impl.h:255
uint m_datetime_precision
Definition: parameter_impl.h:307
uint numeric_precision() const override
Definition: parameter_impl.h:168
String_type m_data_type_utf8
Definition: parameter_impl.h:296
const Properties & options() const override
Definition: parameter_impl.h:233
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: parameter_impl.cc:311
static Parameter_impl * clone(const Parameter_impl &other, Routine_impl *routine)
Definition: parameter_impl.h:284
bool store_attributes(Raw_record *r) override
Definition: parameter_impl.cc:195
const String_type & data_type_utf8() const override
Definition: parameter_impl.h:128
void set_parameter_mode_null(bool is_null) override
Definition: parameter_impl.h:110
uint datetime_precision() const override
Definition: parameter_impl.h:204
bool is_parameter_mode_null() const override
Definition: parameter_impl.h:114
~Parameter_impl() override=default
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: parameter_impl.h:269
void set_datetime_precision(uint datetime_precision) override
Definition: parameter_impl.h:206
void set_ordinal_position(uint ordinal_position)
Definition: parameter_impl.h:81
Definition: parameter_type_element.h:42
Definition: parameter.h:44
enum_parameter_mode
Definition: parameter.h:55
The Properties_impl class implements the Properties interface.
Definition: properties_impl.h:76
bool insert_values(const Properties &properties) override
Insert key/value pairs from a different property object.
Definition: properties_impl.cc:103
The Properties class defines an interface for storing key=value pairs, where both key and value may b...
Definition: properties.h:73
Definition: raw_record.h:45
Definition: routine_impl.h:51
Abstract base class for functions and procedures.
Definition: routine.h:60
constexpr value_type zerofill
Definition: classic_protocol_constants.h:271
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 type
Definition: replication_group_member_actions.proto:33
unsigned int uint
Definition: uca-dump.cc:29