diff options
author | Sergei Golubchik <serg@mariadb.org> | 2019-02-15 21:15:39 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-02-21 14:57:10 +0100 |
commit | 81e4b9b3bb394870d942108405054a782133b41a (patch) | |
tree | 00be45d6e2eeaa7d87680d0a689ac14f8c5f31eb | |
parent | 7ec3a4d76bbbb8618e44326e98590a98b0db6254 (diff) | |
download | mariadb-git-81e4b9b3bb394870d942108405054a782133b41a.tar.gz |
misc cleanups
-rw-r--r-- | sql/sql_lex.h | 6 | ||||
-rw-r--r-- | sql/sql_table.cc | 90 | ||||
-rw-r--r-- | sql/sql_table.h | 4 | ||||
-rw-r--r-- | sql/sql_update.cc | 3 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 4 | ||||
-rw-r--r-- | sql/sql_yacc_ora.yy | 4 | ||||
-rw-r--r-- | sql/table.cc | 12 | ||||
-rw-r--r-- | sql/table.h | 5 | ||||
-rw-r--r-- | sql/unireg.cc | 63 | ||||
-rw-r--r-- | sql/unireg.h | 4 |
10 files changed, 95 insertions, 100 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 93a6ee0ef6a..1a0e7f56b5a 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -4191,10 +4191,10 @@ public: void add_key_to_list(LEX_CSTRING *field_name, enum Key::Keytype type, bool check_exists); // Add a constraint as a part of CREATE TABLE or ALTER TABLE - bool add_constraint(const LEX_CSTRING *name, Virtual_column_info *constr, + bool add_constraint(const LEX_CSTRING &name, Virtual_column_info *constr, bool if_not_exists) { - constr->name= *name; + constr->name= name; constr->flags= if_not_exists ? Alter_info::CHECK_CONSTRAINT_IF_NOT_EXISTS : 0; alter_info.check_constraint_list.push_back(constr); @@ -4293,7 +4293,7 @@ public: info.constr->expr= lt_creator.create(thd, create_item_ident_nosp(thd, &start), create_item_ident_nosp(thd, &end)); - add_constraint(&null_clex_str, info.constr, false); + add_constraint(null_clex_str, info.constr, false); return 0; } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index b7bf618a1ec..a5e55695d02 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -63,23 +63,16 @@ const char *primary_key_name="PRIMARY"; static int check_if_keyname_exists(const char *name,KEY *start, KEY *end); -static char *make_unique_key_name(THD *thd, const char *field_name, KEY *start, - KEY *end); -static void make_unique_constraint_name(THD *thd, LEX_CSTRING *name, - const char *own_name_base, - List<Virtual_column_info> *vcol, - uint *nr); -static const -char * make_unique_invisible_field_name(THD *thd, const char *field_name, - List<Create_field> *fields); - -static int copy_data_between_tables(THD *thd, TABLE *from,TABLE *to, - List<Create_field> &create, bool ignore, - uint order_num, ORDER *order, - ha_rows *copied,ha_rows *deleted, - Alter_info::enum_enable_or_disable keys_onoff, - Alter_table_ctx *alter_ctx); - +static char *make_unique_key_name(THD *, const char *, KEY *, KEY *); +static void make_unique_constraint_name(THD *, LEX_CSTRING *, const char *, + List<Virtual_column_info> *, uint *); +static const char *make_unique_invisible_field_name(THD *, const char *, + List<Create_field> *); +static int copy_data_between_tables(THD *, TABLE *,TABLE *, + List<Create_field> &, bool, uint, ORDER *, + ha_rows *, ha_rows *, + Alter_info::enum_enable_or_disable, + Alter_table_ctx *); static int mysql_prepare_create_table(THD *, HA_CREATE_INFO *, Alter_info *, uint *, handler *, KEY **, uint *, int); static uint blob_length_by_type(enum_field_types type); @@ -1849,7 +1842,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) #endif /* Write shadow frm file */ lpt->create_info->table_options= lpt->db_options; - LEX_CUSTRING frm= build_frm_image(lpt->thd, &lpt->table_name, + LEX_CUSTRING frm= build_frm_image(lpt->thd, lpt->table_name, lpt->create_info, lpt->alter_info->create_list, lpt->key_count, lpt->key_info_buffer, @@ -4310,9 +4303,8 @@ bool validate_comment_length(THD *thd, LEX_CSTRING *comment, size_t max_len, apply it to the table. */ -static void set_table_default_charset(THD *thd, - HA_CREATE_INFO *create_info, - const LEX_CSTRING *db) +static void set_table_default_charset(THD *thd, HA_CREATE_INFO *create_info, + const LEX_CSTRING &db) { /* If the table character set was not given explicitly, @@ -4323,7 +4315,7 @@ static void set_table_default_charset(THD *thd, { Schema_specification_st db_info; - load_db_opt_by_name(thd, db->str, &db_info); + load_db_opt_by_name(thd, db.str, &db_info); create_info->default_table_charset= db_info.default_table_charset; } @@ -4446,8 +4438,8 @@ static bool vers_prepare_keys(THD *thd, HA_CREATE_INFO *create_info, return false; } -handler *mysql_create_frm_image(THD *thd, const LEX_CSTRING *db, - const LEX_CSTRING *table_name, +handler *mysql_create_frm_image(THD *thd, const LEX_CSTRING &db, + const LEX_CSTRING &table_name, HA_CREATE_INFO *create_info, Alter_info *alter_info, int create_table_mode, KEY **key_info, uint *key_count, @@ -4584,7 +4576,7 @@ handler *mysql_create_frm_image(THD *thd, const LEX_CSTRING *db, if (part_info->vers_info && !create_info->versioned()) { - my_error(ER_VERS_NOT_VERSIONED, MYF(0), table_name->str); + my_error(ER_VERS_NOT_VERSIONED, MYF(0), table_name.str); goto err; } @@ -4740,9 +4732,9 @@ err: */ static -int create_table_impl(THD *thd, const LEX_CSTRING *orig_db, - const LEX_CSTRING *orig_table_name, - const LEX_CSTRING *db, const LEX_CSTRING *table_name, +int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, + const LEX_CSTRING &orig_table_name, + const LEX_CSTRING &db, const LEX_CSTRING &table_name, const char *path, const DDL_options_st options, HA_CREATE_INFO *create_info, Alter_info *alter_info, int create_table_mode, bool *is_trans, KEY **key_info, @@ -4755,7 +4747,7 @@ int create_table_impl(THD *thd, const LEX_CSTRING *orig_db, bool internal_tmp_table= create_table_mode == C_ALTER_TABLE || frm_only; DBUG_ENTER("mysql_create_table_no_lock"); DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d path: %s", - db->str, table_name->str, internal_tmp_table, path)); + db.str, table_name.str, internal_tmp_table, path)); if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) { @@ -4781,7 +4773,7 @@ int create_table_impl(THD *thd, const LEX_CSTRING *orig_db, goto err; } - alias= const_cast<LEX_CSTRING*>(table_case_name(create_info, table_name)); + alias= const_cast<LEX_CSTRING*>(table_case_name(create_info, &table_name)); /* Check if table exists */ if (create_info->tmp_table()) @@ -4790,7 +4782,7 @@ int create_table_impl(THD *thd, const LEX_CSTRING *orig_db, If a table exists, it must have been pre-opened. Try looking for one in-use in THD::all_temp_tables list of TABLE_SHAREs. */ - TABLE *tmp_table= thd->find_temporary_table(db->str, table_name->str); + TABLE *tmp_table= thd->find_temporary_table(db.str, table_name.str); if (tmp_table) { @@ -4825,14 +4817,14 @@ int create_table_impl(THD *thd, const LEX_CSTRING *orig_db, } else { - if (!internal_tmp_table && ha_table_exists(thd, db, table_name)) + if (!internal_tmp_table && ha_table_exists(thd, &db, &table_name)) { if (options.or_replace()) { - (void) delete_statistics_for_table(thd, db, table_name); + (void) delete_statistics_for_table(thd, &db, &table_name); TABLE_LIST table_list; - table_list.init_one_table(db, table_name, 0, TL_WRITE_ALLOW_WRITE); + table_list.init_one_table(&db, &table_name, 0, TL_WRITE_ALLOW_WRITE); table_list.table= create_info->table; if (check_if_log_table(&table_list, TRUE, "CREATE OR REPLACE")) @@ -4867,7 +4859,7 @@ int create_table_impl(THD *thd, const LEX_CSTRING *orig_db, goto warn; else { - my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name->str); + my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name.str); goto err; } } @@ -4875,7 +4867,7 @@ int create_table_impl(THD *thd, const LEX_CSTRING *orig_db, THD_STAGE_INFO(thd, stage_creating_table); - if (check_engine(thd, orig_db->str, orig_table_name->str, create_info)) + if (check_engine(thd, orig_db.str, orig_table_name.str, create_info)) goto err; if (create_table_mode == C_ASSISTED_DISCOVERY) @@ -4895,7 +4887,7 @@ int create_table_impl(THD *thd, const LEX_CSTRING *orig_db, goto err; } - init_tmp_table_share(thd, &share, db->str, 0, table_name->str, path); + init_tmp_table_share(thd, &share, db.str, 0, table_name.str, path); /* prepare everything for discovery */ share.field= &no_fields; @@ -4937,7 +4929,7 @@ int create_table_impl(THD *thd, const LEX_CSTRING *orig_db, */ if (!file || thd->is_error()) goto err; - if (rea_create_table(thd, frm, path, db->str, table_name->str, create_info, + if (rea_create_table(thd, frm, path, db.str, table_name.str, create_info, file, frm_only)) goto err; } @@ -4946,9 +4938,8 @@ int create_table_impl(THD *thd, const LEX_CSTRING *orig_db, if (!frm_only && create_info->tmp_table()) { TABLE *table= thd->create_and_open_tmp_table(create_info->db_type, frm, - path, db->str, - table_name->str, true, - false); + path, db.str, + table_name.str, true, false); if (!table) { @@ -4978,7 +4969,7 @@ int create_table_impl(THD *thd, const LEX_CSTRING *orig_db, TABLE table; TABLE_SHARE share; - init_tmp_table_share(thd, &share, db->str, 0, table_name->str, path); + init_tmp_table_share(thd, &share, db.str, 0, table_name.str, path); bool result= (open_table_def(thd, &share, GTS_TABLE) || open_table_from_share(thd, &share, &empty_clex_str, 0, @@ -5054,7 +5045,7 @@ int mysql_create_table_no_lock(THD *thd, const LEX_CSTRING *db, } } - res= create_table_impl(thd, db, table_name, db, table_name, path, + res= create_table_impl(thd, *db, *table_name, *db, *table_name, path, *create_info, create_info, alter_info, create_table_mode, is_trans, ¬_used_1, ¬_used_2, &frm); @@ -9513,7 +9504,7 @@ do_continue:; DBUG_RETURN(true); } - set_table_default_charset(thd, create_info, &alter_ctx.db); + set_table_default_charset(thd, create_info, alter_ctx.db); if (create_info->check_period_fields(thd, alter_info) || create_info->fix_period_fields(thd, alter_info)) @@ -9693,9 +9684,8 @@ do_continue:; tmp_disable_binlog(thd); create_info->options|=HA_CREATE_TMP_ALTER; - error= create_table_impl(thd, - &alter_ctx.db, &alter_ctx.table_name, - &alter_ctx.new_db, &alter_ctx.tmp_name, + error= create_table_impl(thd, alter_ctx.db, alter_ctx.table_name, + alter_ctx.new_db, alter_ctx.tmp_name, alter_ctx.get_tmp_path(), thd->lex->create_info, create_info, alter_info, C_ALTER_TABLE_FRM_ONLY, NULL, @@ -10971,10 +10961,10 @@ bool check_engine(THD *thd, const char *db_name, if (req_engine && req_engine != *new_engine) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, - ER_WARN_USING_OTHER_HANDLER, + ER_WARN_USING_OTHER_HANDLER, ER_THD(thd, ER_WARN_USING_OTHER_HANDLER), - ha_resolve_storage_engine_name(*new_engine), - table_name); + ha_resolve_storage_engine_name(*new_engine), + table_name); } if (create_info->tmp_table() && ha_check_storage_engine_flag(*new_engine, HTON_TEMPORARY_NOT_SUPPORTED)) diff --git a/sql/sql_table.h b/sql/sql_table.h index 9958a56958e..6f53dd8e75d 100644 --- a/sql/sql_table.h +++ b/sql/sql_table.h @@ -198,8 +198,8 @@ int mysql_create_table_no_lock(THD *thd, const LEX_CSTRING *db, int create_table_mode, TABLE_LIST *table); handler *mysql_create_frm_image(THD *thd, - const LEX_CSTRING *db, - const LEX_CSTRING *table_name, + const LEX_CSTRING &db, + const LEX_CSTRING &table_name, HA_CREATE_INFO *create_info, Alter_info *alter_info, int create_table_mode, diff --git a/sql/sql_update.cc b/sql/sql_update.cc index bb0fbe2a090..50b294105f1 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1356,8 +1356,7 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list, DBUG_RETURN(TRUE); if (setup_tables_and_check_access(thd, &select_lex->context, - &select_lex->top_join_list, - table_list, + &select_lex->top_join_list, table_list, select_lex->leaf_tables, FALSE, UPDATE_ACL, SELECT_ACL, TRUE) || setup_conds(thd, table_list, select_lex->leaf_tables, conds) || diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 23e074eae6c..6b77f598a3c 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -6636,7 +6636,7 @@ key_def: constraint_def: opt_constraint check_constraint { - Lex->add_constraint(&$1, $2, FALSE); + Lex->add_constraint($1, $2, FALSE); } ; @@ -8350,7 +8350,7 @@ alter_list_item: | ADD CONSTRAINT IF_SYM not EXISTS field_ident check_constraint { Lex->alter_info.flags|= ALTER_ADD_CHECK_CONSTRAINT; - Lex->add_constraint(&$6, $7, TRUE); + Lex->add_constraint($6, $7, TRUE); } | CHANGE opt_column opt_if_exists_table_element field_ident field_spec opt_place diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index 4d46552d8a2..fa62726276e 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -6571,7 +6571,7 @@ key_def: constraint_def: opt_constraint check_constraint { - Lex->add_constraint(&$1, $2, FALSE); + Lex->add_constraint($1, $2, FALSE); } ; @@ -8364,7 +8364,7 @@ alter_list_item: | ADD CONSTRAINT IF_SYM not EXISTS field_ident check_constraint { Lex->alter_info.flags|= ALTER_ADD_CHECK_CONSTRAINT; - Lex->add_constraint(&$6, $7, TRUE); + Lex->add_constraint($6, $7, TRUE); } | CHANGE opt_column opt_if_exists_table_element field_ident field_spec opt_place diff --git a/sql/table.cc b/sql/table.cc index 58d9f16c0a1..73002506cd1 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1366,8 +1366,8 @@ void TABLE::find_constraint_correlated_indexes() bool TABLE_SHARE::init_period_from_extra2(period_info_t &period, const uchar *data) { - period.start_fieldno= uint2korr(data); - period.end_fieldno= uint2korr(data + frm_fieldno_size); + period.start_fieldno= read_frm_fieldno(data); + period.end_fieldno= read_frm_fieldno(data + frm_fieldno_size); return period.start_fieldno >= fields || period.end_fieldno >= fields; } @@ -1419,18 +1419,16 @@ bool read_extra2(const uchar *frm_image, size_t len, extra2_fields *fields) fields->options.length= length; break; case EXTRA2_DEFAULT_PART_ENGINE: - fields->engine.set((char*)extra2, length); + fields->engine.set((const char*)extra2, length); break; case EXTRA2_GIS: -#ifdef HAVE_SPATIAL if (fields->gis.str) DBUG_RETURN(true); fields->gis.str= extra2; fields->gis.length= length; -#endif /*HAVE_SPATIAL*/ break; case EXTRA2_PERIOD_FOR_SYSTEM_TIME: - if (fields->system_period || length != 2 * sizeof(uint16)) + if (fields->system_period || length != 2 * frm_fieldno_size) DBUG_RETURN(true); fields->system_period = extra2; break; @@ -3014,7 +3012,7 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write, thd->lex->create_info.tabledef_version= tabledef_version; promote_first_timestamp_column(&thd->lex->alter_info.create_list); - file= mysql_create_frm_image(thd, &db, &table_name, + file= mysql_create_frm_image(thd, db, table_name, &thd->lex->create_info, &thd->lex->alter_info, C_ORDINARY_CREATE, &unused1, &unused2, &frm); error|= file == 0; diff --git a/sql/table.h b/sql/table.h index da2247c4f6a..a49b1f29529 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1783,6 +1783,11 @@ class IS_table_read_plan; /** number of bytes used by field positional indexes in frm */ constexpr uint frm_fieldno_size= 2; +static inline uint16 read_frm_fieldno(const uchar *data) +{ return uint2korr(data); } +static inline void store_frm_fieldno(const uchar *data, uint16 fieldno) +{ int2store(data, fieldno); } + /** number of bytes used by identifier length in frm */ constexpr uint frm_ident_len_size= 2; diff --git a/sql/unireg.cc b/sql/unireg.cc index ab3ac0dabca..d70a73b89c7 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -73,18 +73,18 @@ static uchar *extra2_write_len(uchar *pos, size_t len) } static uchar *extra2_write(uchar *pos, enum extra2_frm_value_type type, - const LEX_CSTRING *str) + const LEX_CSTRING &str) { *pos++ = type; - pos= extra2_write_len(pos, str->length); - memcpy(pos, str->str, str->length); - return pos + str->length; + pos= extra2_write_len(pos, str.length); + memcpy(pos, str.str, str.length); + return pos + str.length; } static uchar *extra2_write(uchar *pos, enum extra2_frm_value_type type, - LEX_CUSTRING *str) + const LEX_CUSTRING &str) { - return extra2_write(pos, type, reinterpret_cast<LEX_CSTRING *>(str)); + return extra2_write(pos, type, *reinterpret_cast<const LEX_CSTRING*>(&str)); } static uchar *extra2_write_field_properties(uchar *pos, @@ -106,10 +106,9 @@ static uchar *extra2_write_field_properties(uchar *pos, return pos; } -static -uint16 +static uint16 get_fieldno_by_name(HA_CREATE_INFO *create_info, List<Create_field> &create_fields, - const Lex_ident field_name) + const Lex_ident &field_name) { List_iterator<Create_field> it(create_fields); Create_field *sql_field = NULL; @@ -151,6 +150,11 @@ uchar* store_str(uchar *buf, const Lex_ident &str) return buf + str.length + frm_ident_len_size; } +static size_t extra2_size_needed(size_t len) +{ + return 1 + (len > 255 ? 3 : 1) + len; +} + /** Create a frm (table definition) file @@ -166,7 +170,7 @@ uchar* store_str(uchar *buf, const Lex_ident &str) or null LEX_CUSTRING (str==0) in case of an error. */ -LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table, +LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table, HA_CREATE_INFO *create_info, List<Create_field> &create_fields, uint keys, KEY *key_info, handler *db_file) @@ -245,7 +249,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table, DBUG_PRINT("info", ("Options length: %u", options_len)); if (validate_comment_length(thd, &create_info->comment, TABLE_COMMENT_MAXLEN, - ER_TOO_LONG_TABLE_COMMENT, table->str)) + ER_TOO_LONG_TABLE_COMMENT, table.str)) DBUG_RETURN(frm); /* If table comment is longer than TABLE_COMMENT_INLINE_MAXLEN bytes, @@ -279,31 +283,30 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table, prepare_frm_header(thd, reclength, fileinfo, create_info, keys, key_info); /* one byte for a type, one or three for a length */ - size_t extra2_size= 1 + 1 + create_info->tabledef_version.length; + size_t extra2_size= extra2_size_needed(create_info->tabledef_version.length); if (options_len) - extra2_size+= 1 + (options_len > 255 ? 3 : 1) + options_len; + extra2_size+= extra2_size_needed(options_len); if (part_info) - extra2_size+= 1 + 1 + hton_name(part_info->default_engine_type)->length; + extra2_size+= extra2_size_needed(hton_name(part_info->default_engine_type)->length); if (gis_extra2_len) - extra2_size+= 1 + (gis_extra2_len > 255 ? 3 : 1) + gis_extra2_len; + extra2_size+= extra2_size_needed(gis_extra2_len); if (create_info->versioned()) { - extra2_size+= 1 + 1 + 2 * sizeof(uint16); + extra2_size+= extra2_size_needed(2 * frm_fieldno_size); } if (create_info->period_info.name) { - extra2_size+= 1 + (period_info_len > 255 ? 3 : 1) + period_info_len; + extra2_size+= extra2_size_needed(period_info_len); } bool has_extra2_field_flags_= has_extra2_field_flags(create_fields); if (has_extra2_field_flags_) { - extra2_size+= 1 + (create_fields.elements > 255 ? 3 : 1) + - create_fields.elements; + extra2_size+= extra2_size_needed(create_fields.elements); } key_buff_length= uint4korr(fileinfo+47); @@ -325,7 +328,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table, if (frm.length > FRM_MAX_SIZE || create_info->expression_length > UINT_MAX32) { - my_error(ER_TABLE_DEFINITION_TOO_BIG, MYF(0), table->str); + my_error(ER_TABLE_DEFINITION_TOO_BIG, MYF(0), table.str); DBUG_RETURN(frm); } @@ -338,11 +341,11 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table, pos = frm_ptr + 64; compile_time_assert(EXTRA2_TABLEDEF_VERSION != '/'); pos= extra2_write(pos, EXTRA2_TABLEDEF_VERSION, - &create_info->tabledef_version); + create_info->tabledef_version); if (part_info) pos= extra2_write(pos, EXTRA2_DEFAULT_PART_ENGINE, - hton_name(part_info->default_engine_type)); + *hton_name(part_info->default_engine_type)); if (options_len) { @@ -369,10 +372,10 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table, pos= store_str(pos, create_info->period_info.name); pos= store_str(pos, create_info->period_info.constr->name); - int2store(pos, get_fieldno_by_name(create_info, create_fields, + store_frm_fieldno(pos, get_fieldno_by_name(create_info, create_fields, create_info->period_info.period.start)); pos+= frm_fieldno_size; - int2store(pos, get_fieldno_by_name(create_info, create_fields, + store_frm_fieldno(pos, get_fieldno_by_name(create_info, create_fields, create_info->period_info.period.end)); pos+= frm_fieldno_size; } @@ -380,13 +383,13 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table, if (create_info->versioned()) { *pos++= EXTRA2_PERIOD_FOR_SYSTEM_TIME; - *pos++= 2 * sizeof(uint16); - int2store(pos, get_fieldno_by_name(create_info, create_fields, + *pos++= 2 * frm_fieldno_size; + store_frm_fieldno(pos, get_fieldno_by_name(create_info, create_fields, create_info->vers_info.as_row.start)); - pos+= sizeof(uint16); - int2store(pos, get_fieldno_by_name(create_info, create_fields, + pos+= frm_fieldno_size; + store_frm_fieldno(pos, get_fieldno_by_name(create_info, create_fields, create_info->vers_info.as_row.end)); - pos+= sizeof(uint16); + pos+= frm_fieldno_size; } if (has_extra2_field_flags_) @@ -402,7 +405,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table, my_printf_error(ER_CANT_CREATE_TABLE, "Cannot create table %`s: index information is too long. " "Decrease number of indexes or use shorter index names or shorter comments.", - MYF(0), table->str); + MYF(0), table.str); goto err; } diff --git a/sql/unireg.h b/sql/unireg.h index dacf24ad7aa..17fa19a339e 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -170,8 +170,8 @@ enum extra2_frm_value_type { EXTRA2_TABLEDEF_VERSION=0, EXTRA2_DEFAULT_PART_ENGINE=1, EXTRA2_GIS=2, + EXTRA2_APPLICATION_TIME_PERIOD=3, EXTRA2_PERIOD_FOR_SYSTEM_TIME=4, - EXTRA2_APPLICATION_TIME_PERIOD=8, #define EXTRA2_ENGINE_IMPORTANT 128 @@ -187,7 +187,7 @@ int rea_create_table(THD *thd, LEX_CUSTRING *frm, const char *path, const char *db, const char *table_name, HA_CREATE_INFO *create_info, handler *file, bool no_ha_create_table); -LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table, +LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table, HA_CREATE_INFO *create_info, List<Create_field> &create_fields, uint keys, KEY *key_info, handler *db_file); |