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