MySQL 8.4.2
Source Code Documentation
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
29
30/**
31 The handle is created by the caller of
32 external_program_execution service.
33
34 It is guaranteed to be available only during the execution of
35 external_program_execution service API's methods.
36*/
38
39/**
40 The handle is an opaque pointer to a sp_head item.
41*/
43
44/**
45 The handle is an opaque pointer to the Stored Program's statement state.
46*/
48
49/**
50 @ingroup group_components_services_inventory
51
52 A service to query various properties/capabilities of the implementer of
53 @ref s_mysql_external_program_execution service.
54*/
55BEGIN_SERVICE_DEFINITION(external_program_capability_query)
56
57/**
58 Retrieve capability information
59
60 Supported capabilities and value type
61
62 capability: "supports_language"
63 property: "<language>"
64 value: Boolean (true - Supported, false - Not supported)
65
66 @param [in] capability Capability name (see description above)
67 @param [in,out] property Capability's property (may be null)
68 Must be one of the capability's
69 supported properties.
70 @param [out] value Implementation's capability/property information
71
72 @returns Status
73 @retval false Success
74 @retval true Error
75*/
76DECLARE_BOOL_METHOD(get, (const char *capability, char *property, void *value));
77
78END_SERVICE_DEFINITION(external_program_capability_query)
79
80/**
81 @ingroup group_components_services_inventory
82
83 A service to setup and execute multi-lingual stored procedures
84*/
85BEGIN_SERVICE_DEFINITION(external_program_execution)
86/**
87 Create and initialize stored program state if language is supported.
88
89 @param [in] sp The stored program used for associating
90 language sp state.
91 @param [in] sp_statement The statement where this stored program
92 is created (optional).
93 @param [out] lang_sp external program pointer if created,
94 nullptr otherwise.
95 @return status of initialization
96 @retval false Success
97 @retval true Error
98*/
102
103/**
104 Deinits and cleans up stored program state.
105
106 @param [in] thd (optional) The THD this stored program was attached to.
107 @param [in] lang_sp (optional) The stored program state to clean up.
108 @param [in] sp (optional) The stored program used for associating
109 language sp state when lang_sp was created.
110 @note: At least one of lang_sp or sp should be provided.
111 @returns status of de-initialization
112 @retval false Success
113 @retval true Error
114*/
117
118/**
119 Parse given external program
120
121 @param [in] lang_sp The stored program state
122 @param [in] sp_statement The statement where this stored program
123 is parsed (optional).
124 @returns Status of parsing
125 @retval false Success
126 @retval true Error
127*/
130
131/**
132 Execute given external program
133
134 @param [in] lang_sp The stored program state
135 @param [in] sp_statement The statement where this stored program
136 is executed (optional).
137 @returns Status of execution
138 @retval false Success
139 @retval true Error
140*/
143
144END_SERVICE_DEFINITION(external_program_execution)
145
146#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:37
struct stored_program_handle_imp * stored_program_handle
The handle is an opaque pointer to a sp_head item.
Definition: language_service.h:42
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:47
void get(PSI_field *, PSI_longlong *) noexcept
Definition: pfs_plugin_column_bigint_v1_all_empty.cc:32
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