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

Function evlAsciiVal

src/jrd/SysFunction.cpp:2147–2179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2145
2146
2147dsc* evlAsciiVal(thread_db* tdbb, const SysFunction*, const NestValueArray& args,
2148 impure_value* impure)
2149{
2150 fb_assert(args.getCount() == 1);
2151
2152 Request* request = tdbb->getRequest();
2153
2154 const dsc* value = EVL_expr(tdbb, request, args[0]);
2155 if (request->req_flags & req_null) // return NULL if value is NULL
2156 return NULL;
2157
2158 const CharSet* cs = INTL_charset_lookup(tdbb, value->getCharSet());
2159
2160 UCHAR* p;
2161 MoveBuffer temp;
2162 int length = MOV_make_string2(tdbb, value, value->getCharSet(), &p, temp);
2163
2164 if (length == 0)
2165 impure->vlu_misc.vlu_short = 0;
2166 else
2167 {
2168 UCHAR dummy[4];
2169
2170 if (cs->substring(length, p, sizeof(dummy), dummy, 0, 1) != 1)
2171 status_exception::raise(Arg::Gds(isc_arith_except) << Arg::Gds(isc_transliteration_failed));
2172
2173 impure->vlu_misc.vlu_short = p[0];
2174 }
2175
2176 impure->vlu_desc.makeShort(0, &impure->vlu_misc.vlu_short);
2177
2178 return &impure->vlu_desc;
2179}
2180
2181
2182dsc* evlAtan2(thread_db* tdbb, const SysFunction* function, const NestValueArray& args,

Callers

nothing calls this directly

Calls 10

EVL_exprFunction · 0.85
INTL_charset_lookupFunction · 0.85
MOV_make_string2Function · 0.85
raiseFunction · 0.85
GdsClass · 0.85
substringMethod · 0.80
makeShortMethod · 0.80
getCountMethod · 0.45
getRequestMethod · 0.45
getCharSetMethod · 0.45

Tested by

no test coverage detected