@@ -4032,32 +4032,32 @@ TableValueFunctionSourceNode* TableValueFunctionSourceNode::parse(thread_db* tdb
4032
4032
MemoryPool& pool = *tdbb->getDefaultPool ();
4033
4033
4034
4034
const auto funcId = csb->csb_blr_reader .getByte ();
4035
- auto node = TableValueFunctionSourceNode::parseTableValueFunctions (tdbb, csb, funcId);
4035
+ const auto node = TableValueFunctionSourceNode::parseFunction (tdbb, csb, funcId);
4036
4036
4037
4037
node->stream = PAR_context (csb, nullptr );
4038
4038
4039
4039
CompilerScratch::csb_repeat& element = csb->csb_rpt [node->stream ];
4040
- auto tableValueFunctionCsb = node->m_csbTableValueFun = FB_NEW_POOL (pool) jrd_table_value_fun (pool);
4040
+ const auto tableValueFunctionCsb = node->m_csbTableValueFun = FB_NEW_POOL (pool) jrd_table_value_fun (pool);
4041
4041
4042
4042
tableValueFunctionCsb->funcId = funcId;
4043
+ tableValueFunctionCsb->name = node->getName ();
4043
4044
4044
- string aliasString;
4045
- csb->csb_blr_reader .getString (aliasString);
4046
- if (aliasString.hasData ())
4047
- node->alias = aliasString;
4045
+ AutoPtr<string> aliasString (FB_NEW_POOL (csb->csb_pool ) string (csb->csb_pool ));
4046
+ csb->csb_blr_reader .getString (*aliasString);
4047
+
4048
+ if (aliasString->hasData ())
4049
+ node->alias = *aliasString;
4048
4050
else
4049
4051
fb_assert (false );
4050
4052
4051
- tableValueFunctionCsb->name = aliasString;
4052
-
4053
4053
auto count = csb->csb_blr_reader .getWord ();
4054
4054
node->inputList = FB_NEW_POOL (pool) ValueListNode (pool, 0U );
4055
4055
while (count--)
4056
4056
node->inputList ->add (PAR_parse_value (tdbb, csb));
4057
4057
4058
4058
count = csb->csb_blr_reader .getWord ();
4059
4059
4060
- auto recordFormat = Format::newFormat (pool, count);
4060
+ const auto recordFormat = Format::newFormat (pool, count);
4061
4061
ULONG& offset = recordFormat->fmt_length = FLAG_BYTES (recordFormat->fmt_count );
4062
4062
Format::fmt_desc_iterator descIt = recordFormat->fmt_desc .begin ();
4063
4063
SSHORT fieldId = 0 ;
@@ -4081,16 +4081,18 @@ TableValueFunctionSourceNode* TableValueFunctionSourceNode::parse(thread_db* tdb
4081
4081
4082
4082
element.csb_format = tableValueFunctionCsb->recordFormat = recordFormat;
4083
4083
element.csb_table_value_fun = tableValueFunctionCsb;
4084
+ element.csb_alias = aliasString.release ();
4084
4085
4085
4086
return node;
4086
4087
}
4087
4088
4088
- TableValueFunctionSourceNode* TableValueFunctionSourceNode::parseTableValueFunctions (thread_db* tdbb,
4089
- CompilerScratch* csb,
4090
- const SSHORT blrOp)
4089
+ TableValueFunctionSourceNode* TableValueFunctionSourceNode::parseFunction (thread_db* tdbb,
4090
+ CompilerScratch* csb,
4091
+ const SSHORT blrOp)
4091
4092
{
4092
4093
MemoryPool& pool = *tdbb->getDefaultPool ();
4093
4094
TableValueFunctionSourceNode* node = nullptr ;
4095
+
4094
4096
switch (blrOp)
4095
4097
{
4096
4098
case blr_table_value_fun_unlist:
@@ -4145,7 +4147,7 @@ void TableValueFunctionSourceNode::genBlr(DsqlCompilerScratch* dsqlScratch)
4145
4147
{
4146
4148
dsqlScratch->appendUChar (blr_table_value_fun);
4147
4149
4148
- auto tableValueFunctionContext = dsqlContext->ctx_table_value_fun ;
4150
+ const auto tableValueFunctionContext = dsqlContext->ctx_table_value_fun ;
4149
4151
4150
4152
if (tableValueFunctionContext->funName == UnlistFunctionSourceNode::FUNC_NAME)
4151
4153
dsqlScratch->appendUChar (blr_table_value_fun_unlist);
@@ -4182,17 +4184,17 @@ TableValueFunctionSourceNode* TableValueFunctionSourceNode::copy(thread_db* tdbb
4182
4184
4183
4185
MemoryPool& pool = *tdbb->getDefaultPool ();
4184
4186
4185
- auto newStream = copier.csb ->nextStream ();
4187
+ const auto newStream = copier.csb ->nextStream ();
4186
4188
copier.remap [stream] = newStream;
4187
4189
4188
- auto element = CMP_csb_element (copier.csb , newStream);
4190
+ const auto element = CMP_csb_element (copier.csb , newStream);
4189
4191
element->csb_view_stream = copier.remap [0 ];
4190
4192
element->csb_format = m_csbTableValueFun->recordFormat ;
4191
4193
element->csb_table_value_fun = m_csbTableValueFun;
4192
4194
if (alias.hasData ())
4193
4195
element->csb_alias = FB_NEW_POOL (pool) string (pool, alias.c_str ());
4194
4196
4195
- auto newSource = TableValueFunctionSourceNode::parseTableValueFunctions (
4197
+ const auto newSource = TableValueFunctionSourceNode::parseFunction (
4196
4198
tdbb, copier.csb , m_csbTableValueFun->funcId );
4197
4199
4198
4200
newSource->inputList = copier.copy (tdbb, inputList);
@@ -4213,7 +4215,7 @@ void TableValueFunctionSourceNode::pass1Source(thread_db* tdbb, CompilerScratch*
4213
4215
jrd_rel* const parentView = csb->csb_view ;
4214
4216
const StreamType viewStream = csb->csb_view_stream ;
4215
4217
4216
- auto element = CMP_csb_element (csb, stream);
4218
+ const auto element = CMP_csb_element (csb, stream);
4217
4219
element->csb_view = parentView;
4218
4220
element->csb_view_stream = viewStream;
4219
4221
@@ -4291,7 +4293,7 @@ void TableValueFunctionSourceNode::setDefaultNameField(DsqlCompilerScratch* /*ds
4291
4293
{
4292
4294
if (const auto tableValueFunctionContext = dsqlContext->ctx_table_value_fun )
4293
4295
{
4294
- MetaName nameFunc = tableValueFunctionContext->funName ;
4296
+ const auto nameFunc = tableValueFunctionContext->funName ;
4295
4297
4296
4298
auto i = 0U ;
4297
4299
@@ -4313,9 +4315,9 @@ RecordSource* UnlistFunctionSourceNode::compile(thread_db* tdbb, Optimizer* opt,
4313
4315
{
4314
4316
MemoryPool& pool = *tdbb->getDefaultPool ();
4315
4317
const auto csb = opt->getCompilerScratch ();
4316
- auto aliasOpt = opt->makeAlias (stream);
4318
+ const auto alias = opt->makeAlias (stream);
4317
4319
4318
- return FB_NEW_POOL (pool) UnlistFunctionScan (csb, stream, aliasOpt , inputList);
4320
+ return FB_NEW_POOL (pool) UnlistFunctionScan (csb, stream, alias , inputList);
4319
4321
}
4320
4322
4321
4323
dsql_fld* UnlistFunctionSourceNode::makeField (DsqlCompilerScratch* dsqlScratch)
0 commit comments