From 975638783a1e6a4165a009eab651a1c1ffbb4298 Mon Sep 17 00:00:00 2001 From: arnobrinkman Date: Wed, 16 Apr 2003 22:49:41 +0000 Subject: [PATCH] bugfix: Parameters from stored procedures in a sub-select where not remaped to the good context in a aggregate query. example: SELECT (SELECT sp.x FROM SP_TEST(T1.ID) sp) FROM Table1 T1 GROUP BY T1.ID --- src/dsql/pass1.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/dsql/pass1.cpp b/src/dsql/pass1.cpp index 8cbd0e56d4..50740c4a58 100644 --- a/src/dsql/pass1.cpp +++ b/src/dsql/pass1.cpp @@ -5249,7 +5249,7 @@ static DSQL_NOD post_map( DSQL_NOD node, DSQL_CTX context) static DSQL_NOD remap_field(DSQL_REQ request, DSQL_NOD field, DSQL_CTX context, USHORT current_level) { DSQL_NOD *ptr, *end; - DSQL_CTX lcontext; + DSQL_CTX lcontext, lrelation_context; MAP lmap; USHORT ldeepest_level, lcurrent_level; @@ -5393,6 +5393,18 @@ static DSQL_NOD remap_field(DSQL_REQ request, DSQL_NOD field, DSQL_CTX context, field->nod_arg[1] = remap_field(request, field->nod_arg[1], context, current_level); } return field; + + case nod_relation: + lrelation_context = reinterpret_cast(field->nod_arg[e_rel_context]); + // Check if relation is a procedure + if (lrelation_context->ctx_procedure) { + // If input parameters exists remap those + if (lrelation_context->ctx_proc_inputs) { + lrelation_context->ctx_proc_inputs = + remap_field(request, lrelation_context->ctx_proc_inputs, context, current_level); + } + } + return field; default: return field;