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