ClickHouse/dbms/src/Interpreters/InterpreterUseQuery.cpp

18 lines
365 B
C++

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