| 1054 | |
| 1055 | |
| 1056 | void IDX_delete_indices(thread_db* tdbb, jrd_rel* relation, RelationPages* relPages) |
| 1057 | { |
| 1058 | /************************************** |
| 1059 | * |
| 1060 | * I D X _ d e l e t e _ i n d i c e s |
| 1061 | * |
| 1062 | ************************************** |
| 1063 | * |
| 1064 | * Functional description |
| 1065 | * Delete all known indices in preparation for deleting a |
| 1066 | * complete relation. |
| 1067 | * |
| 1068 | **************************************/ |
| 1069 | SET_TDBB(tdbb); |
| 1070 | |
| 1071 | fb_assert(relPages->rel_index_root); |
| 1072 | |
| 1073 | WIN window(relPages->rel_pg_space_id, relPages->rel_index_root); |
| 1074 | index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_root); |
| 1075 | |
| 1076 | const bool is_temp = (relation->rel_flags & REL_temp_conn) && (relPages->rel_instance_id != 0); |
| 1077 | |
| 1078 | for (USHORT i = 0; i < root->irt_count; i++) |
| 1079 | { |
| 1080 | const bool tree_exists = BTR_delete_index(tdbb, &window, i); |
| 1081 | root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_root); |
| 1082 | |
| 1083 | if (is_temp && tree_exists) |
| 1084 | { |
| 1085 | IndexLock* idx_lock = CMP_get_index_lock(tdbb, relation, i); |
| 1086 | if (idx_lock) |
| 1087 | { |
| 1088 | if (!--idx_lock->idl_count) { |
| 1089 | LCK_release(tdbb, idx_lock->idl_lock); |
| 1090 | } |
| 1091 | } |
| 1092 | } |
| 1093 | } |
| 1094 | |
| 1095 | CCH_RELEASE(tdbb, &window); |
| 1096 | } |
| 1097 | |
| 1098 | |
| 1099 | void IDX_erase(thread_db* tdbb, record_param* rpb, jrd_tra* transaction) |
no test coverage detected