mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 18:32:29 +00:00
26 lines
513 B
C++
26 lines
513 B
C++
#pragma once
|
|
|
|
#include <Interpreters/Context.h>
|
|
|
|
struct ContextHolder
|
|
{
|
|
DB::SharedContextHolder shared_context;
|
|
DB::Context context;
|
|
|
|
ContextHolder()
|
|
: shared_context(DB::Context::createShared())
|
|
, context(DB::Context::createGlobal(shared_context.get()))
|
|
{
|
|
context.makeGlobalContext();
|
|
context.setPath("./");
|
|
}
|
|
|
|
ContextHolder(ContextHolder &&) = default;
|
|
};
|
|
|
|
inline const ContextHolder & getContext()
|
|
{
|
|
static ContextHolder holder;
|
|
return holder;
|
|
}
|