MySQL  8.0.19
Source Code Documentation
sql_partition_admin.h
Go to the documentation of this file.
1 /* Copyright (c) 2010, 2017, 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 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 
30 class THD;
31 struct 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);
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);
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);
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);
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);
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);
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 */
Sql_cmd_alter_table_analyze_partition::sql_command_code
virtual enum_sql_command sql_command_code() const
Return the command code for this statement.
Definition: sql_partition_admin.h:65
THD
Definition: sql_class.h:764
Sql_cmd_ddl_table
A base class for CREATE/ALTER TABLE commands and friends.
Definition: sql_cmd_ddl_table.h:49
Alter_info
Data describing the table being created by CREATE TABLE or altered by ALTER TABLE.
Definition: sql_alter.h:189
sql_alter.h
Sql_cmd_repair_table
Sql_cmd_repair_table represents the REPAIR TABLE statement.
Definition: sql_admin.h:199
Sql_cmd_alter_table_repair_partition
Class that represents the ALTER TABLE t1 REPAIR PARTITION p statement.
Definition: sql_partition_admin.h:104
my_sqlcommand.h
Sql_cmd_alter_table_truncate_partition::execute
bool execute(THD *thd)
Execute this SQL statement.
Definition: sql_partition_admin.cc:568
sql_admin.h
Sql_cmd_alter_table_truncate_partition::sql_command_code
virtual enum_sql_command sql_command_code() const
Return the command code for this statement.
Definition: sql_partition_admin.h:126
SQLCOM_ALTER_TABLE
@ SQLCOM_ALTER_TABLE
Definition: my_sqlcommand.h:49
Sql_cmd_optimize_table
Sql_cmd_optimize_table represents the OPTIMIZE TABLE statement.
Definition: sql_admin.h:184
Sql_cmd_alter_table_analyze_partition
Class that represents the ALTER TABLE t1 ANALYZE PARTITION p statement.
Definition: sql_partition_admin.h:51
Sql_cmd_alter_table_exchange_partition
Class that represents the ALTER TABLE t1 EXCHANGE PARTITION p WITH TABLE t2 statement.
Definition: sql_partition_admin.h:37
Sql_cmd_ddl_table::Sql_cmd_ddl_table
Sql_cmd_ddl_table(Alter_info *alter_info)
Definition: sql_cmd_ddl_table.cc:65
enum_sql_command
enum_sql_command
Definition: my_sqlcommand.h:45
Sql_cmd_alter_table_optimize_partition::execute
bool execute(THD *thd)
Execute this SQL statement.
Definition: sql_partition_admin.cc:548
Sql_cmd_analyze_table
Sql_cmd_analyze_table represents the ANALYZE TABLE statement.
Definition: sql_admin.h:62
Sql_cmd_alter_table_check_partition
Class that represents the ALTER TABLE t1 CHECK PARTITION p statement.
Definition: sql_partition_admin.h:73
Sql_cmd_alter_table_optimize_partition::sql_command_code
virtual enum_sql_command sql_command_code() const
Return the command code for this statement.
Definition: sql_partition_admin.h:96
Sql_cmd_alter_table_repair_partition::execute
bool execute(THD *thd)
Execute this SQL statement.
Definition: sql_partition_admin.cc:558
Sql_cmd_check_table
Sql_cmd_check_table represents the CHECK TABLE statement.
Definition: sql_admin.h:169
Sql_cmd_alter_table_repair_partition::sql_command_code
virtual enum_sql_command sql_command_code() const
Return the command code for this statement.
Definition: sql_partition_admin.h:111
Sql_cmd_alter_table_analyze_partition::execute
bool execute(THD *thd)
Execute this SQL statement.
Definition: sql_partition_admin.cc:528
TABLE_LIST
Definition: table.h:2467
Sql_cmd_common_alter_table
Represents the common properties of the ALTER TABLE statements.
Definition: sql_alter.h:571
Sql_cmd_alter_table_analyze_partition::Sql_cmd_alter_table_analyze_partition
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
Sql_cmd_analyze_table::Histogram_command
Histogram_command
Specifies which (if any) of the commands UPDATE HISTOGRAM or DROP HISTOGRAM that is specified after A...
Definition: sql_admin.h:68
Sql_cmd_alter_table_exchange_partition::execute
bool execute(THD *thd)
Execute this SQL statement.
Definition: sql_partition_admin.cc:71
Sql_cmd_alter_table_analyze_partition::~Sql_cmd_alter_table_analyze_partition
~Sql_cmd_alter_table_analyze_partition()
Definition: sql_partition_admin.h:60
Sql_cmd_alter_table_optimize_partition
Class that represents the ALTER TABLE t1 OPTIMIZE PARTITION p statement.
Definition: sql_partition_admin.h:88
NONE
@ NONE
Definition: gcs_interface.h:202
Sql_cmd_alter_table_exchange_partition::exchange_partition
bool exchange_partition(THD *thd, TABLE_LIST *, Alter_info *)
Swap places between a partition and a table.
Definition: sql_partition_admin.cc:306
Sql_cmd_alter_table_check_partition::execute
bool execute(THD *thd)
Execute this SQL statement.
Definition: sql_partition_admin.cc:538
Sql_cmd_alter_table_truncate_partition
Class that represents the ALTER TABLE t1 TRUNCATE PARTITION p statement.
Definition: sql_partition_admin.h:119
Sql_cmd_alter_table_check_partition::sql_command_code
virtual enum_sql_command sql_command_code() const
Return the command code for this statement.
Definition: sql_partition_admin.h:80
final
#define final(a, b, c)
Definition: hash.c:109