Skip to content

Commit cb53751

Browse files
committed
Fix problem with DLTT and blobs - thanks Pavel Zotov
1 parent 384586c commit cb53751

4 files changed

Lines changed: 19 additions & 2 deletions

File tree

src/dsql/StmtNodes.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9119,6 +9119,10 @@ const StmtNode* ModifyNode::modify(thread_db* tdbb, Request* request, WhichTrigg
91199119

91209120
if (!newRpb->rpb_relation)
91219121
newRpb->rpb_relation = relation;
9122+
9123+
const auto tempInstanceId = localTableRequest->getLocalTableInstanceId(tdbb);
9124+
orgRpb->rpb_temp_instance_id = tempInstanceId;
9125+
newRpb->rpb_temp_instance_id = tempInstanceId;
91229126
}
91239127

91249128
AutoLocalTableContext autoTransaction(tdbb, request, localTable, localTableRequest, transaction);
@@ -10319,6 +10323,7 @@ const StmtNode* StoreNode::store(thread_db* tdbb, Request* request, WhichTrigger
1031910323
{
1032010324
transaction = localTableRequest->getLocalTableTransaction();
1032110325
relation = rpb->rpb_relation = localTable->getRelation(tdbb, localTableRequest);
10326+
rpb->rpb_temp_instance_id = localTableRequest->getLocalTableInstanceId(tdbb);
1032210327
}
1032310328

1032410329
AutoLocalTableContext autoTransaction(tdbb, request, localTable, localTableRequest, transaction);

src/jrd/exe.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ void EXE_assignment(thread_db* tdbb, const ValueExprNode* to, dsc* from_desc,
473473
jrd_rel* relation = nullptr;
474474
Record* record = nullptr;
475475
USHORT fieldId = 0;
476+
FB_UINT64 tempInstanceId = 0;
476477

477478
if (to)
478479
{
@@ -483,12 +484,19 @@ void EXE_assignment(thread_db* tdbb, const ValueExprNode* to, dsc* from_desc,
483484
relation = rpb->rpb_relation;
484485
record = rpb->rpb_record;
485486
fieldId = toField->fieldId;
487+
tempInstanceId = rpb->rpb_temp_instance_id;
486488
}
487489
else if (!(nodeAs<ParameterNode>(to) || nodeAs<VariableNode>(to)))
488490
BUGCHECK(199); // msg 199 expected field node
489491
}
490492

491-
blb::move(tdbb, from_desc, to_desc, relation, record, fieldId);
493+
if (tempInstanceId)
494+
{
495+
AutoSetRestore<FB_UINT64> autoFrameId(&tdbb->tdbb_temp_frame_id, tempInstanceId);
496+
blb::move(tdbb, from_desc, to_desc, relation, record, fieldId);
497+
}
498+
else
499+
blb::move(tdbb, from_desc, to_desc, relation, record, fieldId);
492500
}
493501
else if (!DSC_EQUIV(from_desc, to_desc, false))
494502
{

src/jrd/recsrc/LocalTableStream.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,12 @@ void LocalTableStream::internalOpen(thread_db* tdbb) const
6666

6767
if (m_table->useLtt)
6868
{
69+
const auto tempInstanceId = localTableRequest->getLocalTableInstanceId(tdbb);
6970
AutoSetRestore<FB_UINT64> autoFrameId(
70-
&tdbb->tdbb_temp_frame_id, localTableRequest->getLocalTableInstanceId(tdbb));
71+
&tdbb->tdbb_temp_frame_id, tempInstanceId);
7172

7273
rpb->rpb_relation = m_table->getRelation(tdbb, localTableRequest);
74+
rpb->rpb_temp_instance_id = tempInstanceId;
7375
}
7476

7577
rpb->rpb_number.setValue(BOF_NUMBER);

src/jrd/req.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct RecordParameterBase
6060
RecordParameterBase()
6161
: rpb_transaction_nr(0), rpb_record(NULL), rpb_prior(NULL),
6262
rpb_undo(NULL), rpb_format_number(0),
63+
rpb_temp_instance_id(0),
6364
rpb_page(0), rpb_line(0),
6465
rpb_f_page(0), rpb_f_line(0),
6566
rpb_b_page(0), rpb_b_line(0),
@@ -75,6 +76,7 @@ struct RecordParameterBase
7576
Record* rpb_prior; // prior record block if this is a delta record
7677
Record* rpb_undo; // our first version of data if this is a second modification
7778
USHORT rpb_format_number; // format number in relation
79+
FB_UINT64 rpb_temp_instance_id; // declared local table page instance
7880

7981
ULONG rpb_page; // page number
8082
USHORT rpb_line; // line number on page

0 commit comments

Comments
 (0)