MySQL 9.2.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
language_service.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 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 LANGUAGE_SERVICE_GUARD
25#define LANGUAGE_SERVICE_GUARD
26
30
31/**
32 The handle is created by the caller of
33 external_program_execution service.
34
35 It is guaranteed to be available only during the execution of
36 external_program_execution service API's methods.
37*/
39
40/**
41 The handle is an opaque pointer to a sp_head item.
42*/
44
45/**
46 The handle is an opaque pointer to the Stored Program's statement state.
47*/
49
50/**
51 @ingroup group_components_services_inventory
52
53 A service to query various properties/capabilities of the implementer of
54 @ref s_mysql_external_program_execution service.
55*/
56BEGIN_SERVICE_DEFINITION(external_program_capability_query)
57
58/**
59 Retrieve capability information
60
61 Supported capabilities and value type
62
63 capability: "supports_language"
64 property: "<language>"
65 value: Boolean (true - Supported, false - Not supported)
66
67 @param [in] capability Capability name (see description above)
68 @param [in,out] property Capability's property (may be null)
69 Must be one of the capability's
70 supported properties.
71 @param [out] value Implementation's capability/property information
72
73 @returns Status
74 @retval false Success
75 @retval true Error
76*/
77DECLARE_BOOL_METHOD(get, (const char *capability, char *property, void *value));
78
79END_SERVICE_DEFINITION(external_program_capability_query)
80
81/**
82 @ingroup group_components_services_inventory
83
84 A service to setup and execute multi-lingual stored procedures
85*/
86BEGIN_SERVICE_DEFINITION(external_program_execution)
87/**
88 Create and initialize stored program state if language is supported.
89
90 @param [in] sp The stored program used for associating
91 language sp state.
92 @param [in] sp_statement The statement where this stored program
93 is created (optional).
94 @param [out] lang_sp external program pointer if created,
95 nullptr otherwise.
96 @return status of initialization
97 @retval false Success
98 @retval true Error
99*/
103
104/**
105 Deinits and cleans up stored program state.
106
107 @param [in] thd (optional) The THD this stored program was attached to.
108 @param [in] lang_sp (optional) The stored program state to clean up.
109 @param [in] sp (optional) The stored program used for associating
110 language sp state when lang_sp was created.
111 @note: At least one of lang_sp or sp should be provided.
112 @returns status of de-initialization
113 @retval false Success
114 @retval true Error
115*/
118
119/**
120 Parse given external program
121
122 @param [in] lang_sp The stored program state
123 @param [in] sp_statement The statement where this stored program
124 is parsed (optional).
125 @returns Status of parsing
126 @retval false Success
127 @retval true Error
128*/
131
132/**
133 Execute given external program
134
135 @param [in] lang_sp The stored program state
136 @param [in] sp_statement The statement where this stored program
137 is executed (optional).
138 @returns Status of execution
139 @retval false Success
140 @retval true Error
141*/
144
145END_SERVICE_DEFINITION(external_program_execution)
146
147/**
148 @ingroup group_components_services_inventory
149
150 A service to parse library code
151*/
153
154/**
155 Check if the language of the library is supported
156
157 @param [in] language Language of the library source code
158 @param [out] result Returns true if the language is supported
159
160 @return Status of the performed operation
161 @retval false success
162 @retval true failure
163*/
164DECLARE_BOOL_METHOD(is_language_supported,
166
167/**
168 Parses library code.
169
170 @param [in] name Name of the library
171 @param [in] language Language of the library source code
172 @param [in] body Library's source code in UTF8MB4 charset
173
174 @return Status of the performed operation
175 @retval false success
176 @retval true failure
177*/
181
182END_SERVICE_DEFINITION(external_library)
183
184#endif /* LANGUAGE_SERVICE_GUARD */
static mysql_service_status_t deinit()
Component deinitialization.
Definition: audit_api_message_emit.cc:580
static mysql_service_status_t init()
Component initialization.
Definition: audit_api_message_emit.cc:571
#define MYSQL_THD
Definition: backup_page_tracker.h:38
int execute(const vector< string > &positional_options)
Definition: mysqlcheck_core.cc:507
struct external_program_handle_imp * external_program_handle
The handle is created by the caller of external_program_execution service.
Definition: language_service.h:38
struct stored_program_handle_imp * stored_program_handle
The handle is an opaque pointer to a sp_head item.
Definition: language_service.h:43
struct stored_program_statement_handle_imp * stored_program_statement_handle
The handle is an opaque pointer to the Stored Program's statement state.
Definition: language_service.h:48
String related data structures.
static mysql_service_status_t get(THD **thd) noexcept
Definition: mysql_current_thread_reader_all_empty.cc:31
bool parse(MYSQL_THD thd, const string &query, bool is_prepared, Condition_handler *handler)
Definition: services.cc:81
#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 DEFINE_SERVICE_HANDLE(name)
Defines an object type that is meant for carrying handles to the implementation-specific objects used...
Definition: service.h:129
#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
String with length information.
Definition: mysql_string_defs.h:33
Definition: result.h:30