MySQL 9.1.0
Source Code Documentation
udf_registration.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2024, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef UDF_REGISTRATION_H
25#define UDF_REGISTRATION_H
26
29
30/**
31 Service for adding and removing UDF functions
32*/
33BEGIN_SERVICE_DEFINITION(udf_registration)
34/**
35 Registers a UDF function with a given name.
36
37 The name must be unique. Does not store in any table, just
38 updates the global function list.
39 Plugins/components need to handle registration deregistration
40 during their initialization and deinitialization.
41 Registers a scalar UDF by default.
42 @sa udf_aggregates
43
44 @param name name of the function
45 @param return_type return type.
46 @param func function to call
47 @param init_func function to call at query start
48 @param deinit_func function to call at query cleanup
49 @return Status of performed operation
50 @retval false success
51 @retval true failure
52*/
54 (const char *func_name, enum Item_result return_type,
55 Udf_func_any func, Udf_func_init init_func,
56 Udf_func_deinit deinit_func));
57
58/**
59 Unregisters a UDF function with a given name.
60
61 Does not store in any table, just updates the global function list.
62 Plugins/components need to handle registration deregistration
63 during their initialization and deinitialization.
64
65 @param name name of the function
66 @param[out] was_present set to non-zero if the UDF was present, but locked
67 @return Status of performed operation
68 @retval false success
69 @retval true failure
70*/
71DECLARE_BOOL_METHOD(udf_unregister, (const char *name, int *was_present));
72END_SERVICE_DEFINITION(udf_registration)
73
74/**
75 Service for turning
76*/
77BEGIN_SERVICE_DEFINITION(udf_registration_aggregate)
78/**
79 Registers an aggregate UDF function with a given name.
80
81 The name must be unique. Does not store in any table, just
82 updates the global function list.
83 Plugins/components need to handle registration deregistration
84 during their initialization and deinitialization.
85 You can use udf_registration::unregister to unregister the
86 function.
87
88 @sa udf_registration
89
90 @param name name of the function
91 @param return_type return type.
92 @param func function to call
93 @param init_func function to call at query start
94 @param deinit_func function to call at query cleanup
95 @param add_func function to call at adding a row to the current aggregate
96 @param clear_func function to call at the start of a new aggregate group
97 @return Status of performed operation
98 @retval false success
99 @retval true failure
100*/
102 (const char *func_name, enum Item_result return_type,
103 Udf_func_any func, Udf_func_init init_func,
104 Udf_func_deinit deinit_func, Udf_func_add add_func,
105 Udf_func_clear clear_func));
106
107/**
108 Unregisters an aggregate UDF function with a given name.
109
110 Does not store in any table, just updates the global function list.
111 Plugins/components need to handle registration deregistration
112 during their initialization and deinitialization.
113
114 Currently it's a synonym for udf_registration::udf_unregister.
115
116 @param name name of the function
117 @param[out] was_present set to non-zero if the UDF was present, but locked
118 @return Status of performed operation
119 @retval false success
120 @retval true failure
121*/
122DECLARE_BOOL_METHOD(udf_unregister, (const char *name, int *was_present));
123END_SERVICE_DEFINITION(udf_registration_aggregate)
124#endif
static mysql_service_status_t udf_unregister(const char *, int *) noexcept
Definition: udf_registration_all_empty.cc:40
static mysql_service_status_t udf_register(const char *, enum Item_result, Udf_func_any, Udf_func_init, Udf_func_deinit) noexcept
Definition: udf_registration_all_empty.cc:35
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:91
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:86
#define DECLARE_BOOL_METHOD(name, args)
Declares a method that returns bool as a part of the Service definition.
Definition: service.h:112
case opt name
Definition: sslopt-case.h:29
void(* Udf_func_deinit)(UDF_INIT *)
Definition: udf_registration_types.h:80
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:39
bool(* Udf_func_init)(UDF_INIT *, UDF_ARGS *, char *)
Definition: udf_registration_types.h:81
void(* Udf_func_clear)(UDF_INIT *, unsigned char *, unsigned char *)
Definition: udf_registration_types.h:77
void(* Udf_func_add)(UDF_INIT *, UDF_ARGS *, unsigned char *, unsigned char *)
Definition: udf_registration_types.h:78
void(* Udf_func_any)(void)
Definition: udf_registration_types.h:82