blob: f846a0dbe4f24ba5ce08fbb60247ef2cf7c45f7d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#pragma once
#include <Interpreters/Context.h>
struct ContextHolder
{
DB::SharedContextHolder shared_context;
DB::ContextMutablePtr context;
ContextHolder()
: shared_context(DB::Context::createShared())
, context(DB::Context::createGlobal(shared_context.get()))
{
context->makeGlobalContext();
context->setPath("./");
}
ContextHolder(ContextHolder &&) = default;
void destroy()
{
context->shutdown();
context.reset();
shared_context.reset();
}
};
const ContextHolder & getContext();
ContextHolder & getMutableContext();
void destroyContext();
|