Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/common/classes/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ class GlobalPtr : private InstanceControl
FB_NEW InstanceControl::InstanceLink<GlobalPtr, P>(this);
}

template <typename TFunc>
requires(std::invocable<TFunc, MemoryPool&>)
GlobalPtr(TFunc initializationFunc)
{
instance = initializationFunc(*getDefaultMemoryPool());
FB_NEW InstanceControl::InstanceLink<GlobalPtr, P>(this);
}

T* operator->() noexcept
{
return instance;
Expand All @@ -160,6 +168,16 @@ class GlobalPtr : private InstanceControl
return instance;
}

T* get() noexcept
{
return instance;
}

const T* get() const noexcept
{
return instance;
}

operator bool() noexcept
{
return instance;
Expand Down
7 changes: 5 additions & 2 deletions src/jrd/vio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4223,7 +4223,10 @@ void VIO_store(thread_db* tdbb, record_param* rpb, jrd_tra* transaction)
}},
};

ObjectsArray<MetaString> schemaSearchPath({SYSTEM_SCHEMA, PUBLIC_SCHEMA});
static const GlobalPtr<ObjectsArray<MetaString>> schemaSearchPath([](MemoryPool& pool)
{
return FB_NEW_POOL(pool) ObjectsArray<MetaString>(pool, {SYSTEM_SCHEMA, PUBLIC_SCHEMA});
});

if (const auto relSchemaFields = schemaFields.find(relation->rel_id); relSchemaFields != schemaFields.end())
{
Expand All @@ -4242,7 +4245,7 @@ void VIO_store(thread_db* tdbb, record_param* rpb, jrd_tra* transaction)
{
MOV_get_metaname(tdbb, &desc, depName.object);

if (MET_qualify_existing_name(tdbb, depName, {dependency->objType}, &schemaSearchPath))
if (MET_qualify_existing_name(tdbb, depName, {dependency->objType}, schemaSearchPath.get()))
schemaName = depName.schema.c_str();
}

Expand Down
Loading