mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 23:23:04 +01:00
Better scope for RAII holder and error handling.
This commit is contained in:
parent
75f3c367e8
commit
923b7e12ed
@ -236,16 +236,30 @@ Applier* Applier::create(thread_db* tdbb)
|
|||||||
if (!attachment->locksmith(tdbb, REPLICATE_INTO_DATABASE))
|
if (!attachment->locksmith(tdbb, REPLICATE_INTO_DATABASE))
|
||||||
status_exception::raise(Arg::Gds(isc_miss_prvlg) << "REPLICATE_INTO_DATABASE");
|
status_exception::raise(Arg::Gds(isc_miss_prvlg) << "REPLICATE_INTO_DATABASE");
|
||||||
|
|
||||||
|
jrd_req* request = nullptr;
|
||||||
const auto req_pool = attachment->createPool();
|
const auto req_pool = attachment->createPool();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
Jrd::ContextPoolHolder context(tdbb, req_pool);
|
Jrd::ContextPoolHolder context(tdbb, req_pool);
|
||||||
AutoPtr<CompilerScratch> csb(FB_NEW_POOL(*req_pool) CompilerScratch(*req_pool));
|
AutoPtr<CompilerScratch> csb(FB_NEW_POOL(*req_pool) CompilerScratch(*req_pool));
|
||||||
|
|
||||||
const auto request = JrdStatement::makeRequest(tdbb, csb, true);
|
request = JrdStatement::makeRequest(tdbb, csb, true);
|
||||||
request->validateTimeStamp();
|
request->validateTimeStamp();
|
||||||
request->req_attachment = attachment;
|
request->req_attachment = attachment;
|
||||||
|
}
|
||||||
|
catch (const Exception&)
|
||||||
|
{
|
||||||
|
if (request)
|
||||||
|
CMP_release(tdbb, request);
|
||||||
|
else
|
||||||
|
attachment->deletePool(req_pool);
|
||||||
|
|
||||||
auto& att_pool = *attachment->att_pool;
|
throw;
|
||||||
const auto applier = FB_NEW_POOL(att_pool) Applier(att_pool, dbb->dbb_filename, request);
|
}
|
||||||
|
|
||||||
|
const auto applier = FB_NEW_POOL(*attachment->att_pool)
|
||||||
|
Applier(*attachment->att_pool, dbb->dbb_filename, request);
|
||||||
|
|
||||||
attachment->att_repl_appliers.add(applier);
|
attachment->att_repl_appliers.add(applier);
|
||||||
return applier;
|
return applier;
|
||||||
|
Loading…
Reference in New Issue
Block a user