summaryrefslogtreecommitdiff
path: root/sql/sql_table.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_table.h')
-rw-r--r--sql/sql_table.h59
1 files changed, 40 insertions, 19 deletions
diff --git a/sql/sql_table.h b/sql/sql_table.h
index 58280b45861..3d8ad3c8875 100644
--- a/sql/sql_table.h
+++ b/sql/sql_table.h
@@ -21,6 +21,7 @@
#include "my_sys.h" // pthread_mutex_t
class Alter_info;
+class Alter_table_ctx;
class Create_field;
struct TABLE_LIST;
class THD;
@@ -33,7 +34,6 @@ typedef struct st_key KEY;
typedef struct st_key_cache KEY_CACHE;
typedef struct st_lock_param_type ALTER_PARTITION_PARAM_TYPE;
typedef struct st_order ORDER;
-class Alter_table_change_level;
enum ddl_log_entry_code
{
@@ -65,10 +65,19 @@ enum ddl_log_action_code
DDL_LOG_REPLACE_ACTION:
Rename an entity after removing the previous entry with the
new name, that is replace this entry.
+ DDL_LOG_EXCHANGE_ACTION:
+ Exchange two entities by renaming them a -> tmp, b -> a, tmp -> b.
*/
DDL_LOG_DELETE_ACTION = 'd',
DDL_LOG_RENAME_ACTION = 'r',
- DDL_LOG_REPLACE_ACTION = 's'
+ DDL_LOG_REPLACE_ACTION = 's',
+ DDL_LOG_EXCHANGE_ACTION = 'e'
+};
+
+enum enum_ddl_log_exchange_phase {
+ EXCH_PHASE_NAME_TO_TEMP= 0,
+ EXCH_PHASE_FROM_TO_NAME= 1,
+ EXCH_PHASE_TEMP_TO_FROM= 2
};
@@ -77,6 +86,7 @@ typedef struct st_ddl_log_entry
const char *name;
const char *from_name;
const char *handler_name;
+ const char *tmp_name;
uint next_entry;
uint entry_pos;
enum ddl_log_entry_code entry_type;
@@ -115,13 +125,17 @@ enum enum_explain_filename_mode
#define WFRM_KEEP_SHARE 8
/* Flags for conversion functions. */
-#define FN_FROM_IS_TMP (1 << 0)
-#define FN_TO_IS_TMP (1 << 1)
-#define FN_IS_TMP (FN_FROM_IS_TMP | FN_TO_IS_TMP)
-#define NO_FRM_RENAME (1 << 2)
-#define FRM_ONLY (1 << 3)
+static const uint FN_FROM_IS_TMP= 1 << 0;
+static const uint FN_TO_IS_TMP= 1 << 1;
+static const uint FN_IS_TMP= FN_FROM_IS_TMP | FN_TO_IS_TMP;
+static const uint NO_FRM_RENAME= 1 << 2;
+static const uint FRM_ONLY= 1 << 3;
+/** Don't remove table in engine. Remove only .FRM and maybe .PAR files. */
+static const uint NO_HA_TABLE= 1 << 4;
+/** Don't resolve MySQL's fake "foo.sym" symbolic directory names. */
+static const uint SKIP_SYMDIR_ACCESS= 1 << 5;
/** Don't check foreign key constraints while renaming table */
-#define NO_FK_CHECKS (1 << 4)
+static const uint NO_FK_CHECKS= 1 << 6;
uint filename_to_tablename(const char *from, char *to, uint to_length
#ifndef DBUG_OFF
@@ -135,6 +149,7 @@ uint build_table_filename(char *buff, size_t bufflen, const char *db,
const char *table, const char *ext, uint flags);
uint build_table_shadow_filename(char *buff, size_t bufflen,
ALTER_PARTITION_PARAM_TYPE *lpt);
+uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen);
bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
HA_CREATE_INFO *create_info,
Alter_info *alter_info);
@@ -185,27 +200,30 @@ handler *mysql_create_frm_image(THD *thd,
const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
Alter_info *alter_info,
- int create_table_mode, LEX_CUSTRING *frm);
+ int create_table_mode,
+ KEY **key_info,
+ uint *key_count,
+ LEX_CUSTRING *frm);
+
+int mysql_discard_or_import_tablespace(THD *thd,
+ TABLE_LIST *table_list,
+ bool discard);
+
bool mysql_prepare_alter_table(THD *thd, TABLE *table,
HA_CREATE_INFO *create_info,
- Alter_info *alter_info);
+ Alter_info *alter_info,
+ Alter_table_ctx *alter_ctx);
bool mysql_trans_prepare_alter_copy_data(THD *thd);
bool mysql_trans_commit_alter_copy_data(THD *thd);
bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
HA_CREATE_INFO *create_info,
TABLE_LIST *table_list,
Alter_info *alter_info,
- uint order_num, ORDER *order, bool ignore,
- bool require_online);
+ uint order_num, ORDER *order, bool ignore);
bool mysql_compare_tables(TABLE *table,
Alter_info *alter_info,
HA_CREATE_INFO *create_info,
- uint order_num,
- Alter_table_change_level *need_copy_table,
- KEY **key_info_buffer,
- uint **index_drop_buffer, uint *index_drop_count,
- uint **index_add_buffer, uint *index_add_count,
- uint *candidate_key_count);
+ bool *metadata_equal);
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list);
bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
TABLE_LIST *src_table,
@@ -224,7 +242,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
bool drop_temporary, bool drop_view,
bool log_query);
-bool quick_rm_table(handlerton *base,const char *db,
+bool quick_rm_table(THD *thd, handlerton *base, const char *db,
const char *table_name, uint flags);
void close_cached_table(THD *thd, TABLE *table);
void sp_prepare_create_field(THD *thd, Create_field *sql_field);
@@ -248,6 +266,9 @@ bool sync_ddl_log();
void release_ddl_log();
void execute_ddl_log_recovery();
bool execute_ddl_log_entry(THD *thd, uint first_entry);
+bool validate_comment_length(THD *thd, const char *comment_str,
+ size_t *comment_len, uint max_len,
+ uint err_code, const char *comment_name);
bool check_duplicate_warning(THD *thd, char *msg, ulong length);
template<typename T> class List;