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

Function evlQuantize

src/jrd/SysFunction.cpp:5295–5331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5293
5294
5295dsc* evlQuantize(thread_db* tdbb, const SysFunction* function, const NestValueArray& args,
5296 impure_value* impure)
5297{
5298 fb_assert(args.getCount() == 2);
5299
5300 Request* request = tdbb->getRequest();
5301
5302 const dsc* value[2];
5303 value[0] = EVL_expr(tdbb, request, args[0]);
5304 if (request->req_flags & req_null) // return NULL if value is NULL
5305 return NULL;
5306
5307 value[1] = EVL_expr(tdbb, request, args[1]);
5308 if (request->req_flags & req_null) // return NULL if value is NULL
5309 return NULL;
5310
5311 DecimalStatus decSt = tdbb->getAttachment()->att_dec_status;
5312
5313 if (value[0]->dsc_dtype == dtype_dec64)
5314 {
5315 Decimal64 v1 = MOV_get_dec64(tdbb, value[0]);
5316 Decimal64 v2 = MOV_get_dec64(tdbb, value[1]);
5317
5318 impure->vlu_misc.vlu_dec64 = v1.quantize(decSt, v2);
5319 impure->vlu_desc.makeDecimal64(&impure->vlu_misc.vlu_dec64);
5320 }
5321 else
5322 {
5323 Decimal128 v1 = MOV_get_dec128(tdbb, value[0]);
5324 Decimal128 v2 = MOV_get_dec128(tdbb, value[1]);
5325
5326 impure->vlu_misc.vlu_dec128 = v1.quantize(decSt, v2);
5327 impure->vlu_desc.makeDecimal128(&impure->vlu_misc.vlu_dec128);
5328 }
5329
5330 return &impure->vlu_desc;
5331}
5332
5333
5334dsc* evlCompare(thread_db* tdbb, const SysFunction* function, const NestValueArray& args,

Callers

nothing calls this directly

Calls 9

EVL_exprFunction · 0.85
MOV_get_dec64Function · 0.85
MOV_get_dec128Function · 0.85
quantizeMethod · 0.80
makeDecimal64Method · 0.80
makeDecimal128Method · 0.80
getCountMethod · 0.45
getRequestMethod · 0.45
getAttachmentMethod · 0.45

Tested by

no test coverage detected