1 | /* Copyright (c) 2010, 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 as published by |
5 | the Free Software Foundation; version 2 of the License. |
6 | |
7 | This program is distributed in the hope that it will be useful, |
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 | GNU General Public License for more details. |
11 | |
12 | You should have received a copy of the GNU General Public License |
13 | along with this program; if not, write to the Free Software |
14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
15 | |
16 | #ifndef SQL_PARTITION_ADMIN_H |
17 | #define SQL_PARTITION_ADMIN_H |
18 | |
19 | #ifndef WITH_PARTITION_STORAGE_ENGINE |
20 | |
21 | /** |
22 | Stub class that returns a error if the partition storage engine is |
23 | not supported. |
24 | */ |
25 | class Sql_cmd_partition_unsupported : public Sql_cmd |
26 | { |
27 | public: |
28 | Sql_cmd_partition_unsupported() |
29 | {} |
30 | |
31 | ~Sql_cmd_partition_unsupported() |
32 | {} |
33 | |
34 | /* Override SQLCOM_*, since it is an ALTER command */ |
35 | virtual enum_sql_command sql_command_code() const |
36 | { |
37 | return SQLCOM_ALTER_TABLE; |
38 | } |
39 | |
40 | bool execute(THD *thd); |
41 | }; |
42 | |
43 | |
44 | class Sql_cmd_alter_table_exchange_partition : |
45 | public Sql_cmd_partition_unsupported |
46 | { |
47 | public: |
48 | Sql_cmd_alter_table_exchange_partition() |
49 | {} |
50 | |
51 | ~Sql_cmd_alter_table_exchange_partition() |
52 | {} |
53 | }; |
54 | |
55 | |
56 | class Sql_cmd_alter_table_analyze_partition : |
57 | public Sql_cmd_partition_unsupported |
58 | { |
59 | public: |
60 | Sql_cmd_alter_table_analyze_partition() |
61 | {} |
62 | |
63 | ~Sql_cmd_alter_table_analyze_partition() |
64 | {} |
65 | }; |
66 | |
67 | |
68 | class Sql_cmd_alter_table_check_partition : |
69 | public Sql_cmd_partition_unsupported |
70 | { |
71 | public: |
72 | Sql_cmd_alter_table_check_partition() |
73 | {} |
74 | |
75 | ~Sql_cmd_alter_table_check_partition() |
76 | {} |
77 | }; |
78 | |
79 | |
80 | class Sql_cmd_alter_table_optimize_partition : |
81 | public Sql_cmd_partition_unsupported |
82 | { |
83 | public: |
84 | Sql_cmd_alter_table_optimize_partition() |
85 | {} |
86 | |
87 | ~Sql_cmd_alter_table_optimize_partition() |
88 | {} |
89 | }; |
90 | |
91 | |
92 | class Sql_cmd_alter_table_repair_partition : |
93 | public Sql_cmd_partition_unsupported |
94 | { |
95 | public: |
96 | Sql_cmd_alter_table_repair_partition() |
97 | {} |
98 | |
99 | ~Sql_cmd_alter_table_repair_partition() |
100 | {} |
101 | }; |
102 | |
103 | |
104 | class Sql_cmd_alter_table_truncate_partition : |
105 | public Sql_cmd_partition_unsupported |
106 | { |
107 | public: |
108 | Sql_cmd_alter_table_truncate_partition() |
109 | {} |
110 | |
111 | ~Sql_cmd_alter_table_truncate_partition() |
112 | {} |
113 | }; |
114 | |
115 | #else |
116 | |
117 | /** |
118 | Class that represents the ALTER TABLE t1 ANALYZE PARTITION p statement. |
119 | */ |
120 | class Sql_cmd_alter_table_exchange_partition : public Sql_cmd_common_alter_table |
121 | { |
122 | public: |
123 | /** |
124 | Constructor, used to represent a ALTER TABLE EXCHANGE PARTITION statement. |
125 | */ |
126 | Sql_cmd_alter_table_exchange_partition() |
127 | : Sql_cmd_common_alter_table() |
128 | {} |
129 | |
130 | ~Sql_cmd_alter_table_exchange_partition() |
131 | {} |
132 | |
133 | bool execute(THD *thd); |
134 | |
135 | private: |
136 | bool exchange_partition(THD *thd, TABLE_LIST *, Alter_info *); |
137 | }; |
138 | |
139 | |
140 | /** |
141 | Class that represents the ALTER TABLE t1 ANALYZE PARTITION p statement. |
142 | */ |
143 | class Sql_cmd_alter_table_analyze_partition : public Sql_cmd_analyze_table |
144 | { |
145 | public: |
146 | /** |
147 | Constructor, used to represent a ALTER TABLE ANALYZE PARTITION statement. |
148 | */ |
149 | Sql_cmd_alter_table_analyze_partition() |
150 | : Sql_cmd_analyze_table() |
151 | {} |
152 | |
153 | ~Sql_cmd_alter_table_analyze_partition() |
154 | {} |
155 | |
156 | bool execute(THD *thd); |
157 | |
158 | /* Override SQLCOM_ANALYZE, since it is an ALTER command */ |
159 | virtual enum_sql_command sql_command_code() const |
160 | { |
161 | return SQLCOM_ALTER_TABLE; |
162 | } |
163 | }; |
164 | |
165 | |
166 | /** |
167 | Class that represents the ALTER TABLE t1 CHECK PARTITION p statement. |
168 | */ |
169 | class Sql_cmd_alter_table_check_partition : public Sql_cmd_check_table |
170 | { |
171 | public: |
172 | /** |
173 | Constructor, used to represent a ALTER TABLE CHECK PARTITION statement. |
174 | */ |
175 | Sql_cmd_alter_table_check_partition() |
176 | : Sql_cmd_check_table() |
177 | {} |
178 | |
179 | ~Sql_cmd_alter_table_check_partition() |
180 | {} |
181 | |
182 | bool execute(THD *thd); |
183 | |
184 | /* Override SQLCOM_CHECK, since it is an ALTER command */ |
185 | virtual enum_sql_command sql_command_code() const |
186 | { |
187 | return SQLCOM_ALTER_TABLE; |
188 | } |
189 | }; |
190 | |
191 | |
192 | /** |
193 | Class that represents the ALTER TABLE t1 OPTIMIZE PARTITION p statement. |
194 | */ |
195 | class Sql_cmd_alter_table_optimize_partition : public Sql_cmd_optimize_table |
196 | { |
197 | public: |
198 | /** |
199 | Constructor, used to represent a ALTER TABLE OPTIMIZE PARTITION statement. |
200 | */ |
201 | Sql_cmd_alter_table_optimize_partition() |
202 | : Sql_cmd_optimize_table() |
203 | {} |
204 | |
205 | ~Sql_cmd_alter_table_optimize_partition() |
206 | {} |
207 | |
208 | bool execute(THD *thd); |
209 | |
210 | /* Override SQLCOM_OPTIMIZE, since it is an ALTER command */ |
211 | virtual enum_sql_command sql_command_code() const |
212 | { |
213 | return SQLCOM_ALTER_TABLE; |
214 | } |
215 | }; |
216 | |
217 | |
218 | /** |
219 | Class that represents the ALTER TABLE t1 REPAIR PARTITION p statement. |
220 | */ |
221 | class Sql_cmd_alter_table_repair_partition : public Sql_cmd_repair_table |
222 | { |
223 | public: |
224 | /** |
225 | Constructor, used to represent a ALTER TABLE REPAIR PARTITION statement. |
226 | */ |
227 | Sql_cmd_alter_table_repair_partition() |
228 | : Sql_cmd_repair_table() |
229 | {} |
230 | |
231 | ~Sql_cmd_alter_table_repair_partition() |
232 | {} |
233 | |
234 | bool execute(THD *thd); |
235 | |
236 | /* Override SQLCOM_REPAIR, since it is an ALTER command */ |
237 | virtual enum_sql_command sql_command_code() const |
238 | { |
239 | return SQLCOM_ALTER_TABLE; |
240 | } |
241 | }; |
242 | |
243 | |
244 | /** |
245 | Class that represents the ALTER TABLE t1 TRUNCATE PARTITION p statement. |
246 | */ |
247 | class Sql_cmd_alter_table_truncate_partition : public Sql_cmd_truncate_table |
248 | { |
249 | public: |
250 | /** |
251 | Constructor, used to represent a ALTER TABLE TRUNCATE PARTITION statement. |
252 | */ |
253 | Sql_cmd_alter_table_truncate_partition() |
254 | {} |
255 | |
256 | virtual ~Sql_cmd_alter_table_truncate_partition() |
257 | {} |
258 | |
259 | bool execute(THD *thd); |
260 | |
261 | /* Override SQLCOM_TRUNCATE, since it is an ALTER command */ |
262 | virtual enum_sql_command sql_command_code() const |
263 | { |
264 | return SQLCOM_ALTER_TABLE; |
265 | } |
266 | }; |
267 | |
268 | #endif /* WITH_PARTITION_STORAGE_ENGINE */ |
269 | #endif /* SQL_PARTITION_ADMIN_H */ |
270 | |