MySQL 9.1.0
Source Code Documentation
sql_partition_admin.h
Go to the documentation of this file.
1/* Copyright (c) 2010, 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_PARTITION_ADMIN_H
25#define SQL_PARTITION_ADMIN_H
26
27#include "my_sqlcommand.h"
28#include "sql/sql_admin.h" // Sql_cmd_analyze_table
29#include "sql/sql_alter.h" // Sql_cmd_common_alter_table
30
31class THD;
32class Table_ref;
33
34/**
35 Class that represents the ALTER TABLE t1 EXCHANGE PARTITION p
36 WITH TABLE t2 statement.
37*/
40 public:
41 using Sql_cmd_common_alter_table::Sql_cmd_common_alter_table;
42
43 bool execute(THD *thd) override;
44
45 private:
47};
48
49/**
50 Class that represents the ALTER TABLE t1 ANALYZE PARTITION p statement.
51*/
53 : public Sql_cmd_analyze_table {
54 public:
55 /**
56 Constructor, used to represent a ALTER TABLE ANALYZE PARTITION statement.
57 */
59 : Sql_cmd_analyze_table(thd, alter_info, Histogram_command::NONE, 0,
60 {nullptr, 0}, false) {}
61
63
64 bool execute(THD *thd) override;
65
66 /* Override SQLCOM_ANALYZE, since it is an ALTER command */
68 return SQLCOM_ALTER_TABLE;
69 }
70};
71
72/**
73 Class that represents the ALTER TABLE t1 CHECK PARTITION p statement.
74*/
76 public:
77 using Sql_cmd_check_table::Sql_cmd_check_table;
78
79 bool execute(THD *thd) override;
80
81 /* Override SQLCOM_CHECK, since it is an ALTER command */
83 return SQLCOM_ALTER_TABLE;
84 }
85};
86
87/**
88 Class that represents the ALTER TABLE t1 OPTIMIZE PARTITION p statement.
89*/
91 : public Sql_cmd_optimize_table {
92 public:
93 using Sql_cmd_optimize_table::Sql_cmd_optimize_table;
94
95 bool execute(THD *thd) override;
96
97 /* Override SQLCOM_OPTIMIZE, since it is an ALTER command */
99 return SQLCOM_ALTER_TABLE;
100 }
101};
102
103/**
104 Class that represents the ALTER TABLE t1 REPAIR PARTITION p statement.
105*/
107 public:
108 using Sql_cmd_repair_table::Sql_cmd_repair_table;
109
110 bool execute(THD *thd) override;
111
112 /* Override SQLCOM_REPAIR, since it is an ALTER command */
114 return SQLCOM_ALTER_TABLE;
115 }
116};
117
118/**
119 Class that represents the ALTER TABLE t1 TRUNCATE PARTITION p statement.
120*/
122 public:
124
125 bool execute(THD *thd) override;
126
127 /* Override SQLCOM_TRUNCATE, since it is an ALTER command */
129 return SQLCOM_ALTER_TABLE;
130 }
131};
132
133#endif /* SQL_PARTITION_ADMIN_H */
Data describing the table being created by CREATE TABLE or altered by ALTER TABLE.
Definition: sql_alter.h:205
Class that represents the ALTER TABLE t1 ANALYZE PARTITION p statement.
Definition: sql_partition_admin.h:53
~Sql_cmd_alter_table_analyze_partition() override=default
Sql_cmd_alter_table_analyze_partition(THD *thd, Alter_info *alter_info)
Constructor, used to represent a ALTER TABLE ANALYZE PARTITION statement.
Definition: sql_partition_admin.h:58
bool execute(THD *thd) override
Execute this SQL statement.
Definition: sql_partition_admin.cc:545
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_partition_admin.h:67
Class that represents the ALTER TABLE t1 CHECK PARTITION p statement.
Definition: sql_partition_admin.h:75
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_partition_admin.h:82
bool execute(THD *thd) override
Execute this SQL statement.
Definition: sql_partition_admin.cc:555
Class that represents the ALTER TABLE t1 EXCHANGE PARTITION p WITH TABLE t2 statement.
Definition: sql_partition_admin.h:39
bool exchange_partition(THD *thd, Table_ref *, Alter_info *)
Swap places between a partition and a table.
Definition: sql_partition_admin.cc:310
bool execute(THD *thd) override
Execute this SQL statement.
Definition: sql_partition_admin.cc:75
Class that represents the ALTER TABLE t1 OPTIMIZE PARTITION p statement.
Definition: sql_partition_admin.h:91
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_partition_admin.h:98
bool execute(THD *thd) override
Execute this SQL statement.
Definition: sql_partition_admin.cc:565
Class that represents the ALTER TABLE t1 REPAIR PARTITION p statement.
Definition: sql_partition_admin.h:106
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_partition_admin.h:113
bool execute(THD *thd) override
Execute this SQL statement.
Definition: sql_partition_admin.cc:575
Class that represents the ALTER TABLE t1 TRUNCATE PARTITION p statement.
Definition: sql_partition_admin.h:121
bool execute(THD *thd) override
Execute this SQL statement.
Definition: sql_partition_admin.cc:585
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_partition_admin.h:128
Sql_cmd_analyze_table represents the ANALYZE TABLE statement.
Definition: sql_admin.h:65
Histogram_command
Specifies which (if any) of the commands UPDATE HISTOGRAM or DROP HISTOGRAM that is specified after A...
Definition: sql_admin.h:71
Sql_cmd_check_table represents the CHECK TABLE statement.
Definition: sql_admin.h:207
Represents the common properties of the ALTER TABLE statements.
Definition: sql_alter.h:602
A base class for CREATE/ALTER TABLE commands and friends.
Definition: sql_cmd_ddl_table.h:50
Sql_cmd_ddl_table(Alter_info *alter_info)
Definition: sql_cmd_ddl_table.cc:68
Sql_cmd_optimize_table represents the OPTIMIZE TABLE statement.
Definition: sql_admin.h:222
Sql_cmd_repair_table represents the REPAIR TABLE statement.
Definition: sql_admin.h:237
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Definition: table.h:2900
enum_sql_command
Definition: my_sqlcommand.h:46
@ SQLCOM_ALTER_TABLE
Definition: my_sqlcommand.h:50