| 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_TABLE_MAINTENANCE_H |
| 17 | #define SQL_TABLE_MAINTENANCE_H |
| 18 | |
| 19 | /* Must be able to hold ALTER TABLE t PARTITION BY ... KEY ALGORITHM = 1 ... */ |
| 20 | #define SQL_ADMIN_MSG_TEXT_SIZE (128 * 1024) |
| 21 | |
| 22 | bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list, |
| 23 | const LEX_CSTRING *key_cache_name); |
| 24 | bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list); |
| 25 | int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache, |
| 26 | KEY_CACHE *dst_cache); |
| 27 | |
| 28 | /** |
| 29 | Sql_cmd_analyze_table represents the ANALYZE TABLE statement. |
| 30 | */ |
| 31 | class Sql_cmd_analyze_table : public Sql_cmd |
| 32 | { |
| 33 | public: |
| 34 | /** |
| 35 | Constructor, used to represent a ANALYZE TABLE statement. |
| 36 | */ |
| 37 | Sql_cmd_analyze_table() |
| 38 | {} |
| 39 | |
| 40 | ~Sql_cmd_analyze_table() |
| 41 | {} |
| 42 | |
| 43 | bool execute(THD *thd); |
| 44 | |
| 45 | virtual enum_sql_command sql_command_code() const |
| 46 | { |
| 47 | return SQLCOM_ANALYZE; |
| 48 | } |
| 49 | }; |
| 50 | |
| 51 | |
| 52 | |
| 53 | /** |
| 54 | Sql_cmd_check_table represents the CHECK TABLE statement. |
| 55 | */ |
| 56 | class Sql_cmd_check_table : public Sql_cmd |
| 57 | { |
| 58 | public: |
| 59 | /** |
| 60 | Constructor, used to represent a CHECK TABLE statement. |
| 61 | */ |
| 62 | Sql_cmd_check_table() |
| 63 | {} |
| 64 | |
| 65 | ~Sql_cmd_check_table() |
| 66 | {} |
| 67 | |
| 68 | bool execute(THD *thd); |
| 69 | |
| 70 | virtual enum_sql_command sql_command_code() const |
| 71 | { |
| 72 | return SQLCOM_CHECK; |
| 73 | } |
| 74 | }; |
| 75 | |
| 76 | |
| 77 | /** |
| 78 | Sql_cmd_optimize_table represents the OPTIMIZE TABLE statement. |
| 79 | */ |
| 80 | class Sql_cmd_optimize_table : public Sql_cmd |
| 81 | { |
| 82 | public: |
| 83 | /** |
| 84 | Constructor, used to represent a OPTIMIZE TABLE statement. |
| 85 | */ |
| 86 | Sql_cmd_optimize_table() |
| 87 | {} |
| 88 | |
| 89 | ~Sql_cmd_optimize_table() |
| 90 | {} |
| 91 | |
| 92 | bool execute(THD *thd); |
| 93 | |
| 94 | virtual enum_sql_command sql_command_code() const |
| 95 | { |
| 96 | return SQLCOM_OPTIMIZE; |
| 97 | } |
| 98 | }; |
| 99 | |
| 100 | |
| 101 | |
| 102 | /** |
| 103 | Sql_cmd_repair_table represents the REPAIR TABLE statement. |
| 104 | */ |
| 105 | class Sql_cmd_repair_table : public Sql_cmd |
| 106 | { |
| 107 | public: |
| 108 | /** |
| 109 | Constructor, used to represent a REPAIR TABLE statement. |
| 110 | */ |
| 111 | Sql_cmd_repair_table() |
| 112 | {} |
| 113 | |
| 114 | ~Sql_cmd_repair_table() |
| 115 | {} |
| 116 | |
| 117 | bool execute(THD *thd); |
| 118 | |
| 119 | virtual enum_sql_command sql_command_code() const |
| 120 | { |
| 121 | return SQLCOM_REPAIR; |
| 122 | } |
| 123 | }; |
| 124 | |
| 125 | #endif |
| 126 | |