2017-04-01 09:19:00 +00:00
|
|
|
#include <Parsers/ASTUseQuery.h>
|
|
|
|
#include <Interpreters/Context.h>
|
|
|
|
#include <Interpreters/InterpreterUseQuery.h>
|
2020-01-26 09:49:53 +00:00
|
|
|
#include <Access/AccessFlags.h>
|
2017-07-13 20:58:19 +00:00
|
|
|
#include <Common/typeid_cast.h>
|
2016-12-12 07:24:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2016-12-12 07:27:47 +00:00
|
|
|
BlockIO InterpreterUseQuery::execute()
|
2016-12-12 07:24:56 +00:00
|
|
|
{
|
2019-03-15 16:14:13 +00:00
|
|
|
const String & new_database = query_ptr->as<ASTUseQuery &>().database;
|
2020-03-06 14:36:01 +00:00
|
|
|
context.checkAccess(AccessType::SHOW_DATABASES, new_database);
|
2017-04-01 07:20:54 +00:00
|
|
|
context.getSessionContext().setCurrentDatabase(new_database);
|
|
|
|
return {};
|
2016-12-12 07:24:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|