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

Function evlCompare

src/jrd/SysFunction.cpp:5334–5387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5332
5333
5334dsc* evlCompare(thread_db* tdbb, const SysFunction* function, const NestValueArray& args,
5335 impure_value* impure)
5336{
5337 fb_assert(args.getCount() == 2);
5338
5339 Request* request = tdbb->getRequest();
5340
5341 const dsc* value[2];
5342 value[0] = EVL_expr(tdbb, request, args[0]);
5343 if (request->req_flags & req_null) // return NULL if value is NULL
5344 return NULL;
5345
5346 value[1] = EVL_expr(tdbb, request, args[1]);
5347 if (request->req_flags & req_null) // return NULL if value is NULL
5348 return NULL;
5349
5350 if (value[0]->dsc_dtype == dtype_dec64)
5351 {
5352 Decimal64 v1 = MOV_get_dec64(tdbb, value[0]);
5353 Decimal64 v2 = MOV_get_dec64(tdbb, value[1]);
5354
5355 switch ((Function)(IPTR) function->misc)
5356 {
5357 case funTotalOrd:
5358 impure->vlu_misc.vlu_short = v1.totalOrder(v2);
5359 break;
5360 case funCmpDec:
5361 impure->vlu_misc.vlu_short = v1.decCompare(v2);
5362 break;
5363 default:
5364 fb_assert(false);
5365 }
5366 }
5367 else
5368 {
5369 Decimal128 v1 = MOV_get_dec128(tdbb, value[0]);
5370 Decimal128 v2 = MOV_get_dec128(tdbb, value[1]);
5371
5372 switch ((Function)(IPTR) function->misc)
5373 {
5374 case funTotalOrd:
5375 impure->vlu_misc.vlu_short = v1.totalOrder(v2);
5376 break;
5377 case funCmpDec:
5378 impure->vlu_misc.vlu_short = v1.decCompare(v2);
5379 break;
5380 default:
5381 fb_assert(false);
5382 }
5383 }
5384
5385 impure->vlu_desc.makeShort(0, &impure->vlu_misc.vlu_short);
5386 return &impure->vlu_desc;
5387}
5388
5389
5390dsc* evlNormDec(thread_db* tdbb, const SysFunction* function, const NestValueArray& args,

Callers

nothing calls this directly

Calls 8

EVL_exprFunction · 0.85
MOV_get_dec64Function · 0.85
MOV_get_dec128Function · 0.85
totalOrderMethod · 0.80
decCompareMethod · 0.80
makeShortMethod · 0.80
getCountMethod · 0.45
getRequestMethod · 0.45

Tested by

no test coverage detected