MySQL 9.1.0
Source Code Documentation
function.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_INCLUDED
25#define DD__FUNCTION_INCLUDED
26
27#include "my_inttypes.h"
28#include "sql/dd/types/column.h" // dd::Column::enum_column_types
29#include "sql/dd/types/routine.h" // dd::Routine
30
31struct MDL_key;
32
33namespace dd {
34
35class Function_impl;
36
37///////////////////////////////////////////////////////////////////////////
38
39class Function : virtual public Routine {
40 public:
42
43 bool update_name_key(Name_key *key) const override {
45 }
46
48 const String_type &name);
49
50 public:
51 ~Function() override = default;
52
53 public:
54 /////////////////////////////////////////////////////////////////////////
55 // result data type.
56 /////////////////////////////////////////////////////////////////////////
57
60
61 virtual void set_result_data_type_null(bool is_null) = 0;
62 virtual bool is_result_data_type_null() const = 0;
63
64 /////////////////////////////////////////////////////////////////////////
65 // Result display type
66 /////////////////////////////////////////////////////////////////////////
67
68 virtual const String_type &result_data_type_utf8() const = 0;
69
72
73 /////////////////////////////////////////////////////////////////////////
74 // result_is_zerofill.
75 /////////////////////////////////////////////////////////////////////////
76
77 virtual bool result_is_zerofill() const = 0;
78 virtual void set_result_zerofill(bool zerofill) = 0;
79
80 /////////////////////////////////////////////////////////////////////////
81 // result_is_unsigned.
82 /////////////////////////////////////////////////////////////////////////
83
84 virtual bool result_is_unsigned() const = 0;
85 virtual void set_result_unsigned(bool unsigned_flag) = 0;
86
87 /////////////////////////////////////////////////////////////////////////
88 // result_char_length.
89 /////////////////////////////////////////////////////////////////////////
90
91 virtual size_t result_char_length() const = 0;
92 virtual void set_result_char_length(size_t char_length) = 0;
93
94 /////////////////////////////////////////////////////////////////////////
95 // result_numeric_precision.
96 /////////////////////////////////////////////////////////////////////////
97
98 virtual uint result_numeric_precision() const = 0;
99 virtual void set_result_numeric_precision(uint numeric_precision) = 0;
100
101 /////////////////////////////////////////////////////////////////////////
102 // result_numeric_scale.
103 /////////////////////////////////////////////////////////////////////////
104
105 virtual uint result_numeric_scale() const = 0;
106 virtual void set_result_numeric_scale(uint numeric_scale) = 0;
107 virtual void set_result_numeric_scale_null(bool is_null) = 0;
108 virtual bool is_result_numeric_scale_null() const = 0;
109
110 /////////////////////////////////////////////////////////////////////////
111 // result_datetime_precision.
112 /////////////////////////////////////////////////////////////////////////
113
114 virtual uint result_datetime_precision() const = 0;
115 virtual void set_result_datetime_precision(uint datetime_precision) = 0;
116
117 /////////////////////////////////////////////////////////////////////////
118 // result_collation.
119 /////////////////////////////////////////////////////////////////////////
120
121 virtual Object_id result_collation_id() const = 0;
122 virtual void set_result_collation_id(Object_id collation_id) = 0;
123
124 /**
125 Allocate a new object graph and invoke the copy constructor for
126 each object. Only used in unit testing.
127
128 @return pointer to dynamically allocated copy
129 */
130 Function *clone() const override = 0;
131
132 /**
133 Allocate a new object which can serve as a placeholder for the original
134 object in the Dictionary_client's dropped registry. Such object has the
135 same keys as the original but has no other info and as result occupies
136 less memory.
137 */
139
140 static void create_mdl_key(const String_type &schema_name,
141 const String_type &name, MDL_key *key) {
143 }
144};
145
146///////////////////////////////////////////////////////////////////////////
147
148} // namespace dd
149
150#endif // DD__FUNCTION_INCLUDED
virtual const String_type & name() const =0
Definition: function_impl.h:52
Definition: function.h:39
virtual void set_result_datetime_precision(uint datetime_precision)=0
virtual void set_result_collation_id(Object_id collation_id)=0
static void create_mdl_key(const String_type &schema_name, const String_type &name, MDL_key *key)
Definition: function.h:140
virtual enum_column_types result_data_type() const =0
virtual const String_type & result_data_type_utf8() const =0
virtual void set_result_zerofill(bool zerofill)=0
virtual bool is_result_data_type_null() const =0
virtual void set_result_unsigned(bool unsigned_flag)=0
virtual bool result_is_unsigned() const =0
virtual size_t result_char_length() const =0
virtual Object_id result_collation_id() const =0
virtual void set_result_char_length(size_t char_length)=0
virtual void set_result_numeric_precision(uint numeric_precision)=0
Function * clone() const override=0
Allocate a new object graph and invoke the copy constructor for each object.
virtual uint result_numeric_precision() const =0
virtual void set_result_numeric_scale_null(bool is_null)=0
Function * clone_dropped_object_placeholder() const override=0
Allocate a new object which can serve as a placeholder for the original object in the Dictionary_clie...
virtual uint result_datetime_precision() const =0
~Function() override=default
virtual bool is_result_numeric_scale_null() const =0
virtual void set_result_data_type(enum_column_types type)=0
virtual void set_result_data_type_utf8(const String_type &result_data_type_utf8)=0
virtual bool result_is_zerofill() const =0
bool update_name_key(Name_key *key) const override
Definition: function.h:43
Function_impl Impl
Definition: function.h:41
virtual void set_result_numeric_scale(uint numeric_scale)=0
virtual void set_result_data_type_null(bool is_null)=0
virtual uint result_numeric_scale() const =0
Definition: object_keys.h:434
Abstract base class for functions and procedures.
Definition: routine.h:61
virtual bool update_routine_name_key(Name_key *key, Object_id schema_id, const String_type &name) const =0
virtual Object_id schema_id() const =0
virtual enum_routine_type type() const =0
Routine_name_key Name_key
Definition: routine.h:67
@ RT_FUNCTION
Definition: routine.h:88
static void create_mdl_key(enum_routine_type type, const String_type &schema_name, const String_type &name, MDL_key *key)
Definition: routine_impl.cc:290
Some integer typedefs for easier portability.
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
required string key
Definition: replication_asynchronous_connection_failover.proto:60
Metadata lock object key.
Definition: mdl.h:366