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

Function TRA_start

src/jrd/tra.cpp:1697–1751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1695
1696
1697jrd_tra* TRA_start(thread_db* tdbb, ULONG flags, SSHORT lock_timeout, Jrd::jrd_tra* outer)
1698{
1699/**************************************
1700 *
1701 * T R A _ s t a r t
1702 *
1703 **************************************
1704 *
1705 * Functional description
1706 * Start a user transaction.
1707 *
1708 **************************************/
1709 SET_TDBB(tdbb);
1710 Database* const dbb = tdbb->getDatabase();
1711 Jrd::Attachment* const attachment = tdbb->getAttachment();
1712
1713 // Starting new transactions should be allowed for threads which
1714 // are running purge_attachment() because it's needed for
1715 // ON DISCONNECT triggers
1716 if (dbb->dbb_ast_flags & DBB_shut_tran &&
1717 attachment->att_purge_tid != Thread::getCurrentThreadId())
1718 {
1719 ERR_post(Arg::Gds(isc_shutinprog) << Arg::Str(attachment->att_filename));
1720 }
1721
1722 // To handle the problems of relation locks, allocate a temporary
1723 // transaction block first, seize relation locks, then go ahead and
1724 // make up the real transaction block.
1725 MemoryPool* const pool = outer ? outer->getAutonomousPool() : attachment->createPool();
1726 Jrd::ContextPoolHolder context(tdbb, pool);
1727 jrd_tra* const transaction = jrd_tra::create(pool, attachment, outer);
1728
1729 transaction->tra_flags = flags & TRA_OPTIONS_MASK;
1730 transaction->tra_lock_timeout = lock_timeout;
1731
1732 try
1733 {
1734 transaction_start(tdbb, transaction);
1735 }
1736 catch (const Exception&)
1737 {
1738 jrd_tra::destroy(attachment, transaction);
1739 throw;
1740 }
1741
1742 if (attachment->att_trace_manager->needs(ITraceFactory::TRACE_EVENT_TRANSACTION_START))
1743 {
1744 TraceConnectionImpl conn(attachment);
1745 TraceTransactionImpl tran(transaction);
1746 attachment->att_trace_manager->event_transaction_start(&conn,
1747 &tran, 0, NULL, ITracePlugin::RESULT_SUCCESS);
1748 }
1749
1750 return transaction;
1751}
1752
1753
1754jrd_tra* TRA_start(thread_db* tdbb, int tpb_length, const UCHAR* tpb, Jrd::jrd_tra* outer)

Callers 12

executeMethod · 0.85
internalAttachMethod · 0.85
purge_attachmentFunction · 0.85
start_transactionFunction · 0.85
initMethod · 0.85
garbage_collectorMethod · 0.85
startMethod · 0.85
runDBTriggersFunction · 0.85
resetSessionMethod · 0.85
TRA_sweepFunction · 0.85
initMethod · 0.85
startTransactionMethod · 0.85

Calls 14

SET_TDBBFunction · 0.85
GdsClass · 0.85
StrClass · 0.85
createFunction · 0.85
transaction_startFunction · 0.85
transaction_optionsFunction · 0.85
getDatabaseMethod · 0.80
getAutonomousPoolMethod · 0.80
needsMethod · 0.80
ERR_postFunction · 0.70
destroyFunction · 0.50

Tested by

no test coverage detected