4747#include "../common/utils_proto.h"
4848#include "../jrd/DebugInterface.h"
4949#include "../jrd/QualifiedName.h"
50+ #include "../jrd/Statement.h"
5051
5152#include "../jrd/Function.h"
5253
@@ -328,7 +329,7 @@ HazardPtr<Function> Function::loadMetadata(thread_db* tdbb, USHORT id, bool nosc
328329 {
329330 function->setDefaultCount(function->getDefaultCount() + 1);
330331
331- MemoryPool* const csb_pool = attachment ->createPool();
332+ MemoryPool* const csb_pool = dbb ->createPool();
332333 Jrd::ContextPoolHolder context(tdbb, csb_pool);
333334
334335 try
@@ -338,7 +339,7 @@ HazardPtr<Function> Function::loadMetadata(thread_db* tdbb, USHORT id, bool nosc
338339 }
339340 catch (const Exception&)
340341 {
341- attachment ->deletePool(csb_pool);
342+ dbb ->deletePool(csb_pool);
342343 throw; // an explicit error message would be better
343344 }
344345 }
@@ -396,7 +397,7 @@ HazardPtr<Function> Function::loadMetadata(thread_db* tdbb, USHORT id, bool nosc
396397 }
397398 else if (!X.RDB$ENGINE_NAME.NULL || !X.RDB$FUNCTION_BLR.NULL)
398399 {
399- MemoryPool* const csb_pool = attachment ->createPool();
400+ MemoryPool* const csb_pool = dbb ->createPool();
400401 Jrd::ContextPoolHolder context(tdbb, csb_pool);
401402
402403 try
@@ -442,7 +443,7 @@ HazardPtr<Function> Function::loadMetadata(thread_db* tdbb, USHORT id, bool nosc
442443 }
443444 catch (const Exception&)
444445 {
445- attachment ->deletePool(csb_pool);
446+ dbb ->deletePool(csb_pool);
446447 throw;
447448 }
448449
@@ -525,7 +526,7 @@ void Function::releaseLocks(thread_db* tdbb)
525526 {
526527 LCK_release(tdbb, existenceLock);
527528 flags |= Routine::FLAG_CHECK_EXISTENCE;
528- useCount = 0;
529+ // !!!!!!!!!!!!!! useCount = 0;
529530 }
530531}
531532
@@ -544,6 +545,7 @@ bool Function::reload(thread_db* tdbb)
544545 fb_assert(this->flags & Routine::FLAG_RELOAD);
545546
546547 Attachment* attachment = tdbb->getAttachment();
548+ Database* dbb = tdbb->getDatabase();
547549 AutoCacheRequest request(tdbb, irq_l_funct_blr, IRQ_REQUESTS);
548550
549551 FOR(REQUEST_HANDLE request)
@@ -553,7 +555,7 @@ bool Function::reload(thread_db* tdbb)
553555 if (X.RDB$FUNCTION_BLR.NULL)
554556 continue;
555557
556- MemoryPool* const csb_pool = attachment ->createPool();
558+ MemoryPool* const csb_pool = dbb ->createPool();
557559 Jrd::ContextPoolHolder context(tdbb, csb_pool);
558560
559561 try
@@ -580,7 +582,7 @@ bool Function::reload(thread_db* tdbb)
580582 }
581583 catch (const Exception&)
582584 {
583- attachment ->deletePool(csb_pool);
585+ dbb ->deletePool(csb_pool);
584586 throw;
585587 }
586588 }
0 commit comments