MySQL 8.0.29
Source Code Documentation
resource_group_sql_cmd.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 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 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"
31#include "sql/sql_cmd.h"
32
37class THD;
38
39namespace resourcegroups {
40
41/**
42 Sql_cmd_create_resource_group represents CREATE RESOURCE GROUP statement.
43*/
44
46 friend class ::PT_create_resource_group;
47
48 public:
50 const Mem_root_array<Range> *cpu_list,
51 int priority, bool enabled)
52 : m_name(name),
53 m_type(type),
54 m_cpu_list(cpu_list),
57
60 }
61
62 bool execute(THD *thd) override;
63
64 private:
66 const Type m_type;
70};
71
72/**
73 Sql_cmd_alter_resource_group represents ALTER RESOURCE GROUP statement.
74*/
75
77 friend class ::PT_alter_resource_group;
78
79 public:
81 const Mem_root_array<Range> *cpu_list,
82 int priority, bool enable, bool force,
83 bool use_enable)
84 : m_name(name),
85 m_cpu_list(cpu_list),
87 m_enable(enable),
88 m_force(force),
89 m_use_enable(use_enable) {}
90
93 }
94
95 bool execute(THD *thd) override;
96
97 private:
104};
105
106/**
107 Sql_cmd_drop_resource_group represents DROP RESOURCE GROUP statement.
108*/
109
111 friend class ::PT_drop_resource_group;
112
113 public:
115 : m_name(name), m_force(force) {}
116
119 }
120
121 bool execute(THD *thd) override;
122
123 private:
126};
127
128/**
129 Sql_cmd_set_resource_group represents SET RESOURCE GROUP statement.
130*/
131
133 friend class ::PT_set_resource_group;
134
135 public:
137 Mem_root_array<ulonglong> *thread_id_list)
138 : m_name(name), m_thread_id_list(thread_id_list) {}
139
142 }
143
144 bool execute(THD *thd) override;
145 bool prepare(THD *thd) override;
146
147 private:
150};
151} // namespace resourcegroups
152#endif // RESOURCEGROUPS_RESOURCE_GROUP_SQL_CMD_H_
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:421
Parse tree node for ALTER RESOURCE GROUP statement.
Definition: parse_tree_nodes.h:5060
Parse tree node for CREATE RESOURCE GROUP statement.
Definition: parse_tree_nodes.h:5040
Parse tree node for DROP RESOURCE GROUP statement.
Definition: parse_tree_nodes.h:5080
Parse tree node for SET RESOURCE GROUP statement.
Definition: parse_tree_nodes.h:5094
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:945
Sql_cmd_alter_resource_group represents ALTER RESOURCE GROUP statement.
Definition: resource_group_sql_cmd.h:76
bool execute(THD *thd) override
Execute this SQL statement.
Definition: resource_group_sql_cmd.cc:311
bool m_enable
Definition: resource_group_sql_cmd.h:101
const LEX_CSTRING m_name
Definition: resource_group_sql_cmd.h:98
int m_priority
Definition: resource_group_sql_cmd.h:100
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:80
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: resource_group_sql_cmd.h:91
bool m_use_enable
Definition: resource_group_sql_cmd.h:103
bool m_force
Definition: resource_group_sql_cmd.h:102
const Mem_root_array< Range > * m_cpu_list
Definition: resource_group_sql_cmd.h:99
Sql_cmd_create_resource_group represents CREATE RESOURCE GROUP statement.
Definition: resource_group_sql_cmd.h:45
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:49
const Type m_type
Definition: resource_group_sql_cmd.h:66
bool m_enabled
Definition: resource_group_sql_cmd.h:69
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: resource_group_sql_cmd.h:58
int m_priority
Definition: resource_group_sql_cmd.h:68
const Mem_root_array< Range > * m_cpu_list
Definition: resource_group_sql_cmd.h:67
const LEX_CSTRING m_name
Definition: resource_group_sql_cmd.h:65
bool execute(THD *thd) override
Execute this SQL statement.
Definition: resource_group_sql_cmd.cc:189
Sql_cmd_drop_resource_group represents DROP RESOURCE GROUP statement.
Definition: resource_group_sql_cmd.h:110
bool execute(THD *thd) override
Execute this SQL statement.
Definition: resource_group_sql_cmd.cc:427
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: resource_group_sql_cmd.h:117
const LEX_CSTRING m_name
Definition: resource_group_sql_cmd.h:124
Sql_cmd_drop_resource_group(const LEX_CSTRING &name, bool force)
Definition: resource_group_sql_cmd.h:114
bool m_force
Definition: resource_group_sql_cmd.h:125
Sql_cmd_set_resource_group represents SET RESOURCE GROUP statement.
Definition: resource_group_sql_cmd.h:132
Mem_root_array< ulonglong > * m_thread_id_list
Definition: resource_group_sql_cmd.h:149
Sql_cmd_set_resource_group(const LEX_CSTRING &name, Mem_root_array< ulonglong > *thread_id_list)
Definition: resource_group_sql_cmd.h:136
bool prepare(THD *thd) override
Prepare this SQL statement.
Definition: resource_group_sql_cmd.cc:710
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: resource_group_sql_cmd.h:140
bool execute(THD *thd) override
Execute this SQL statement.
Definition: resource_group_sql_cmd.cc:619
const LEX_CSTRING m_name
Definition: resource_group_sql_cmd.h:148
Some integer typedefs for easier portability.
enum_sql_command
Definition: my_sqlcommand.h:45
@ SQLCOM_ALTER_RESOURCE_GROUP
Definition: my_sqlcommand.h:196
@ SQLCOM_DROP_RESOURCE_GROUP
Definition: my_sqlcommand.h:197
@ SQLCOM_SET_RESOURCE_GROUP
Definition: my_sqlcommand.h:198
@ SQLCOM_CREATE_RESOURCE_GROUP
Definition: my_sqlcommand.h:195
Definition: dd_resource_group.h:28
Type
Definition: resource_group_basic_types.h:32
required uint32 priority
Definition: replication_group_member_actions.proto:34
required string type
Definition: replication_group_member_actions.proto:33
required bool enabled
Definition: replication_group_member_actions.proto:32
Representation of an SQL command.
case opt name
Definition: sslopt-case.h:32
Definition: mysql_lex_string.h:39