8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 04:43:03 +01:00

Fixed bug CORE-4144 : Error "context already in use (BLR error)" when preparing a query with UNION

This commit is contained in:
hvlad 2013-07-22 08:29:01 +00:00
parent fef0c8f6f8
commit 01a6f1a6d0

View File

@ -1662,7 +1662,19 @@ void UnionSourceNode::genBlr(DsqlCompilerScratch* dsqlScratch)
if (derivedField)
mapItem = derivedField->value;
dsql_ctx* dsqlContext = mapItem->as<DsqlMapNode>()->context;
if (mapItem->is<CastNode>())
mapItem = mapItem->as<CastNode>()->source;
DsqlMapNode* mapNode = mapItem->as<DsqlMapNode>();
fb_assert(mapNode);
if (!mapNode) {
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
Arg::Gds(isc_dsql_internal_err) <<
Arg::Gds(isc_random) << Arg::Str("UnionSourceNode::genBlr: expected DsqlMapNode") );
}
dsql_ctx* dsqlContext = mapNode->context;
GEN_stuff_context(dsqlScratch, dsqlContext);
// secondary context number must be present once in generated blr