MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / BTR_description

Function BTR_description

src/jrd/btr.cpp:948–1048  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

946
947
948bool BTR_description(thread_db* tdbb, jrd_rel* relation, index_root_page* root, index_desc* idx,
949 USHORT id)
950{
951/**************************************
952 *
953 * B T R _ d e s c r i p t i o n
954 *
955 **************************************
956 *
957 * Functional description
958 * See if index exists, and if so, pick up its description.
959 * Index id's must fit in a short - formerly a UCHAR.
960 *
961 **************************************/
962 SET_TDBB(tdbb);
963
964 if (id >= root->irt_count)
965 return false;
966
967 const index_root_page::irt_repeat* irt_desc = &root->irt_rpt[id];
968
969 if (irt_desc->getRoot() == 0)
970 return false;
971
972 idx->idx_id = id;
973 idx->idx_root = irt_desc->getRoot();
974 idx->idx_count = irt_desc->irt_keys;
975 idx->idx_flags = irt_desc->irt_flags;
976 idx->idx_runtime_flags = 0;
977 idx->idx_foreign_primaries = nullptr;
978 idx->idx_foreign_relations = nullptr;
979 idx->idx_foreign_indexes = nullptr;
980 idx->idx_primary_relation = 0;
981 idx->idx_primary_index = 0;
982 idx->idx_expression = nullptr;
983 idx->idx_expression_statement = nullptr;
984 idx->idx_condition = nullptr;
985 idx->idx_condition_statement = nullptr;
986 idx->idx_fraction = 1.0;
987
988 // pick up field ids and type descriptions for each of the fields
989 const UCHAR* ptr = (UCHAR*) root + irt_desc->irt_desc;
990 index_desc::idx_repeat* idx_desc = idx->idx_rpt;
991 for (int i = 0; i < idx->idx_count; i++, idx_desc++)
992 {
993 const irtd* key_descriptor = (irtd*) ptr;
994 idx_desc->idx_field = key_descriptor->irtd_field;
995 idx_desc->idx_itype = key_descriptor->irtd_itype;
996 idx_desc->idx_selectivity = key_descriptor->irtd_selectivity;
997 ptr += sizeof(irtd);
998 }
999 idx->idx_selectivity = idx->idx_rpt[idx->idx_count - 1].idx_selectivity;
1000
1001 ISC_STATUS error = 0;
1002 if (idx->idx_flags & idx_expression)
1003 {
1004 MET_lookup_index_expression(tdbb, relation, idx);
1005

Callers 11

walk_indexMethod · 0.85
walk_rootMethod · 0.85
IDX_check_accessFunction · 0.85
IDX_check_master_typesFunction · 0.85
IDX_garbage_collectFunction · 0.85
check_partner_indexFunction · 0.85
BTR_allFunction · 0.85
BTR_find_pageFunction · 0.85
BTR_lookupFunction · 0.85
BTR_next_indexFunction · 0.85
lookupKeyMethod · 0.85

Calls 8

SET_TDBBFunction · 0.85
GdsClass · 0.85
NumClass · 0.85
ERR_post_nothrowFunction · 0.85
CCH_unwindFunction · 0.85
getRootMethod · 0.80
hasDataMethod · 0.45
assignMethod · 0.45

Tested by

no test coverage detected