Fix build.

This commit is contained in:
Nikolai Kochetov 2020-04-16 17:51:33 +03:00
parent d6db27e372
commit 025093d354
3 changed files with 17 additions and 4 deletions

View File

@ -228,7 +228,7 @@ int Server::main(const std::vector<std::string> & /*args*/)
* settings, available functions, data types, aggregate functions, databases...
*/
auto shared_context = Context::createShared();
global_context = std::make_unique<Context>(Context::createGlobal(shared_context.get()));
global_context = std::make_unique<Context>(Context::createGlobal(shared_context.shared.get()));
global_context->makeGlobalContext();
global_context->setApplicationType(Context::ApplicationType::SERVER);

View File

@ -441,6 +441,9 @@ Context::Context() = default;
Context::Context(const Context &) = default;
Context & Context::operator=(const Context &) = default;
SharedContextHolder::SharedContextHolder() = default;
SharedContextHolder::SharedContextHolder(SharedContextHolder &&) = default;
SharedContextHolder::~SharedContextHolder() = default;
Context Context::createGlobal()
{
@ -457,9 +460,11 @@ Context Context::createGlobal(ContextShared * shared)
return res;
}
std::unique_ptr<ContextShared> Context::createShared()
SharedContextHolder Context::createShared()
{
return std::make_unique<ContextShared>();
SharedContextHolder holder;
holder.shared = std::make_unique<ContextShared>();
return holder;
}
Context::~Context() = default;

View File

@ -128,6 +128,14 @@ struct IHostContext
using IHostContextPtr = std::shared_ptr<IHostContext>;
struct SharedContextHolder
{
std::unique_ptr<ContextShared> shared;
~SharedContextHolder();
SharedContextHolder();
SharedContextHolder(SharedContextHolder &&);
};
/** A set of known objects that can be used in the query.
* Consists of a shared part (always common to all sessions and queries)
* and copied part (which can be its own for each session or query).
@ -193,7 +201,7 @@ public:
/// Create initial Context with ContextShared and etc.
static Context createGlobal();
static Context createGlobal(ContextShared * shared);
static std::unique_ptr<ContextShared> createShared();
static SharedContextHolder createShared();
Context(const Context &);
Context & operator=(const Context &);