From 93b35c7cc75c269395e5aa549accced85ad4e3ae Mon Sep 17 00:00:00 2001 From: asfernandes Date: Tue, 6 Jan 2015 22:40:20 +0000 Subject: [PATCH] Fixed problem with subfunction parameters related to CORE-4572. --- src/dsql/StmtNodes.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/dsql/StmtNodes.cpp b/src/dsql/StmtNodes.cpp index ff01ea1378..dcdd4c0c7b 100644 --- a/src/dsql/StmtNodes.cpp +++ b/src/dsql/StmtNodes.cpp @@ -1471,17 +1471,23 @@ DeclareSubFuncNode* DeclareSubFuncNode::dsqlPass(DsqlCompilerScratch* dsqlScratc dsqlFunction->udf_length = returnType->length; dsqlFunction->udf_character_set_id = returnType->charSetId; - // ASF: It seems not required to set dsqlFunction->udf_arguments for now. - const Array >& paramArray = dsqlBlock->parameters; bool defaultFound = false; for (const NestConst* i = paramArray.begin(); i != paramArray.end(); ++i) { + // ASF: dsqlFunction->udf_arguments is only checked for its count for now. + dsqlFunction->udf_arguments.add(dsc()); + const ParameterClause* param = *i; if (param->defaultClause) + { defaultFound = true; + + if (dsqlFunction->udf_def_count == 0) + dsqlFunction->udf_def_count = paramArray.end() - i; + } else if (defaultFound) { // Parameter without default value after parameters with default.