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

Function TRA_post_resources

src/jrd/tra.cpp:951–1010  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

949
950
951void TRA_post_resources(thread_db* tdbb, jrd_tra* transaction, ResourceList& resources)
952{
953/**************************************
954 *
955 * T R A _ p o s t _ r e s o u r c e s
956 *
957 **************************************
958 *
959 * Functional description
960 * Post interest in relation/procedure/collation existence to transaction.
961 * This guarantees that the relation/procedure/collation won't be dropped
962 * out from under the transaction.
963 *
964 **************************************/
965 SET_TDBB(tdbb);
966
967 Jrd::ContextPoolHolder context(tdbb, transaction->tra_pool);
968
969 for (Resource* rsc = resources.begin(); rsc < resources.end(); rsc++)
970 {
971 if (rsc->rsc_type == Resource::rsc_relation ||
972 rsc->rsc_type == Resource::rsc_procedure ||
973 rsc->rsc_type == Resource::rsc_function ||
974 rsc->rsc_type == Resource::rsc_collation)
975 {
976 FB_SIZE_T i;
977 if (!transaction->tra_resources.find(*rsc, i))
978 {
979 transaction->tra_resources.insert(i, *rsc);
980 switch (rsc->rsc_type)
981 {
982 case Resource::rsc_relation:
983 MET_post_existence(tdbb, rsc->rsc_rel);
984 if (rsc->rsc_rel->rel_file) {
985 EXT_tra_attach(rsc->rsc_rel->rel_file, transaction);
986 }
987 break;
988 case Resource::rsc_procedure:
989 case Resource::rsc_function:
990 rsc->rsc_routine->addRef();
991#ifdef DEBUG_PROCS
992 {
993 char buffer[256];
994 sprintf(buffer,
995 "Called from TRA_post_resources():\n\t Incrementing use count of %s\n",
996 rsc->rsc_routine->prc_name->c_str());
997 JRD_print_procedure_info(tdbb, buffer);
998 }
999#endif
1000 break;
1001 case Resource::rsc_collation:
1002 rsc->rsc_coll->incUseCount(tdbb);
1003 break;
1004 default: // shut up compiler warning
1005 break;
1006 }
1007 }
1008 }

Callers 1

EXE_startFunction · 0.85

Calls 10

SET_TDBBFunction · 0.85
EXT_tra_attachFunction · 0.85
JRD_print_procedure_infoFunction · 0.85
incUseCountMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45
insertMethod · 0.45
addRefMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected