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

Function LCK_convert

src/jrd/lck.cpp:319–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317
318
319bool LCK_convert(thread_db* tdbb, Lock* lock, USHORT level, SSHORT wait)
320{
321/**************************************
322 *
323 * L C K _ c o n v e r t
324 *
325 **************************************
326 *
327 * Functional description
328 * Convert an existing lock to a new level.
329 *
330 **************************************/
331 SET_TDBB(tdbb);
332 fb_assert(LCK_CHECK_LOCK(lock));
333
334#ifdef DEBUG_LCK
335 LckSync sync(lock, "LCK_convert");
336#endif
337
338 Database* dbb = lock->lck_dbb;
339
340 Jrd::Attachment* const old_attachment = lock->getLockAttachment();
341 lock->setLockAttachment(tdbb->getAttachment());
342
343 WaitCancelGuard guard(tdbb, lock, wait);
344 FbLocalStatus statusVector;
345
346 const bool result = CONVERT(tdbb, &statusVector, lock, level, wait);
347
348 if (!result)
349 {
350 lock->setLockAttachment(old_attachment);
351
352 switch (statusVector[1])
353 {
354 case isc_deadlock:
355 case isc_lock_conflict:
356 case isc_lock_timeout:
357 statusVector.copyTo(tdbb->tdbb_status_vector);
358 tdbb->checkCancelState();
359 return false;
360 case isc_lockmanerr:
361 dbb->dbb_flags |= DBB_bugcheck;
362 break;
363 }
364
365 statusVector.raise();
366 }
367
368 if (!lock->lck_compatible)
369 lock->lck_physical = lock->lck_logical = level;
370
371 fb_assert(LCK_CHECK_LOCK(lock));
372 return true;
373}
374
375
376bool LCK_convert_opt(thread_db* tdbb, Lock* lock, USHORT level)

Callers 15

putStatementMethod · 0.85
purgeMethod · 0.85
releaseMethod · 0.85
lockAndReadHeaderMethod · 0.85
changeCryptStateMethod · 0.85
doOnAstMethod · 0.85
unloadCollationMethod · 0.85
finalizeTpcMethod · 0.85
initializeTpcMethod · 0.85
StatusBlockDataMethod · 0.85
clearMethod · 0.85
CCH_down_grade_dbbFunction · 0.85

Calls 8

SET_TDBBFunction · 0.85
CONVERTFunction · 0.85
getLockAttachmentMethod · 0.80
setLockAttachmentMethod · 0.80
checkCancelStateMethod · 0.80
getAttachmentMethod · 0.45
copyToMethod · 0.45
raiseMethod · 0.45

Tested by

no test coverage detected