ClickHouse/src/Interpreters/InterpreterUseQuery.cpp
Ivan 495c6e03aa
Replace all Context references with std::weak_ptr (#22297)
* Replace all Context references with std::weak_ptr

* Fix shared context captured by value

* Fix build

* Fix Context with named sessions

* Fix copy context

* Fix gcc build

* Merge with master and fix build

* Fix gcc-9 build
2021-04-11 02:33:54 +03:00

20 lines
477 B
C++

#include <Parsers/ASTUseQuery.h>
#include <Interpreters/Context.h>
#include <Interpreters/InterpreterUseQuery.h>
#include <Access/AccessFlags.h>
#include <Common/typeid_cast.h>
namespace DB
{
BlockIO InterpreterUseQuery::execute()
{
const String & new_database = query_ptr->as<ASTUseQuery &>().database;
getContext()->checkAccess(AccessType::SHOW_DATABASES, new_database);
getContext()->getSessionContext()->setCurrentDatabase(new_database);
return {};
}
}