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

Function evlResetContext

src/jrd/SysFunction.cpp:4979–5028  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4977
4978
4979dsc* evlResetContext(thread_db* tdbb, const SysFunction* function, const NestValueArray& args, impure_value* impure)
4980{
4981 fb_assert(args.getCount() == 1);
4982
4983 Attachment* const attachment = tdbb->getAttachment();
4984 jrd_tra* const transaction = tdbb->getTransaction();
4985 Request* request = tdbb->getRequest();
4986
4987 const dsc* nameSpace = EVL_expr(tdbb, request, args[0]);
4988 if (!nameSpace) // Complain if namespace is null
4989 ERR_post(Arg::Gds(isc_ctx_bad_argument) << Arg::Str(RDB_RESET_CONTEXT));
4990
4991 const string nameSpaceStr(MOV_make_string2(tdbb, nameSpace, ttype_none));
4992
4993 StringMap* contextVars = nullptr;
4994
4995 if (nameSpaceStr == USER_SESSION_NAMESPACE)
4996 {
4997 if (!attachment)
4998 {
4999 fb_assert(false);
5000 return nullptr;
5001 }
5002
5003 contextVars = &attachment->att_context_vars;
5004 }
5005 else if (nameSpaceStr == USER_TRANSACTION_NAMESPACE)
5006 {
5007 if (!transaction)
5008 {
5009 fb_assert(false);
5010 return nullptr;
5011 }
5012
5013 contextVars = &transaction->tra_context_vars;
5014 }
5015 else
5016 {
5017 // "Invalid namespace name %s passed to %s"
5018 ERR_post(Arg::Gds(isc_ctx_namespace_invalid) <<
5019 Arg::Str(nameSpaceStr) << Arg::Str(RDB_RESET_CONTEXT));
5020 }
5021
5022 impure->vlu_desc.makeLong(0, &impure->vlu_misc.vlu_long);
5023 impure->vlu_misc.vlu_long = (SLONG) contextVars->count();
5024
5025 contextVars->clear();
5026
5027 return &impure->vlu_desc;
5028}
5029
5030
5031dsc* evlGetTranCN(thread_db* tdbb, const SysFunction* function, const NestValueArray& args,

Callers

nothing calls this directly

Calls 12

EVL_exprFunction · 0.85
GdsClass · 0.85
StrClass · 0.85
MOV_make_string2Function · 0.85
makeLongMethod · 0.80
ERR_postFunction · 0.70
getCountMethod · 0.45
getAttachmentMethod · 0.45
getTransactionMethod · 0.45
getRequestMethod · 0.45
countMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected