MySQL  8.0.19
Source Code Documentation
resource_group_sql_cmd.h
Go to the documentation of this file.
1 /* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
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 RESOURCEGROUPS_RESOURCE_GROUP_SQL_CMD_H_
24 #define RESOURCEGROUPS_RESOURCE_GROUP_SQL_CMD_H_
25 
26 #include "lex_string.h"
27 #include "my_inttypes.h"
28 #include "my_sqlcommand.h"
29 #include "sql/mem_root_array.h"
32 #include "sql/sql_cmd.h"
33 
38 class THD;
39 
40 namespace resourcegroups {
41 
42 /**
43  Sql_cmd_create_resource_group represents CREATE RESOURCE GROUP statement.
44 */
45 
47  friend class ::PT_create_resource_group;
48 
49  public:
51  const Mem_root_array<Range> *cpu_list,
52  int priority, bool enabled)
53  : m_name(name),
54  m_type(type),
55  m_cpu_list(cpu_list),
56  m_priority(priority),
57  m_enabled(enabled) {}
58 
61  }
62 
63  bool execute(THD *thd) override;
64 
65  private:
67  const Type m_type;
70  bool m_enabled;
71 };
72 
73 /**
74  Sql_cmd_alter_resource_group represents ALTER RESOURCE GROUP statement.
75 */
76 
78  friend class ::PT_alter_resource_group;
79 
80  public:
82  const Mem_root_array<Range> *cpu_list,
83  int priority, bool enable, bool force,
84  bool use_enable)
85  : m_name(name),
86  m_cpu_list(cpu_list),
87  m_priority(priority),
88  m_enable(enable),
89  m_force(force),
90  m_use_enable(use_enable) {}
91 
94  }
95 
96  bool execute(THD *thd) override;
97 
98  private:
102  bool m_enable;
103  bool m_force;
105 };
106 
107 /**
108  Sql_cmd_drop_resource_group represents DROP RESOURCE GROUP statement.
109 */
110 
112  friend class ::PT_drop_resource_group;
113 
114  public:
116  : m_name(name), m_force(force) {}
117 
120  }
121 
122  bool execute(THD *thd) override;
123 
124  private:
126  bool m_force;
127 };
128 
129 /**
130  Sql_cmd_set_resource_group represents SET RESOURCE GROUP statement.
131 */
132 
134  friend class ::PT_set_resource_group;
135 
136  public:
138  Mem_root_array<ulonglong> *thread_id_list)
139  : m_name(name), m_thread_id_list(thread_id_list) {}
140 
143  }
144 
145  bool execute(THD *thd) override;
146  bool prepare(THD *thd) override;
147 
148  private:
151 };
152 } // namespace resourcegroups
153 #endif // RESOURCEGROUPS_RESOURCE_GROUP_SQL_CMD_H_
SQLCOM_ALTER_RESOURCE_GROUP
@ SQLCOM_ALTER_RESOURCE_GROUP
Definition: my_sqlcommand.h:196
MYSQL_LEX_CSTRING
Definition: mysql_lex_string.h:39
resourcegroups::Sql_cmd_create_resource_group::execute
bool execute(THD *thd) override
Execute this SQL statement.
Definition: resource_group_sql_cmd.cc:188
THD
Definition: sql_class.h:764
resourcegroups::Sql_cmd_set_resource_group::execute
bool execute(THD *thd) override
Execute this SQL statement.
Definition: resource_group_sql_cmd.cc:620
SQLCOM_CREATE_RESOURCE_GROUP
@ SQLCOM_CREATE_RESOURCE_GROUP
Definition: my_sqlcommand.h:195
Mem_root_array
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:398
resourcegroups::Sql_cmd_alter_resource_group::execute
bool execute(THD *thd) override
Execute this SQL statement.
Definition: resource_group_sql_cmd.cc:310
resourcegroups::Sql_cmd_create_resource_group::m_type
const Type m_type
Definition: resource_group_sql_cmd.h:67
my_sqlcommand.h
resourcegroups::Sql_cmd_drop_resource_group::execute
bool execute(THD *thd) override
Execute this SQL statement.
Definition: resource_group_sql_cmd.cc:426
resourcegroups::Sql_cmd_alter_resource_group::m_enable
bool m_enable
Definition: resource_group_sql_cmd.h:102
resourcegroups::Sql_cmd_drop_resource_group::m_name
const LEX_CSTRING m_name
Definition: resource_group_sql_cmd.h:125
resourcegroups::Sql_cmd_create_resource_group::m_enabled
bool m_enabled
Definition: resource_group_sql_cmd.h:70
SQLCOM_SET_RESOURCE_GROUP
@ SQLCOM_SET_RESOURCE_GROUP
Definition: my_sqlcommand.h:198
PT_set_resource_group
Parse tree node for SET RESOURCE GROUP statement.
Definition: parse_tree_nodes.h:4474
sql_cmd.h
PT_create_resource_group
Parse tree node for CREATE RESOURCE GROUP statement.
Definition: parse_tree_nodes.h:4420
resourcegroups::Sql_cmd_drop_resource_group::sql_command_code
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: resource_group_sql_cmd.h:118
resource_group_basic_types.h
resourcegroups::Type
Type
Definition: resource_group_basic_types.h:32
my_inttypes.h
enum_sql_command
enum_sql_command
Definition: my_sqlcommand.h:45
lex_string.h
Sql_cmd
Representation of an SQL command.
Definition: sql_cmd.h:63
PT_drop_resource_group
Parse tree node for DROP RESOURCE GROUP statement.
Definition: parse_tree_nodes.h:4460
resourcegroups::Sql_cmd_set_resource_group::prepare
bool prepare(THD *thd) override
Prepare this SQL statement.
Definition: resource_group_sql_cmd.cc:711
resourcegroups::Sql_cmd_alter_resource_group::m_cpu_list
const Mem_root_array< Range > * m_cpu_list
Definition: resource_group_sql_cmd.h:100
resourcegroups::Sql_cmd_set_resource_group
Sql_cmd_set_resource_group represents SET RESOURCE GROUP statement.
Definition: resource_group_sql_cmd.h:133
resourcegroups::Sql_cmd_alter_resource_group::m_priority
int m_priority
Definition: resource_group_sql_cmd.h:101
resourcegroups::Sql_cmd_set_resource_group::m_name
const LEX_CSTRING m_name
Definition: resource_group_sql_cmd.h:149
resourcegroups::Sql_cmd_alter_resource_group
Sql_cmd_alter_resource_group represents ALTER RESOURCE GROUP statement.
Definition: resource_group_sql_cmd.h:77
name
const string name("\"Name\"")
resourcegroups::Sql_cmd_alter_resource_group::m_name
const LEX_CSTRING m_name
Definition: resource_group_sql_cmd.h:99
resourcegroups::Sql_cmd_alter_resource_group::m_force
bool m_force
Definition: resource_group_sql_cmd.h:103
resourcegroups::Sql_cmd_drop_resource_group::m_force
bool m_force
Definition: resource_group_sql_cmd.h:126
resourcegroups
Definition: dd_resource_group.h:28
resourcegroups::Sql_cmd_set_resource_group::Sql_cmd_set_resource_group
Sql_cmd_set_resource_group(const LEX_CSTRING &name, Mem_root_array< ulonglong > *thread_id_list)
Definition: resource_group_sql_cmd.h:137
SQLCOM_DROP_RESOURCE_GROUP
@ SQLCOM_DROP_RESOURCE_GROUP
Definition: my_sqlcommand.h:197
HttpMethod::type
int type
Definition: http_common.h:411
resourcegroups::Sql_cmd_create_resource_group::m_name
const LEX_CSTRING m_name
Definition: resource_group_sql_cmd.h:66
resourcegroups::Sql_cmd_set_resource_group::m_thread_id_list
Mem_root_array< ulonglong > * m_thread_id_list
Definition: resource_group_sql_cmd.h:150
resourcegroups::Sql_cmd_create_resource_group::sql_command_code
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: resource_group_sql_cmd.h:59
PT_alter_resource_group
Parse tree node for ALTER RESOURCE GROUP statement.
Definition: parse_tree_nodes.h:4440
parse_tree_node_base.h
resourcegroups::Sql_cmd_set_resource_group::sql_command_code
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: resource_group_sql_cmd.h:141
resourcegroups::Sql_cmd_alter_resource_group::m_use_enable
bool m_use_enable
Definition: resource_group_sql_cmd.h:104
resourcegroups::Sql_cmd_create_resource_group::Sql_cmd_create_resource_group
Sql_cmd_create_resource_group(const LEX_CSTRING &name, const Type type, const Mem_root_array< Range > *cpu_list, int priority, bool enabled)
Definition: resource_group_sql_cmd.h:50
resourcegroups::Sql_cmd_drop_resource_group::Sql_cmd_drop_resource_group
Sql_cmd_drop_resource_group(const LEX_CSTRING &name, bool force)
Definition: resource_group_sql_cmd.h:115
final
#define final(a, b, c)
Definition: hash.c:109
mem_root_array.h
resourcegroups::Sql_cmd_alter_resource_group::Sql_cmd_alter_resource_group
Sql_cmd_alter_resource_group(const LEX_CSTRING &name, const Mem_root_array< Range > *cpu_list, int priority, bool enable, bool force, bool use_enable)
Definition: resource_group_sql_cmd.h:81
resourcegroups::Sql_cmd_drop_resource_group
Sql_cmd_drop_resource_group represents DROP RESOURCE GROUP statement.
Definition: resource_group_sql_cmd.h:111
resourcegroups::Sql_cmd_alter_resource_group::sql_command_code
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: resource_group_sql_cmd.h:92
resourcegroups::Sql_cmd_create_resource_group
Sql_cmd_create_resource_group represents CREATE RESOURCE GROUP statement.
Definition: resource_group_sql_cmd.h:46
resourcegroups::Sql_cmd_create_resource_group::m_priority
int m_priority
Definition: resource_group_sql_cmd.h:69
resourcegroups::Sql_cmd_create_resource_group::m_cpu_list
const Mem_root_array< Range > * m_cpu_list
Definition: resource_group_sql_cmd.h:68