MySQL  8.0.27
Source Code Documentation
sql_component.h
Go to the documentation of this file.
1 /* Copyright (c) 2016, 2021, 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 
34 class THD;
35 
36 /**
37  This class implements the INSTALL COMPONENT statement.
38 */
39 
41  public:
43  : m_urns(urns) {}
44 
47  }
48 
49  /**
50  Install a new component by loading it by dynamic loader service.
51 
52  @param thd Thread context
53 
54  @returns false if success, true otherwise
55  */
56  bool execute(THD *thd) override;
57 
58  private:
60 };
61 
62 /**
63  This class implements the UNINSTALL COMPONENT statement.
64 */
65 
67  public:
69  : m_urns(urns) {}
70 
73  }
74 
75  /**
76  Uninstall a plugin by unloading it in the dynamic loader service.
77 
78  @param thd Thread context
79 
80  @returns false if success, true otherwise
81  */
82  bool execute(THD *thd) override;
83 
84  private:
86 };
87 
88 /**
89  This class implements component loading through manifest file
90 */
91 class Deployed_components final {
92  public:
93  explicit Deployed_components(const std::string program_name);
95  bool valid() const { return valid_; }
96  bool components_loaded() const { return loaded_; }
97 
98  private:
99  void get_next_component(std::string &components_list,
100  std::string &one_component);
101  bool load();
102  bool unload();
103  bool make_urns(std::vector<const char *> &urns);
104 
105  private:
106  std::string program_name_;
107  std::string components_;
108  std::string last_error_;
109  bool valid_;
110  bool loaded_;
111 };
112 #endif
This class implements component loading through manifest file.
Definition: sql_component.h:91
std::string components_
Definition: sql_component.h:107
bool loaded_
Definition: sql_component.h:110
bool load()
Definition: sql_component.cc:175
~Deployed_components()
Definition: sql_component.cc:125
std::string last_error_
Definition: sql_component.h:108
std::string program_name_
Definition: sql_component.h:106
bool valid_
Definition: sql_component.h:109
Deployed_components(const std::string program_name)
Definition: sql_component.cc:110
bool valid() const
Definition: sql_component.h:95
bool make_urns(std::vector< const char * > &urns)
Definition: sql_component.cc:149
bool components_loaded() const
Definition: sql_component.h:96
bool unload()
Definition: sql_component.cc:237
void get_next_component(std::string &components_list, std::string &one_component)
Definition: sql_component.cc:131
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:60
This class implements the INSTALL COMPONENT statement.
Definition: sql_component.h:40
Sql_cmd_install_component(const Mem_root_array_YY< LEX_STRING > &urns)
Definition: sql_component.h:42
bool execute(THD *thd) override
Install a new component by loading it by dynamic loader service.
Definition: sql_component.cc:50
const Mem_root_array_YY< LEX_STRING > m_urns
Definition: sql_component.h:59
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_component.h:45
This class implements the UNINSTALL COMPONENT statement.
Definition: sql_component.h:66
const Mem_root_array_YY< LEX_STRING > m_urns
Definition: sql_component.h:85
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_component.h:71
Sql_cmd_uninstall_component(const Mem_root_array_YY< LEX_STRING > &urns)
Definition: sql_component.h:68
bool execute(THD *thd) override
Uninstall a plugin by unloading it in the dynamic loader service.
Definition: sql_component.cc:84
Representation of an SQL command.
Definition: sql_cmd.h:64
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:821
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.