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

Method walk_root

src/jrd/validation.cpp:3221–3289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3219
3220
3221Validation::RTN Validation::walk_root(jrd_rel* relation, bool getInfo)
3222{
3223/**************************************
3224 *
3225 * w a l k _ r o o t
3226 *
3227 **************************************
3228 *
3229 * Functional description
3230 * Walk index root page for a relation. If getInfo is true
3231 * get index metadata for condition indices, else walk every index.
3232 *
3233 **************************************/
3234
3235 // If the relation has an index root, walk it
3236 RelationPages* relPages = relation->getBasePages();
3237
3238 if (!relPages->rel_index_root)
3239 return corrupt(VAL_INDEX_ROOT_MISSING, relation);
3240
3241 index_root_page* page = 0;
3242 WIN window(DB_PAGE_SPACE, -1);
3243 fetch_page(!getInfo, relPages->rel_index_root, pag_root, &window, &page);
3244
3245 for (USHORT i = 0; i < page->irt_count; i++)
3246 {
3247 if (page->irt_rpt[i].getRoot() == 0)
3248 continue;
3249
3250 MetaName index;
3251
3252 release_page(&window);
3253 MET_lookup_index(vdr_tdbb, index, relation->rel_name, i + 1);
3254 fetch_page(false, relPages->rel_index_root, pag_root, &window, &page);
3255
3256 if (vdr_idx_incl)
3257 {
3258 if (!vdr_idx_incl->matches(index.c_str(), index.length()))
3259 continue;
3260 }
3261
3262 if (vdr_idx_excl)
3263 {
3264 if (vdr_idx_excl->matches(index.c_str(), index.length()))
3265 continue;
3266 }
3267
3268 if (getInfo)
3269 {
3270 if (page->irt_rpt[i].irt_flags & irt_condition)
3271 {
3272 // No need to evaluate index expression
3273 AutoSetRestoreFlag<UCHAR> flag(&page->irt_rpt[i].irt_flags, irt_expression, false);
3274
3275 IdxInfo info;
3276 if (BTR_description(vdr_tdbb, relation, page, &info.m_desc, i))
3277 vdr_cond_idx.add(info);
3278 }

Callers

nothing calls this directly

Calls 9

corruptFunction · 0.85
BTR_descriptionFunction · 0.85
outputFunction · 0.85
getBasePagesMethod · 0.80
getRootMethod · 0.80
matchesMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected