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

Function evlGetTranCN

src/jrd/SysFunction.cpp:5031–5070  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5029
5030
5031dsc* evlGetTranCN(thread_db* tdbb, const SysFunction* function, const NestValueArray& args,
5032 impure_value* impure)
5033{
5034 fb_assert(args.getCount() == 1);
5035
5036 Database* dbb = tdbb->getDatabase();
5037 Request* request = tdbb->getRequest();
5038
5039 request->req_flags &= ~req_null;
5040 const dsc* value = EVL_expr(tdbb, request, args[0]);
5041 if (request->req_flags & req_null)
5042 return NULL;
5043
5044 TraNumber traNum = MOV_get_int64(tdbb, value, 0);
5045 TraNumber traMax = dbb->dbb_next_transaction;
5046
5047 if ((traNum > traMax) && !(dbb->dbb_flags & DBB_shared))
5048 {
5049 WIN window(HEADER_PAGE_NUMBER);
5050 const Ods::header_page* header = (Ods::header_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_header);
5051 traMax = Ods::getNT(header);
5052 CCH_RELEASE(tdbb, &window);
5053 }
5054
5055 if (traNum > traMax)
5056 {
5057 request->req_flags |= req_null;
5058 return NULL;
5059 }
5060
5061 CommitNumber cn = dbb->dbb_tip_cache->snapshotState(tdbb, traNum);
5062
5063 dsc result;
5064 result.makeInt64(0, (SINT64*)&cn);
5065
5066 EVL_make_value(tdbb, &result, impure);
5067
5068 request->req_flags &= ~req_null;
5069 return &impure->vlu_desc;
5070}
5071
5072
5073dsc* evlHash(thread_db* tdbb, const SysFunction* function, const NestValueArray& args,

Callers

nothing calls this directly

Calls 11

EVL_exprFunction · 0.85
MOV_get_int64Function · 0.85
CCH_FETCHFunction · 0.85
getNTFunction · 0.85
CCH_RELEASEFunction · 0.85
EVL_make_valueFunction · 0.85
getDatabaseMethod · 0.80
snapshotStateMethod · 0.80
makeInt64Method · 0.80
getCountMethod · 0.45
getRequestMethod · 0.45

Tested by

no test coverage detected