mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-13 18:02:24 +00:00
34 lines
691 B
C++
34 lines
691 B
C++
#include <Parsers/ParserUseQuery.h>
|
|
|
|
#include <Common/typeid_cast.h>
|
|
#include <Parsers/ASTIdentifier.h>
|
|
#include <Parsers/ExpressionElementParsers.h>
|
|
#include <Parsers/CommonParsers.h>
|
|
#include <Parsers/ASTUseQuery.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
bool ParserUseQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
|
{
|
|
ParserKeyword s_use("USE");
|
|
ParserIdentifier name_p;
|
|
|
|
ASTPtr database;
|
|
|
|
if (!s_use.ignore(pos, expected))
|
|
return false;
|
|
|
|
if (!name_p.parse(pos, database, expected))
|
|
return false;
|
|
|
|
auto query = std::make_shared<ASTUseQuery>();
|
|
query->database = typeid_cast<ASTIdentifier &>(*database).name;
|
|
node = query;
|
|
|
|
return true;
|
|
}
|
|
|
|
}
|