1 /* Copyright (c) 2010, 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 SQL_PARTITION_ADMIN_H 24 #define SQL_PARTITION_ADMIN_H 25 26 #include "my_global.h" 27 #include "sql_cmd.h" // Sql_cmd 28 #include "sql_alter.h" // Sql_cmd_alter_table 29 #include "sql_admin.h" // Sql_cmd_analyze_table 30 #include "sql_truncate.h" // Sql_cmd_truncate_table 31 32 /** 33 Class that represents the ALTER TABLE t1 EXCHANGE PARTITION p 34 WITH TABLE t2 statement. 35 */ 36 class Sql_cmd_alter_table_exchange_partition : public Sql_cmd_common_alter_table 37 { 38 public: 39 /** 40 Constructor, used to represent a ALTER TABLE EXCHANGE PARTITION statement. 41 */ Sql_cmd_alter_table_exchange_partition()42 Sql_cmd_alter_table_exchange_partition() 43 : Sql_cmd_common_alter_table() 44 {} 45 ~Sql_cmd_alter_table_exchange_partition()46 ~Sql_cmd_alter_table_exchange_partition() 47 {} 48 49 bool execute(THD *thd); 50 51 private: 52 bool exchange_partition(THD *thd, TABLE_LIST *, Alter_info *); 53 }; 54 55 56 /** 57 Class that represents the ALTER TABLE t1 ANALYZE PARTITION p statement. 58 */ 59 class Sql_cmd_alter_table_analyze_partition : public Sql_cmd_analyze_table 60 { 61 public: 62 /** 63 Constructor, used to represent a ALTER TABLE ANALYZE PARTITION statement. 64 */ Sql_cmd_alter_table_analyze_partition()65 Sql_cmd_alter_table_analyze_partition() 66 : Sql_cmd_analyze_table() 67 {} 68 ~Sql_cmd_alter_table_analyze_partition()69 ~Sql_cmd_alter_table_analyze_partition() 70 {} 71 72 bool execute(THD *thd); 73 74 /* Override SQLCOM_ANALYZE, since it is an ALTER command */ sql_command_code()75 virtual enum_sql_command sql_command_code() const 76 { 77 return SQLCOM_ALTER_TABLE; 78 } 79 }; 80 81 82 /** 83 Class that represents the ALTER TABLE t1 CHECK PARTITION p statement. 84 */ 85 class Sql_cmd_alter_table_check_partition : public Sql_cmd_check_table 86 { 87 public: 88 /** 89 Constructor, used to represent a ALTER TABLE CHECK PARTITION statement. 90 */ Sql_cmd_alter_table_check_partition()91 Sql_cmd_alter_table_check_partition() 92 : Sql_cmd_check_table() 93 {} 94 ~Sql_cmd_alter_table_check_partition()95 ~Sql_cmd_alter_table_check_partition() 96 {} 97 98 bool execute(THD *thd); 99 100 /* Override SQLCOM_CHECK, since it is an ALTER command */ sql_command_code()101 virtual enum_sql_command sql_command_code() const 102 { 103 return SQLCOM_ALTER_TABLE; 104 } 105 }; 106 107 108 /** 109 Class that represents the ALTER TABLE t1 OPTIMIZE PARTITION p statement. 110 */ 111 class Sql_cmd_alter_table_optimize_partition : public Sql_cmd_optimize_table 112 { 113 public: 114 /** 115 Constructor, used to represent a ALTER TABLE OPTIMIZE PARTITION statement. 116 */ Sql_cmd_alter_table_optimize_partition()117 Sql_cmd_alter_table_optimize_partition() 118 : Sql_cmd_optimize_table() 119 {} 120 ~Sql_cmd_alter_table_optimize_partition()121 ~Sql_cmd_alter_table_optimize_partition() 122 {} 123 124 bool execute(THD *thd); 125 126 /* Override SQLCOM_OPTIMIZE, since it is an ALTER command */ sql_command_code()127 virtual enum_sql_command sql_command_code() const 128 { 129 return SQLCOM_ALTER_TABLE; 130 } 131 }; 132 133 134 /** 135 Class that represents the ALTER TABLE t1 REPAIR PARTITION p statement. 136 */ 137 class Sql_cmd_alter_table_repair_partition : public Sql_cmd_repair_table 138 { 139 public: 140 /** 141 Constructor, used to represent a ALTER TABLE REPAIR PARTITION statement. 142 */ Sql_cmd_alter_table_repair_partition()143 Sql_cmd_alter_table_repair_partition() 144 : Sql_cmd_repair_table() 145 {} 146 ~Sql_cmd_alter_table_repair_partition()147 ~Sql_cmd_alter_table_repair_partition() 148 {} 149 150 bool execute(THD *thd); 151 152 /* Override SQLCOM_REPAIR, since it is an ALTER command */ sql_command_code()153 virtual enum_sql_command sql_command_code() const 154 { 155 return SQLCOM_ALTER_TABLE; 156 } 157 }; 158 159 160 /** 161 Class that represents the ALTER TABLE t1 TRUNCATE PARTITION p statement. 162 */ 163 class Sql_cmd_alter_table_truncate_partition : public Sql_cmd_truncate_table 164 { 165 public: 166 /** 167 Constructor, used to represent a ALTER TABLE TRUNCATE PARTITION statement. 168 */ Sql_cmd_alter_table_truncate_partition()169 Sql_cmd_alter_table_truncate_partition() 170 {} 171 ~Sql_cmd_alter_table_truncate_partition()172 virtual ~Sql_cmd_alter_table_truncate_partition() 173 {} 174 175 bool execute(THD *thd); 176 177 /* Override SQLCOM_TRUNCATE, since it is an ALTER command */ sql_command_code()178 virtual enum_sql_command sql_command_code() const 179 { 180 return SQLCOM_ALTER_TABLE; 181 } 182 }; 183 184 #endif /* SQL_PARTITION_ADMIN_H */ 185