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

Function BTR_delete_index

src/jrd/btr.cpp:904–945  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

902
903
904bool BTR_delete_index(thread_db* tdbb, WIN* window, USHORT id)
905{
906/**************************************
907 *
908 * B T R _ d e l e t e _ i n d e x
909 *
910 **************************************
911 *
912 * Functional description
913 * Delete an index if it exists.
914 * Return true if index tree was there.
915 *
916 **************************************/
917 SET_TDBB(tdbb);
918 const Database* dbb = tdbb->getDatabase();
919 CHECK_DBB(dbb);
920
921 // Get index descriptor. If index doesn't exist, just leave.
922 index_root_page* const root = (index_root_page*) window->win_buffer;
923
924 bool tree_exists = false;
925 if (id >= root->irt_count)
926 CCH_RELEASE(tdbb, window);
927 else
928 {
929 index_root_page::irt_repeat* irt_desc = root->irt_rpt + id;
930 CCH_MARK(tdbb, window);
931 const PageNumber next(window->win_page.getPageSpaceID(), irt_desc->getRoot());
932 tree_exists = (irt_desc->getRoot() != 0);
933
934 // remove the pointer to the top-level index page before we delete it
935 irt_desc->setRoot(0);
936 irt_desc->irt_flags = 0;
937 const PageNumber prior = window->win_page;
938 const USHORT relation_id = root->irt_relation;
939
940 CCH_RELEASE(tdbb, window);
941 delete_tree(tdbb, relation_id, id, next, prior);
942 }
943
944 return tree_exists;
945}
946
947
948bool BTR_description(thread_db* tdbb, jrd_rel* relation, index_root_page* root, index_desc* idx,

Callers 3

IDX_delete_indexFunction · 0.85
IDX_delete_indicesFunction · 0.85
BTR_next_indexFunction · 0.85

Calls 9

SET_TDBBFunction · 0.85
CHECK_DBBFunction · 0.85
CCH_RELEASEFunction · 0.85
CCH_MARKFunction · 0.85
delete_treeFunction · 0.85
getDatabaseMethod · 0.80
getPageSpaceIDMethod · 0.80
getRootMethod · 0.80
setRootMethod · 0.80

Tested by

no test coverage detected