@@ -168,22 +168,23 @@ bid ConstantValue::getBlobId(thread_db* tdbb)
168168 return m_blrBlobId.isEmpty() ? getConstantBid(tdbb, name) : m_blrBlobId;
169169}
170170
171- dsc* ConstantValue::makeValue(thread_db* tdbb, Request* request )
171+ dsc* ConstantValue::makeValue(thread_db* tdbb)
172172{
173173 {
174174 ReadLockGuard guard(m_makeValueLock, FB_FUNCTION);
175- if (m_value.vlu_desc.dsc_dtype != dtype_unknown )
175+ if (m_value.vlu_desc.dsc_address != nullptr )
176176 return &m_value.vlu_desc;
177177 }
178178
179179 WriteLockGuard guard(m_makeValueLock, FB_FUNCTION);
180- if (m_value.vlu_desc.dsc_dtype != dtype_unknown ) // Extra check in case of two callers waiting
180+ if (m_value.vlu_desc.dsc_address != nullptr ) // Extra check in case of two callers waiting
181181 return &m_value.vlu_desc;
182182
183183 Attachment* attachment = tdbb->getAttachment();
184184
185185 MemoryPool* csb_pool = attachment->att_database->createPool();
186186 Statement* handmadeStmt = nullptr;
187+ Request* request = nullptr;
187188 try
188189 {
189190 ContextPoolHolder context(tdbb, csb_pool);
@@ -195,28 +196,21 @@ dsc* ConstantValue::makeValue(thread_db* tdbb, Request* request)
195196 bid constantBid = getBlobId(tdbb);
196197
197198 MET_parse_blob(tdbb, &name.schema, nullptr, &constantBid, &csb, nullptr, false, false);
198- fb_assert(csb->csb_node != nullptr);
199199
200- if (request == nullptr)
201- {
202- // Came from Reload
203- handmadeStmt = Statement::makeStatement(tdbb, csb, true);
204- request = handmadeStmt->makeRootRequest(tdbb);
200+ handmadeStmt = Statement::makeStatement(tdbb, csb, true);
201+ request = handmadeStmt->makeRootRequest(tdbb);
205202
206- AutoSetRestore2<Request*, thread_db> autoSetRequest(
207- tdbb, &thread_db::getRequest, &thread_db::setRequest, request);
203+ AutoSetRestore2<Request*, thread_db> autoSetRequest(
204+ tdbb, &thread_db::getRequest, &thread_db::setRequest, request);
208205
209- request->setUsed();
210- request->setAttachment(attachment);
211- attachment->att_requests.add(request);
206+ request->setUsed();
207+ request->setAttachment(attachment);
208+ attachment->att_requests.add(request);
212209
213- TRA_attach_request(tdbb->getTransaction(), request);
210+ TRA_attach_request(tdbb->getTransaction(), request);
214211
215- // Execute it here, while AutoSetRestore2 is active
216- executeCsbNode(tdbb, csb);
217- }
218- else
219- executeCsbNode(tdbb, csb);
212+ // Execute it while AutoSetRestore2 is active
213+ executeCsbNode(tdbb, csb);
220214 }
221215 catch (const Exception& ex)
222216 {
@@ -347,7 +341,7 @@ ScanResult Package::scan(thread_db* tdbb, ObjectBase::Flag flags)
347341 skipMakeValue);
348342
349343 if (skipMakeValue)
350- this->m_callReload = true; // Value is necessary for to calculate hash
344+ this->m_callReload = true;
351345 }
352346 END_FOR
353347 }
@@ -426,7 +420,7 @@ ConstantValue& Package::addConstant(thread_db* tdbb,
426420 auto& value = constants.add(constName, isPrivate);
427421 value.updateValue(blrBlobId);
428422 if (!skipMakeValue)
429- value.makeValue(tdbb, nullptr );
423+ value.makeValue(tdbb);
430424
431425 return value;
432426}
0 commit comments