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