| 5660 | |
| 5661 | |
| 5662 | dsc* evlOverlay(thread_db* tdbb, const SysFunction* function, const NestValueArray& args, |
| 5663 | impure_value* impure) |
| 5664 | { |
| 5665 | fb_assert(args.getCount() >= 3); |
| 5666 | |
| 5667 | Request* request = tdbb->getRequest(); |
| 5668 | |
| 5669 | const dsc* value = EVL_expr(tdbb, request, args[0]); |
| 5670 | if (request->req_flags & req_null) // return NULL if value is NULL |
| 5671 | return NULL; |
| 5672 | |
| 5673 | const dsc* placing = EVL_expr(tdbb, request, args[1]); |
| 5674 | if (request->req_flags & req_null) // return NULL if placing is NULL |
| 5675 | return NULL; |
| 5676 | |
| 5677 | const dsc* fromDsc = EVL_expr(tdbb, request, args[2]); |
| 5678 | if (request->req_flags & req_null) // return NULL if fromDsc is NULL |
| 5679 | return NULL; |
| 5680 | |
| 5681 | const dsc* lengthDsc = NULL; |
| 5682 | ULONG length = 0; |
| 5683 | |
| 5684 | if (args.getCount() >= 4) |
| 5685 | { |
| 5686 | lengthDsc = EVL_expr(tdbb, request, args[3]); |
| 5687 | if (request->req_flags & req_null) // return NULL if lengthDsc is NULL |
| 5688 | return NULL; |
| 5689 | |
| 5690 | const SLONG auxlen = MOV_get_long(tdbb, lengthDsc, 0); |
| 5691 | |
| 5692 | if (auxlen < 0) |
| 5693 | { |
| 5694 | status_exception::raise(Arg::Gds(isc_expression_eval_err) << |
| 5695 | Arg::Gds(isc_sysf_argnmustbe_nonneg) << |
| 5696 | Arg::Num(4) << |
| 5697 | Arg::Str(function->name)); |
| 5698 | } |
| 5699 | |
| 5700 | length = auxlen; |
| 5701 | } |
| 5702 | |
| 5703 | SLONG from = MOV_get_long(tdbb, fromDsc, 0); |
| 5704 | |
| 5705 | if (from <= 0) |
| 5706 | { |
| 5707 | status_exception::raise(Arg::Gds(isc_expression_eval_err) << |
| 5708 | Arg::Gds(isc_sysf_argnmustbe_positive) << |
| 5709 | Arg::Num(3) << |
| 5710 | Arg::Str(function->name)); |
| 5711 | } |
| 5712 | |
| 5713 | const USHORT resultTextType = DataTypeUtil::getResultTextType(value, placing); |
| 5714 | CharSet* cs = INTL_charset_lookup(tdbb, resultTextType); |
| 5715 | |
| 5716 | MoveBuffer temp1; |
| 5717 | UCHAR* str1; |
| 5718 | ULONG len1; |
| 5719 |
nothing calls this directly
no test coverage detected