1#include <Parsers/ParserUseQuery.h>
2#include <Parsers/ASTIdentifier.h>
3#include <Parsers/ExpressionElementParsers.h>
4#include <Parsers/CommonParsers.h>
5#include <Parsers/ASTUseQuery.h>
6
7
8namespace DB
9{
10
11bool ParserUseQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
12{
13 ParserKeyword s_use("USE");
14 ParserIdentifier name_p;
15
16 if (!s_use.ignore(pos, expected))
17 return false;
18
19 ASTPtr database;
20 if (!name_p.parse(pos, database, expected))
21 return false;
22
23 auto query = std::make_shared<ASTUseQuery>();
24 tryGetIdentifierNameInto(database, query->database);
25 node = query;
26
27 return true;
28}
29
30}
31