summaryrefslogtreecommitdiff
path: root/storage/innobase/include/dict0dict.ic
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/include/dict0dict.ic')
-rw-r--r--storage/innobase/include/dict0dict.ic85
1 files changed, 22 insertions, 63 deletions
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index dde3e2bfac7..26918251d8b 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -89,16 +89,6 @@ dict_col_copy_type(
type->len = col->len;
type->mbminmaxlen = col->mbminmaxlen;
}
-/** Check if a column is a virtual column
-@param[in] col column
-@return true if it is a virtual column, false otherwise */
-UNIV_INLINE
-bool
-dict_col_is_virtual(
- const dict_col_t* col)
-{
- return(col->prtype & DATA_VIRTUAL);
-}
#ifdef UNIV_DEBUG
/*********************************************************************//**
@@ -296,8 +286,7 @@ dict_index_is_clust(
const dict_index_t* index) /*!< in: index */
{
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
-
- return(index->type & DICT_CLUSTERED);
+ return(index->is_clust());
}
/** Check if index is auto-generated clustered index.
@@ -396,8 +385,10 @@ dict_table_get_n_user_cols(
const dict_table_t* table) /*!< in: table */
{
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
-
- return(table->n_cols - dict_table_get_n_sys_cols(table));
+ /* n_cols counts stored columns only. A table may contain
+ virtual columns and no user-specified stored columns at all. */
+ ut_ad(table->n_cols >= DATA_N_SYS_COLS);
+ return(table->n_cols - DATA_N_SYS_COLS);
}
/********************************************************************//**
@@ -529,8 +520,8 @@ dict_table_get_nth_v_col(
ut_ad(table);
ut_ad(pos < table->n_v_def);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
-
- return(static_cast<dict_v_col_t*>(table->v_cols) + pos);
+ ut_ad(!table->v_cols[pos].m_col.is_instant());
+ return &table->v_cols[pos];
}
/********************************************************************//**
@@ -546,11 +537,10 @@ dict_table_get_sys_col(
dict_col_t* col;
ut_ad(table);
- ut_ad(sys < dict_table_get_n_sys_cols(table));
+ ut_ad(sys < DATA_N_SYS_COLS);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
- col = dict_table_get_nth_col(table, table->n_cols
- - dict_table_get_n_sys_cols(table)
+ col = dict_table_get_nth_col(table, table->n_cols - DATA_N_SYS_COLS
+ sys);
ut_ad(col->mtype == DATA_SYS);
ut_ad(col->prtype == (sys | DATA_NOT_NULL));
@@ -570,10 +560,10 @@ dict_table_get_sys_col_no(
ulint sys) /*!< in: DATA_ROW_ID, ... */
{
ut_ad(table);
- ut_ad(sys < dict_table_get_n_sys_cols(table));
+ ut_ad(sys < DATA_N_SYS_COLS);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
- return(table->n_cols - dict_table_get_n_sys_cols(table) + sys);
+ return(table->n_cols - DATA_N_SYS_COLS + sys);
}
/********************************************************************//**
@@ -723,36 +713,6 @@ dict_tf_get_rec_format(
return(REC_FORMAT_DYNAMIC);
}
-/********************************************************************//**
-Determine the file format from a dict_table_t::flags.
-@return file format version */
-UNIV_INLINE
-ulint
-dict_tf_get_format(
-/*===============*/
- ulint flags) /*!< in: dict_table_t::flags */
-{
- if (DICT_TF_HAS_ATOMIC_BLOBS(flags)) {
- return(UNIV_FORMAT_B);
- }
-
- return(UNIV_FORMAT_A);
-}
-
-/********************************************************************//**
-Determine the file format of a table.
-@return file format version */
-UNIV_INLINE
-ulint
-dict_table_get_format(
-/*==================*/
- const dict_table_t* table) /*!< in: table */
-{
- ut_ad(table);
-
- return(dict_tf_get_format(table->flags));
-}
-
/** Set the various values in a dict_table_t::flags pointer.
@param[in,out] flags, Pointer to a 4 byte Table Flags
@param[in] format File Format
@@ -1417,7 +1377,7 @@ dict_table_is_fts_column(
/**********************************************************************//**
Determine bytes of column prefix to be stored in the undo log. Please
-note if the table format is UNIV_FORMAT_A (< UNIV_FORMAT_B), no prefix
+note that if !dict_table_has_atomic_blobs(table), no prefix
needs to be stored in the undo log.
@return bytes of column prefix to be stored in the undo log */
UNIV_INLINE
@@ -1428,16 +1388,15 @@ dict_max_field_len_store_undo(
const dict_col_t* col) /*!< in: column which index prefix
is based on */
{
- ulint prefix_len = 0;
+ if (!dict_table_has_atomic_blobs(table)) {
+ return(0);
+ }
- if (dict_table_get_format(table) >= UNIV_FORMAT_B)
- {
- prefix_len = col->max_prefix
- ? col->max_prefix
- : DICT_MAX_FIELD_LEN_BY_FORMAT(table);
+ if (col->max_prefix != 0) {
+ return(col->max_prefix);
}
- return(prefix_len);
+ return(REC_VERSION_56_MAX_INDEX_COL_LEN);
}
/** Determine maximum bytes of a virtual column need to be stored
@@ -1457,10 +1416,10 @@ dict_max_v_field_len_store_undo(
/* This calculation conforms to the non-virtual column
maximum log length calculation:
- 1) for UNIV_FORMAT_A, upto REC_ANTELOPE_MAX_INDEX_COL_LEN
- for UNIV_FORMAT_B, upto col->max_prefix or
- 2) REC_VERSION_56_MAX_INDEX_COL_LEN, whichever is less */
- if (dict_table_get_format(table) >= UNIV_FORMAT_B) {
+ 1) if No atomic BLOB, upto REC_ANTELOPE_MAX_INDEX_COL_LEN
+ 2) if atomic BLOB, upto col->max_prefix or
+ REC_VERSION_56_MAX_INDEX_COL_LEN, whichever is less */
+ if (dict_table_has_atomic_blobs(table)) {
if (DATA_BIG_COL(col) && col->max_prefix > 0) {
max_log_len = col->max_prefix;
} else {