MySQL 8.4.0
Source Code Documentation
sql_component.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef _sql_component_h
25#define _sql_component_h
26
27#include <string>
28#include <vector>
29
30#include "lex_string.h"
31#include "my_sqlcommand.h"
32#include "sql/mem_root_array.h"
33#include "sql/sql_cmd.h"
34
35class THD;
36class PT_item_list;
37class String;
39
40/**
41 This class implements the INSTALL COMPONENT statement.
42*/
43
45 public:
48 : m_urns(urns), m_set_exprs(set_exprs) {}
49
52 }
53
54 /**
55 Install a new component by loading it by dynamic loader service.
56
57 @param thd Thread context
58
59 @returns false if success, true otherwise
60 */
61 bool execute(THD *thd) override;
62
63 char **m_arg_list{nullptr};
65
66 private:
69};
70
71/**
72 This class implements the UNINSTALL COMPONENT statement.
73*/
74
76 public:
78 : m_urns(urns) {}
79
82 }
83
84 /**
85 Uninstall a plugin by unloading it in the dynamic loader service.
86
87 @param thd Thread context
88
89 @returns false if success, true otherwise
90 */
91 bool execute(THD *thd) override;
92
93 private:
95};
96
97/**
98 This class implements component loading through manifest file
99*/
101 public:
102 explicit Deployed_components(const std::string program_name,
103 const std::string instance_path);
105 bool valid() const { return valid_; }
106 bool components_loaded() const { return loaded_; }
107
108 private:
109 void get_next_component(std::string &components_list,
110 std::string &one_component);
111 bool load();
112 bool unload();
113 bool make_urns(std::vector<const char *> &urns);
114
115 private:
116 std::string program_name_;
117 std::string instance_path_;
118 std::string components_;
119 std::string last_error_;
120 bool valid_;
122};
123#endif
This class implements component loading through manifest file.
Definition: sql_component.h:100
std::string components_
Definition: sql_component.h:118
bool loaded_
Definition: sql_component.h:121
bool load()
Definition: sql_component.cc:271
~Deployed_components()
Definition: sql_component.cc:221
std::string last_error_
Definition: sql_component.h:119
std::string program_name_
Definition: sql_component.h:116
bool valid_
Definition: sql_component.h:120
std::string instance_path_
Definition: sql_component.h:117
bool valid() const
Definition: sql_component.h:105
Deployed_components(const std::string program_name, const std::string instance_path)
Definition: sql_component.cc:204
bool make_urns(std::vector< const char * > &urns)
Definition: sql_component.cc:245
bool components_loaded() const
Definition: sql_component.h:106
bool unload()
Definition: sql_component.cc:340
void get_next_component(std::string &components_list, std::string &one_component)
Definition: sql_component.cc:227
Definition: sql_list.h:467
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:61
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:105
This class implements the INSTALL COMPONENT statement.
Definition: sql_component.h:44
char ** m_arg_list
Definition: sql_component.h:63
int m_arg_list_size
Definition: sql_component.h:64
List< PT_install_component_set_element > * m_set_exprs
Definition: sql_component.h:68
bool execute(THD *thd) override
Install a new component by loading it by dynamic loader service.
Definition: sql_component.cc:54
Sql_cmd_install_component(const Mem_root_array_YY< LEX_STRING > &urns, List< PT_install_component_set_element > *set_exprs)
Definition: sql_component.h:46
const Mem_root_array_YY< LEX_STRING > m_urns
Definition: sql_component.h:67
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_component.h:50
This class implements the UNINSTALL COMPONENT statement.
Definition: sql_component.h:75
const Mem_root_array_YY< LEX_STRING > m_urns
Definition: sql_component.h:94
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_component.h:80
Sql_cmd_uninstall_component(const Mem_root_array_YY< LEX_STRING > &urns)
Definition: sql_component.h:77
bool execute(THD *thd) override
Uninstall a plugin by unloading it in the dynamic loader service.
Definition: sql_component.cc:178
Representation of an SQL command.
Definition: sql_cmd.h:83
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
enum_sql_command
Definition: my_sqlcommand.h:46
@ SQLCOM_INSTALL_COMPONENT
Definition: my_sqlcommand.h:187
@ SQLCOM_UNINSTALL_COMPONENT
Definition: my_sqlcommand.h:188
Representation of an SQL command.
Definition: parser_yystype.h:333