From 55c88a21b5911ad5eb0dbd6bab2f6c3b5edc6483 Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Mon, 18 Sep 2017 17:23:05 +0000 Subject: [PATCH] Process nodes using the scratch pool as default pool. To make it work, change MAKE_parameter to allocate parameters in the message pool (statement pool). --- src/dsql/dsql.cpp | 6 ++++-- src/dsql/make.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dsql/dsql.cpp b/src/dsql/dsql.cpp index 958d764619..24729dcaa1 100644 --- a/src/dsql/dsql.cpp +++ b/src/dsql/dsql.cpp @@ -589,7 +589,10 @@ void DSQL_execute_immediate(thread_db* tdbb, Jrd::Attachment* attachment, jrd_tr void DsqlDmlRequest::dsqlPass(thread_db* tdbb, DsqlCompilerScratch* scratch, ntrace_result_t* traceResult) { - node = Node::doDsqlPass(scratch, node); + { // scope + Jrd::ContextPoolHolder scratchContext(tdbb, &scratch->getPool()); + node = Node::doDsqlPass(scratch, node); + } if (scratch->clientDialect > SQL_DIALECT_V5) scratch->getStatement()->setBlrVersion(5); @@ -1484,7 +1487,6 @@ static dsql_req* prepareStatement(thread_db* tdbb, dsql_dbb* database, jrd_tra* ntrace_result_t traceResult = ITracePlugin::RESULT_SUCCESS; try { - ///Jrd::ContextPoolHolder scratchContext(tdbb, scratchPool); // scope request->dsqlPass(tdbb, scratch, &traceResult); } catch (const Exception&) diff --git a/src/dsql/make.cpp b/src/dsql/make.cpp index 919ac088d5..9c03ded99e 100644 --- a/src/dsql/make.cpp +++ b/src/dsql/make.cpp @@ -412,7 +412,7 @@ dsql_par* MAKE_parameter(dsql_msg* message, bool sqlda_flag, bool null_flag, thread_db* tdbb = JRD_get_thread_data(); - dsql_par* parameter = FB_NEW_POOL(*tdbb->getDefaultPool()) dsql_par(*tdbb->getDefaultPool()); + dsql_par* parameter = FB_NEW_POOL(message->getPool()) dsql_par(message->getPool()); parameter->par_message = message; message->msg_parameters.insert(0, parameter); parameter->par_parameter = message->msg_parameter++;