MySQL 8.3.0
Source Code Documentation
sql_partition_admin.h
Go to the documentation of this file.
1/* Copyright (c) 2010, 2023, 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;
31class Table_ref;
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 {nullptr, 0}) {}
60
62
63 bool execute(THD *thd) override;
64
65 /* Override SQLCOM_ANALYZE, since it is an ALTER command */
67 return SQLCOM_ALTER_TABLE;
68 }
69};
70
71/**
72 Class that represents the ALTER TABLE t1 CHECK PARTITION p statement.
73*/
75 public:
76 using Sql_cmd_check_table::Sql_cmd_check_table;
77
78 bool execute(THD *thd) override;
79
80 /* Override SQLCOM_CHECK, since it is an ALTER command */
82 return SQLCOM_ALTER_TABLE;
83 }
84};
85
86/**
87 Class that represents the ALTER TABLE t1 OPTIMIZE PARTITION p statement.
88*/
90 : public Sql_cmd_optimize_table {
91 public:
92 using Sql_cmd_optimize_table::Sql_cmd_optimize_table;
93
94 bool execute(THD *thd) override;
95
96 /* Override SQLCOM_OPTIMIZE, since it is an ALTER command */
98 return SQLCOM_ALTER_TABLE;
99 }
100};
101
102/**
103 Class that represents the ALTER TABLE t1 REPAIR PARTITION p statement.
104*/
106 public:
107 using Sql_cmd_repair_table::Sql_cmd_repair_table;
108
109 bool execute(THD *thd) override;
110
111 /* Override SQLCOM_REPAIR, since it is an ALTER command */
113 return SQLCOM_ALTER_TABLE;
114 }
115};
116
117/**
118 Class that represents the ALTER TABLE t1 TRUNCATE PARTITION p statement.
119*/
121 public:
123
124 bool execute(THD *thd) override;
125
126 /* Override SQLCOM_TRUNCATE, since it is an ALTER command */
128 return SQLCOM_ALTER_TABLE;
129 }
130};
131
132#endif /* SQL_PARTITION_ADMIN_H */
Data describing the table being created by CREATE TABLE or altered by ALTER TABLE.
Definition: sql_alter.h:204
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:66
Class that represents the ALTER TABLE t1 CHECK PARTITION p statement.
Definition: sql_partition_admin.h:74
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_partition_admin.h:81
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_ref *, 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:90
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_partition_admin.h:97
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:105
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_partition_admin.h:112
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:120
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:127
Sql_cmd_analyze_table represents the ANALYZE TABLE statement.
Definition: sql_admin.h:64
Histogram_command
Specifies which (if any) of the commands UPDATE HISTOGRAM or DROP HISTOGRAM that is specified after A...
Definition: sql_admin.h:70
Sql_cmd_check_table represents the CHECK TABLE statement.
Definition: sql_admin.h:192
Represents the common properties of the ALTER TABLE statements.
Definition: sql_alter.h:601
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:207
Sql_cmd_repair_table represents the REPAIR TABLE statement.
Definition: sql_admin.h:222
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
Definition: table.h:2853
enum_sql_command
Definition: my_sqlcommand.h:45
@ SQLCOM_ALTER_TABLE
Definition: my_sqlcommand.h:49