📄 dict0dict.ic
字号:
}/*************************************************************************Gets the index tree where the index is stored. */UNIV_INLINEdict_tree_t*dict_index_get_tree(/*================*/ /* out: index tree */ dict_index_t* index) /* in: index */{ ut_ad(index); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); return(index->tree);} /*************************************************************************Gets the field order criterion. */UNIV_INLINEulintdict_field_get_order(/*=================*/ dict_field_t* field){ ut_ad(field); return(field->order);}/*************************************************************************Gets the field column. */UNIV_INLINEdict_col_t*dict_field_get_col(/*===============*/ dict_field_t* field){ ut_ad(field); return(field->col);}/************************************************************************Gets pointer to the nth field data type in an index. */UNIV_INLINEdtype_t*dict_index_get_nth_type(/*====================*/ /* out: data type */ dict_index_t* index, /* in: index */ ulint pos) /* in: position of the field */{ return(dict_col_get_type(dict_field_get_col( dict_index_get_nth_field(index, pos))));}/************************************************************************Gets the column number the nth field in an index. */UNIV_INLINEulintdict_index_get_nth_col_no(/*======================*/ /* out: column number */ dict_index_t* index, /* in: index */ ulint pos) /* in: position of the field */{ return(dict_col_get_no(dict_field_get_col( dict_index_get_nth_field(index, pos))));}/*************************************************************************Gets the space id of the root of the index tree. */UNIV_INLINEulintdict_tree_get_space(/*================*/ /* out: space id */ dict_tree_t* tree) /* in: tree */{ ut_ad(tree); ut_ad(tree->magic_n == DICT_TREE_MAGIC_N); return(tree->space);}/*************************************************************************Sets the space id of the root of the index tree. */UNIV_INLINEvoiddict_tree_set_space(/*================*/ dict_tree_t* tree, /* in: tree */ ulint space) /* in: space id */{ ut_ad(tree); ut_ad(tree->magic_n == DICT_TREE_MAGIC_N); tree->space = space;}/*************************************************************************Gets the page number of the root of the index tree. */UNIV_INLINEulintdict_tree_get_page(/*===============*/ /* out: page number */ dict_tree_t* tree) /* in: tree */{ ut_ad(tree); ut_ad(tree->magic_n == DICT_TREE_MAGIC_N); return(tree->page);}/*************************************************************************Sets the page number of the root of index tree. */UNIV_INLINEvoiddict_tree_set_page(/*===============*/ dict_tree_t* tree, /* in: tree */ ulint page) /* in: page number */{ ut_ad(tree); ut_ad(tree->magic_n == DICT_TREE_MAGIC_N); tree->page = page;}/*************************************************************************Gets the type of the index tree. */UNIV_INLINEulintdict_tree_get_type(/*===============*/ /* out: type */ dict_tree_t* tree) /* in: tree */{ ut_ad(tree); ut_ad(tree->magic_n == DICT_TREE_MAGIC_N); return(tree->type);}/*************************************************************************Gets the read-write lock of the index tree. */UNIV_INLINErw_lock_t*dict_tree_get_lock(/*===============*/ /* out: read-write lock */ dict_tree_t* tree) /* in: tree */{ ut_ad(tree); ut_ad(tree->magic_n == DICT_TREE_MAGIC_N); return(&(tree->lock));}/************************************************************************Returns free space reserved for future updates of records. This isrelevant only in the case of many consecutive inserts, as updateswhich make the records bigger might fragment the index. */UNIV_INLINEulintdict_tree_get_space_reserve(/*========================*/ /* out: number of free bytes on page, reserved for updates */ dict_tree_t* tree) /* in: a tree */{ ut_ad(tree); UT_NOT_USED(tree); return(UNIV_PAGE_SIZE / 16);}/**************************************************************************Checks if a table is in the dictionary cache. */UNIV_INLINEdict_table_t*dict_table_check_if_in_cache_low(/*==============================*/ /* out: table, NULL if not found */ const char* table_name) /* in: table name */{ dict_table_t* table; ulint table_fold; ut_ad(table_name);#ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(dict_sys->mutex)));#endif /* UNIV_SYNC_DEBUG */ /* Look for the table name in the hash table */ table_fold = ut_fold_string(table_name); HASH_SEARCH(name_hash, dict_sys->table_hash, table_fold, table, ut_strcmp(table->name, table_name) == 0); return(table);}/**************************************************************************Gets a table; loads it to the dictionary cache if necessary. A low-levelfunction. */UNIV_INLINEdict_table_t*dict_table_get_low(/*===============*/ /* out: table, NULL if not found */ const char* table_name) /* in: table name */{ dict_table_t* table; ut_ad(table_name);#ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(dict_sys->mutex)));#endif /* UNIV_SYNC_DEBUG */ table = dict_table_check_if_in_cache_low(table_name); if (table == NULL) { table = dict_load_table(table_name); } return(table);}/**************************************************************************Returns a table object, based on table id, and memoryfixes it. */UNIV_INLINEdict_table_t*dict_table_get_on_id_low(/*=====================*/ /* out: table, NULL if does not exist */ dulint table_id, /* in: table id */ trx_t* trx) /* in: transaction handle */{ dict_table_t* table; ulint fold;#ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(dict_sys->mutex)));#endif /* UNIV_SYNC_DEBUG */ UT_NOT_USED(trx); /* Look for the table name in the hash table */ fold = ut_fold_dulint(table_id); HASH_SEARCH(id_hash, dict_sys->table_id_hash, fold, table, ut_dulint_cmp(table->id, table_id) == 0); if (table == NULL) { table = dict_load_table_on_id(table_id); } if (table != NULL) { table->mem_fix++; /* lock_push(trx, table, LOCK_DICT_MEM_FIX) */ } /* TODO: should get the type information from MySQL */ return(table);}/**************************************************************************Releases a table from being memoryfixed. Currently this has no relevance. */UNIV_INLINEvoiddict_table_release(/*===============*/ dict_table_t* table) /* in: table to be released */{ mutex_enter(&(dict_sys->mutex)); table->mem_fix--; mutex_exit(&(dict_sys->mutex));}/**************************************************************************Returns an index object. */UNIV_INLINEdict_index_t*dict_table_get_index(/*=================*/ /* out: index, NULL if does not exist */ dict_table_t* table, /* in: table */ const char* name) /* in: index name */{ dict_index_t* index = NULL; index = dict_table_get_first_index(table); while (index != NULL) { if (ut_strcmp(name, index->name) == 0) { break; } index = dict_table_get_next_index(index); } return(index);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -