MySQL 8.3.0
Source Code Documentation
language_service.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 2023, 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 also distributed 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 included with MySQL.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License, version 2.0, for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef LANGUAGE_SERVICE_GUARD
24#define LANGUAGE_SERVICE_GUARD
25
28
29/**
30 The handle is created by the caller of
31 external_program_execution service.
32
33 It is guaranteed to be available only during the execution of
34 external_program_execution service API's methods.
35*/
37
38/**
39 The handle is an opaque pointer to a sp_head item.
40*/
42
43/**
44 The handle is an opaque pointer to the Stored Program's statement state.
45*/
47
48/**
49 @ingroup group_components_services_inventory
50
51 A service to query various properties/capabilities of the implementer of
52 @ref s_mysql_external_program_execution service.
53*/
54BEGIN_SERVICE_DEFINITION(external_program_capability_query)
55
56/**
57 Retrieve capability information
58
59 Supported capabilities and value type
60
61 capability: "supports_language"
62 property: "<language>"
63 value: Boolean (true - Supported, false - Not supported)
64
65 @param [in] capability Capability name (see description above)
66 @param [in,out] property Capability's property (may be null)
67 Must be one of the capability's
68 supported properties.
69 @param [out] value Implementation's capability/property information
70
71 @returns Status
72 @retval false Success
73 @retval true Error
74*/
75DECLARE_BOOL_METHOD(get, (const char *capability, char *property, void *value));
76
77END_SERVICE_DEFINITION(external_program_capability_query)
78
79/**
80 @ingroup group_components_services_inventory
81
82 A service to setup and execute multi-lingual stored procedures
83*/
84BEGIN_SERVICE_DEFINITION(external_program_execution)
85/**
86 Create and initialize stored program state if language is supported.
87
88 @param [in] sp The stored program used for associating
89 language sp state.
90 @param [in] sp_statement The statement where this stored program
91 is created (optional).
92 @param [out] lang_sp external program pointer if created,
93 nullptr otherwise.
94 @return status of initialization
95 @retval false Success
96 @retval true Error
97*/
101
102/**
103 Deinits and cleans up stored program state.
104
105 @param [in] thd (optional) The THD this stored program was attached to.
106 @param [in] lang_sp (optional) The stored program state to clean up.
107 @param [in] sp (optional) The stored program used for associating
108 language sp state when lang_sp was created.
109 @note: At least one of lang_sp or sp should be provided.
110 @returns status of de-initialization
111 @retval false Success
112 @retval true Error
113*/
116
117/**
118 Parse given external program
119
120 @param [in] lang_sp The stored program state
121 @param [in] sp_statement The statement where this stored program
122 is parsed (optional).
123 @returns Status of parsing
124 @retval false Success
125 @retval true Error
126*/
129
130/**
131 Execute given external program
132
133 @param [in] lang_sp The stored program state
134 @param [in] sp_statement The statement where this stored program
135 is executed (optional).
136 @returns Status of execution
137 @retval false Success
138 @retval true Error
139*/
142
143END_SERVICE_DEFINITION(external_program_execution)
144
145#endif /* LANGUAGE_SERVICE_GUARD */
static mysql_service_status_t deinit()
Component deinitialization.
Definition: audit_api_message_emit.cc:579
static mysql_service_status_t init()
Component initialization.
Definition: audit_api_message_emit.cc:570
#define MYSQL_THD
Definition: backup_page_tracker.h:37
int execute(const vector< string > &positional_options)
Definition: mysqlcheck_core.cc:506
struct external_program_handle_imp * external_program_handle
The handle is created by the caller of external_program_execution service.
Definition: language_service.h:36
struct stored_program_handle_imp * stored_program_handle
The handle is an opaque pointer to a sp_head item.
Definition: language_service.h:41
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:46
void get(PSI_field *, PSI_longlong *) noexcept
Definition: pfs_plugin_column_bigint_v1_all_empty.cc:31
bool parse(MYSQL_THD thd, const string &query, bool is_prepared, Condition_handler *handler)
Definition: services.cc:80
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:90
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:85
#define DEFINE_SERVICE_HANDLE(name)
Defines an object type that is meant for carrying handles to the implementation-specific objects used...
Definition: service.h:128
#define DECLARE_BOOL_METHOD(name, args)
Declares a method that returns bool as a part of the Service definition.
Definition: service.h:111