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

Function CMP_get_index_lock

src/jrd/cmp.cpp:279–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277
278
279IndexLock* CMP_get_index_lock(thread_db* tdbb, jrd_rel* relation, USHORT id)
280{
281/**************************************
282 *
283 * C M P _ g e t _ i n d e x _ l o c k
284 *
285 **************************************
286 *
287 * Functional description
288 * Get index lock block for index. If one doesn't exist,
289 * make one.
290 *
291 **************************************/
292 SET_TDBB(tdbb);
293 Database* dbb = tdbb->getDatabase();
294
295 DEV_BLKCHK(relation, type_rel);
296
297 if (relation->rel_id < (USHORT) rel_MAX) {
298 return NULL;
299 }
300
301 // for to find an existing block
302
303 for (IndexLock* index = relation->rel_index_locks; index; index = index->idl_next)
304 {
305 if (index->idl_id == id) {
306 return index;
307 }
308 }
309
310 IndexLock* index = FB_NEW_POOL(*relation->rel_pool) IndexLock();
311 index->idl_next = relation->rel_index_locks;
312 relation->rel_index_locks = index;
313 index->idl_relation = relation;
314 index->idl_id = id;
315 index->idl_count = 0;
316
317 Lock* lock = FB_NEW_RPT(*relation->rel_pool, 0) Lock(tdbb, sizeof(SLONG), LCK_idx_exist);
318 index->idl_lock = lock;
319 lock->setKey((relation->rel_id << 16) | id);
320
321 return index;
322}
323
324
325void CMP_post_access(thread_db* tdbb,

Callers 5

StatementMethod · 0.85
releaseMethod · 0.85
IDX_create_indexFunction · 0.85
IDX_delete_indexFunction · 0.85
IDX_delete_indicesFunction · 0.85

Calls 5

SET_TDBBFunction · 0.85
getDatabaseMethod · 0.80
IndexLockClass · 0.70
LockClass · 0.70
setKeyMethod · 0.45

Tested by

no test coverage detected