add getSessionContext() const

This commit is contained in:
Pavel Kartavyy 2016-11-16 14:29:51 +03:00
parent 51cf368e1f
commit 631d9ea0a0
2 changed files with 8 additions and 0 deletions

View File

@ -204,7 +204,9 @@ public:
/// Для методов ниже может быть необходимо захватывать блокировку самостоятельно.
std::unique_lock<Poco::Mutex> getLock() const;
const Context & getSessionContext() const;
Context & getSessionContext();
const Context & getGlobalContext() const;
Context & getGlobalContext();

View File

@ -725,6 +725,12 @@ void Context::setMacros(Macros && macros)
shared->macros = macros;
}
const Context & Context::getSessionContext() const
{
if (!session_context)
throw Exception("There is no session", ErrorCodes::THERE_IS_NO_SESSION);
return *session_context;
}
Context & Context::getSessionContext()
{