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