ClickHouse/dbms/Parsers/ParserUseQuery.cpp

31 lines
646 B
C++
Raw Normal View History

#include <Parsers/ParserUseQuery.h>
#include <Parsers/ASTIdentifier.h>
#include <Parsers/ExpressionElementParsers.h>
#include <Parsers/CommonParsers.h>
#include <Parsers/ASTUseQuery.h>
namespace DB
{
2018-02-26 03:37:08 +00:00
bool ParserUseQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
ParserKeyword s_use("USE");
ParserIdentifier name_p;
if (!s_use.ignore(pos, expected))
return false;
ASTPtr database;
if (!name_p.parse(pos, database, expected))
return false;
2018-02-26 03:37:08 +00:00
auto query = std::make_shared<ASTUseQuery>();
2019-08-08 20:02:30 +00:00
tryGetIdentifierNameInto(database, query->database);
node = query;
return true;
}
2018-02-26 03:37:08 +00:00
}