diff --git a/src/jrd/Attachment.cpp b/src/jrd/Attachment.cpp index 4a6d219048..7eaa22fff1 100644 --- a/src/jrd/Attachment.cpp +++ b/src/jrd/Attachment.cpp @@ -52,13 +52,13 @@ using namespace Firebird; // static method -Jrd::Attachment* Jrd::Attachment::create(Database* dbb) +Jrd::Attachment* Jrd::Attachment::create(Database* dbb, Firebird::IProvider* provider) { MemoryPool* const pool = dbb->createPool(); try { - Attachment* const attachment = FB_NEW_POOL(*pool) Attachment(pool, dbb); + Attachment* const attachment = FB_NEW_POOL(*pool) Attachment(pool, dbb, provider); pool->setStatsGroup(attachment->att_memory_stats); return attachment; } @@ -171,7 +171,7 @@ void Jrd::Attachment::backupStateReadUnLock(thread_db* tdbb) } -Jrd::Attachment::Attachment(MemoryPool* pool, Database* dbb) +Jrd::Attachment::Attachment(MemoryPool* pool, Database* dbb, IProvider* provider) : att_pool(pool), att_memory_stats(&dbb->dbb_memory_stats), att_database(dbb), @@ -204,7 +204,8 @@ Jrd::Attachment::Attachment(MemoryPool* pool, Database* dbb) att_dyn_req(*pool), att_charsets(*pool), att_charset_ids(*pool), - att_pools(*pool) + att_pools(*pool), + att_provider(provider) { att_internal.grow(irq_MAX); att_dyn_req.grow(drq_MAX); diff --git a/src/jrd/Attachment.h b/src/jrd/Attachment.h index 3c790cefb7..b6e6ccea53 100644 --- a/src/jrd/Attachment.h +++ b/src/jrd/Attachment.h @@ -228,7 +228,7 @@ public: }; public: - static Attachment* create(Database* dbb); + static Attachment* create(Database* dbb, Firebird::IProvider* provider); static void destroy(Attachment* const attachment); MemoryPool* const att_pool; // Memory pool @@ -384,9 +384,17 @@ public: JAttachment* getInterface() throw(); + Firebird::IProvider* getProvider() + { + fb_assert(att_provider); + return att_provider; + } + private: - Attachment(MemoryPool* pool, Database* dbb); + Attachment(MemoryPool* pool, Database* dbb, Firebird::IProvider* provider); ~Attachment(); + + Firebird::IProvider* att_provider; // Provider which created this attachment }; diff --git a/src/jrd/CryptoManager.cpp b/src/jrd/CryptoManager.cpp index 65dc6414e8..234d00c144 100644 --- a/src/jrd/CryptoManager.cpp +++ b/src/jrd/CryptoManager.cpp @@ -926,7 +926,7 @@ namespace Jrd { UserId user; user.usr_user_name = "Database Crypter"; - Jrd::Attachment* const attachment = Jrd::Attachment::create(&dbb); + Jrd::Attachment* const attachment = Jrd::Attachment::create(&dbb, NULL); RefPtr sAtt(FB_NEW SysStableAttachment(attachment)); attachment->setStable(sAtt); attachment->att_filename = dbb.dbb_filename; diff --git a/src/jrd/ExtEngineManager.cpp b/src/jrd/ExtEngineManager.cpp index a80139f7cc..468485d1e5 100644 --- a/src/jrd/ExtEngineManager.cpp +++ b/src/jrd/ExtEngineManager.cpp @@ -604,7 +604,7 @@ ExtEngineManager::ExternalContextImpl::ExternalContextImpl(thread_db* tdbb, internalAttachment->getStable()->addRef(); externalAttachment = MasterInterfacePtr()->registerAttachment - (AutoPlugin(JProvider::getInstance()), internalAttachment->getInterface()); + (internalAttachment->getProvider(), internalAttachment->getInterface()); } ExtEngineManager::ExternalContextImpl::~ExternalContextImpl() diff --git a/src/jrd/cch.cpp b/src/jrd/cch.cpp index 26ba018f87..5018693d46 100644 --- a/src/jrd/cch.cpp +++ b/src/jrd/cch.cpp @@ -2957,7 +2957,7 @@ void BufferControl::cache_writer(BufferControl* bcb) UserId user; user.usr_user_name = "Cache Writer"; - Jrd::Attachment* const attachment = Jrd::Attachment::create(dbb); + Jrd::Attachment* const attachment = Jrd::Attachment::create(dbb, NULL); RefPtr sAtt(FB_NEW SysStableAttachment(attachment)); attachment->setStable(sAtt); attachment->att_filename = dbb->dbb_filename; diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index a8229020d1..0892437d6d 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -1056,7 +1056,7 @@ static void unwindAttach(thread_db* tdbb, const Exception& ex, FbStatusVector* Jrd::Attachment* attachment, Database* dbb, bool internalFlag); static JAttachment* initAttachment(thread_db*, const PathName&, const PathName&, RefPtr, bool, const DatabaseOptions&, RefMutexUnlock&, IPluginConfig*, JProvider*); -static JAttachment* create_attachment(const PathName&, Database*, const DatabaseOptions&, bool newDb); +static JAttachment* create_attachment(const PathName&, Database*, IProvider* provider, const DatabaseOptions&, bool newDb); static void prepare_tra(thread_db*, jrd_tra*, USHORT, const UCHAR*); static void start_transaction(thread_db* tdbb, bool transliterate, jrd_tra** tra_handle, Jrd::Attachment* attachment, unsigned int tpb_length, const UCHAR* tpb); @@ -6122,7 +6122,7 @@ static JAttachment* initAttachment(thread_db* tdbb, const PathName& expanded_nam fb_assert(!(dbb->dbb_flags & DBB_new)); tdbb->setDatabase(dbb); - jAtt = create_attachment(alias_name, dbb, options, !attach_flag); + jAtt = create_attachment(alias_name, dbb, provider, options, !attach_flag); if (dbb->dbb_linger_timer) dbb->dbb_linger_timer->reset(); @@ -6180,7 +6180,7 @@ static JAttachment* initAttachment(thread_db* tdbb, const PathName& expanded_nam dbbGuard.lock(SYNC_EXCLUSIVE); tdbb->setDatabase(dbb); - jAtt = create_attachment(alias_name, dbb, options, !attach_flag); + jAtt = create_attachment(alias_name, dbb, provider, options, !attach_flag); tdbb->setAttachment(jAtt->getHandle()); } // end scope @@ -6217,6 +6217,7 @@ static JAttachment* initAttachment(thread_db* tdbb, const PathName& expanded_nam static JAttachment* create_attachment(const PathName& alias_name, Database* dbb, + IProvider* provider, const DatabaseOptions& options, bool newDb) { @@ -6241,7 +6242,7 @@ static JAttachment* create_attachment(const PathName& alias_name, status_exception::raise(Arg::Gds(isc_att_shutdown)); } - attachment = Jrd::Attachment::create(dbb); + attachment = Jrd::Attachment::create(dbb, provider); attachment->att_next = dbb->dbb_attachments; dbb->dbb_attachments = attachment; } diff --git a/src/jrd/vio.cpp b/src/jrd/vio.cpp index b96b15117b..1158968067 100644 --- a/src/jrd/vio.cpp +++ b/src/jrd/vio.cpp @@ -4866,7 +4866,7 @@ void Database::garbage_collector(Database* dbb) UserId user; user.usr_user_name = "Garbage Collector"; - Jrd::Attachment* const attachment = Jrd::Attachment::create(dbb); + Jrd::Attachment* const attachment = Jrd::Attachment::create(dbb, NULL); RefPtr sAtt(FB_NEW SysStableAttachment(attachment)); attachment->setStable(sAtt); attachment->att_filename = dbb->dbb_filename;