mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
20 lines
484 B
C++
20 lines
484 B
C++
#include <Parsers/ASTUseQuery.h>
|
|
#include <Interpreters/Context.h>
|
|
#include <Interpreters/InterpreterUseQuery.h>
|
|
#include <Access/Common/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 {};
|
|
}
|
|
|
|
}
|