diff options
Diffstat (limited to 'storage/innobase/include/dict0mem.h')
-rw-r--r-- | storage/innobase/include/dict0mem.h | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 62116ccf745..bfa3742f683 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -396,18 +396,7 @@ dict_mem_index_create( ulint type, /*!< in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed */ ulint n_fields); /*!< in: number of fields */ -/**********************************************************************//** -Adds a field definition to an index. NOTE: does not take a copy -of the column name if the field is a column. The memory occupied -by the column name may be released only after publishing the index. */ -void -dict_mem_index_add_field( -/*=====================*/ - dict_index_t* index, /*!< in: index */ - const char* name, /*!< in: column name */ - ulint prefix_len); /*!< in: 0 or the column prefix length - in a MySQL index like - INDEX (textcol(25)) */ + /**********************************************************************//** Frees an index memory object. */ void @@ -886,9 +875,11 @@ struct dict_field_t{ unsigned fixed_len:10; /*!< 0 or the fixed length of the column if smaller than DICT_ANTELOPE_MAX_INDEX_COL_LEN */ + /** 1=DESC, 0=ASC */ + unsigned descending:1; /** Zero-initialize all fields */ - dict_field_t() : col(NULL), name(NULL), prefix_len(0), fixed_len(0) {} + dict_field_t() { memset((void*) this, 0, sizeof *this); } /** Check whether two index fields are equivalent. @param[in] old the other index field @@ -1416,6 +1407,21 @@ inline void dict_col_t::detach(const dict_index_t &index) reinterpret_cast<dict_v_col_t*>(this)->detach(index); } +/** Add a field definition to an index. +@param index index +@param name pointer to column name +@param prefix_len column prefix length, or 0 +@param descending whether to use descending order */ +inline void dict_mem_index_add_field(dict_index_t *index, const char *name, + ulint prefix_len, bool descending= false) +{ + ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); + dict_field_t &field= index->fields[index->n_def++]; + field.name= name; + field.prefix_len= prefix_len & ((1U << 12) - 1); + field.descending= descending; +} + /** The status of online index creation */ enum online_index_status { /** the index is complete and ready for access */ |