mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 20:43:02 +01:00
Fixed CORE-5314 - UDFs declared with large varchars take excessive time to execute.
This commit is contained in:
parent
dc0f09ee08
commit
6c2e26cbbd
@ -11260,7 +11260,7 @@ ValueExprNode* UdfCallNode::pass2(thread_db* tdbb, CompilerScratch* csb)
|
||||
dsc desc;
|
||||
getDesc(tdbb, csb, &desc);
|
||||
|
||||
impureOffset = CMP_impure(csb, sizeof(impure_value));
|
||||
impureOffset = CMP_impure(csb, sizeof(Impure));
|
||||
|
||||
if (function->isDefined() && !function->fun_entrypoint)
|
||||
{
|
||||
@ -11282,7 +11282,8 @@ ValueExprNode* UdfCallNode::pass2(thread_db* tdbb, CompilerScratch* csb)
|
||||
dsc* UdfCallNode::execute(thread_db* tdbb, jrd_req* request) const
|
||||
{
|
||||
UCHAR* impure = request->getImpure<UCHAR>(impureOffset);
|
||||
impure_value* value = request->getImpure<impure_value>(impureOffset);
|
||||
Impure* impureArea = request->getImpure<Impure>(impureOffset);
|
||||
impure_value* value = &impureArea->value;
|
||||
|
||||
USHORT& invariantFlags = value->vlu_flags;
|
||||
|
||||
@ -11347,7 +11348,13 @@ dsc* UdfCallNode::execute(thread_db* tdbb, jrd_req* request) const
|
||||
else
|
||||
value->vlu_desc.dsc_address = (UCHAR*) &value->vlu_misc;
|
||||
|
||||
FUN_evaluate(tdbb, function, args->items, value);
|
||||
if (!impureArea->temp)
|
||||
{
|
||||
impureArea->temp =
|
||||
FB_NEW_POOL(*tdbb->getDefaultPool()) Array<UCHAR>(*tdbb->getDefaultPool());
|
||||
}
|
||||
|
||||
FUN_evaluate(tdbb, function, args->items, value, *impureArea->temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1681,6 +1681,13 @@ public:
|
||||
|
||||
class UdfCallNode : public TypedNode<ValueExprNode, ExprNode::TYPE_UDF_CALL>
|
||||
{
|
||||
private:
|
||||
struct Impure
|
||||
{
|
||||
impure_value value; // must be first
|
||||
Firebird::Array<UCHAR>* temp;
|
||||
};
|
||||
|
||||
public:
|
||||
explicit UdfCallNode(MemoryPool& pool, const Firebird::QualifiedName& aName,
|
||||
ValueListNode* aArgs = NULL);
|
||||
|
@ -303,7 +303,7 @@ static bool private_move(Jrd::thread_db* tdbb, dsc* from, dsc* to);
|
||||
|
||||
|
||||
void FUN_evaluate(thread_db* tdbb, const Function* function, const NestValueArray& node,
|
||||
impure_value* value)
|
||||
impure_value* value, Array<UCHAR>& temp)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -370,7 +370,6 @@ void FUN_evaluate(thread_db* tdbb, const Function* function, const NestValueArra
|
||||
try {
|
||||
|
||||
UDF_ARG args[MAX_UDF_ARGUMENTS + 1];
|
||||
HalfStaticArray<UCHAR, 800> temp;
|
||||
|
||||
// Start by constructing argument list
|
||||
UCHAR* temp_ptr = temp.getBuffer(function->fun_temp_length + FB_DOUBLE_ALIGN);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
};
|
||||
|
||||
void FUN_evaluate(Jrd::thread_db*, const Jrd::Function*, const Jrd::NestValueArray&,
|
||||
Jrd::impure_value*);
|
||||
Jrd::impure_value*, Firebird::Array<UCHAR>& temp);
|
||||
|
||||
|
||||
#endif // JRD_FUN_PROTO_H
|
||||
|
Loading…
Reference in New Issue
Block a user