| 5029 | |
| 5030 | |
| 5031 | dsc* 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 | |
| 5073 | dsc* evlHash(thread_db* tdbb, const SysFunction* function, const NestValueArray& args, |
nothing calls this directly
no test coverage detected