| 4876 | |
| 4877 | |
| 4878 | dsc* evlSetContext(thread_db* tdbb, const SysFunction*, const NestValueArray& args, |
| 4879 | impure_value* impure) |
| 4880 | { |
| 4881 | fb_assert(args.getCount() == 3); |
| 4882 | |
| 4883 | Jrd::Attachment* attachment = tdbb->getAttachment(); |
| 4884 | jrd_tra* transaction = tdbb->getTransaction(); |
| 4885 | Request* request = tdbb->getRequest(); |
| 4886 | |
| 4887 | request->req_flags &= ~req_null; |
| 4888 | const dsc* nameSpace = EVL_expr(tdbb, request, args[0]); |
| 4889 | if (request->req_flags & req_null) // Complain if namespace is null |
| 4890 | ERR_post(Arg::Gds(isc_ctx_bad_argument) << Arg::Str(RDB_SET_CONTEXT)); |
| 4891 | |
| 4892 | const dsc* name = EVL_expr(tdbb, request, args[1]); |
| 4893 | if (request->req_flags & req_null) // Complain if variable name is null |
| 4894 | ERR_post(Arg::Gds(isc_ctx_bad_argument) << Arg::Str(RDB_SET_CONTEXT)); |
| 4895 | |
| 4896 | const dsc* value = EVL_expr(tdbb, request, args[2]); |
| 4897 | |
| 4898 | const string nameSpaceStr(MOV_make_string2(tdbb, nameSpace, ttype_none)); |
| 4899 | const string nameStr(MOV_make_string2(tdbb, name, ttype_none)); |
| 4900 | |
| 4901 | impure->vlu_desc.makeLong(0, &impure->vlu_misc.vlu_long); |
| 4902 | |
| 4903 | StringMap* contextVars = NULL; |
| 4904 | |
| 4905 | if (nameSpaceStr == USER_SESSION_NAMESPACE) |
| 4906 | { |
| 4907 | if (!attachment) |
| 4908 | { |
| 4909 | fb_assert(false); |
| 4910 | return 0; |
| 4911 | } |
| 4912 | |
| 4913 | contextVars = &attachment->att_context_vars; |
| 4914 | } |
| 4915 | else if (nameSpaceStr == USER_TRANSACTION_NAMESPACE) |
| 4916 | { |
| 4917 | if (!transaction) |
| 4918 | { |
| 4919 | fb_assert(false); |
| 4920 | return 0; |
| 4921 | } |
| 4922 | |
| 4923 | contextVars = &transaction->tra_context_vars; |
| 4924 | } |
| 4925 | else |
| 4926 | { |
| 4927 | // "Invalid namespace name %s passed to %s" |
| 4928 | ERR_post(Arg::Gds(isc_ctx_namespace_invalid) << |
| 4929 | Arg::Str(nameSpaceStr) << Arg::Str(RDB_SET_CONTEXT)); |
| 4930 | } |
| 4931 | |
| 4932 | string valueStr; |
| 4933 | |
| 4934 | if (!value) |
| 4935 | impure->vlu_misc.vlu_long = (SLONG) contextVars->remove(nameStr); |
nothing calls this directly
no test coverage detected