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

Function BTR_create

src/jrd/btr.cpp:866–901  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

864
865
866void BTR_create(thread_db* tdbb,
867 IndexCreation& creation,
868 SelectivityList& selectivity)
869{
870/**************************************
871 *
872 * B T R _ c r e a t e
873 *
874 **************************************
875 *
876 * Functional description
877 * Create a new index.
878 *
879 **************************************/
880
881 SET_TDBB(tdbb);
882 const Database* const dbb = tdbb->getDatabase();
883 CHECK_DBB(dbb);
884
885 jrd_rel* const relation = creation.relation;
886 index_desc* const idx = creation.index;
887
888 // Now that the index id has been checked out, create the index.
889 idx->idx_root = fast_load(tdbb, creation, selectivity);
890
891 // Index is created. Go back to the index root page and update it to
892 // point to the index.
893 RelationPages* const relPages = relation->getPages(tdbb);
894 WIN window(relPages->rel_pg_space_id, relPages->rel_index_root);
895 index_root_page* const root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_root);
896 CCH_MARK(tdbb, &window);
897 root->irt_rpt[idx->idx_id].setRoot(idx->idx_root);
898 update_selectivity(root, idx->idx_id, selectivity);
899
900 CCH_RELEASE(tdbb, &window);
901}
902
903
904bool BTR_delete_index(thread_db* tdbb, WIN* window, USHORT id)

Callers 1

IDX_create_indexFunction · 0.85

Calls 10

SET_TDBBFunction · 0.85
CHECK_DBBFunction · 0.85
fast_loadFunction · 0.85
CCH_FETCHFunction · 0.85
CCH_MARKFunction · 0.85
update_selectivityFunction · 0.85
CCH_RELEASEFunction · 0.85
getDatabaseMethod · 0.80
setRootMethod · 0.80
getPagesMethod · 0.45

Tested by

no test coverage detected