aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Parsers/ParserDatabaseOrNone.cpp
blob: c53c547aedd2693099ff52c205ee8ea0e2f99920 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <Parsers/ParserDatabaseOrNone.h>
#include <Parsers/parseIdentifierOrStringLiteral.h>
#include <Parsers/ASTDatabaseOrNone.h>
#include <Parsers/CommonParsers.h>

namespace DB
{
bool ParserDatabaseOrNone::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
    auto result = std::make_shared<ASTDatabaseOrNone>();
    node = result;

    if (ParserKeyword{"NONE"}.ignore(pos, expected))
    {
        result->none = true;
        return true;
    }
    String database_name;
    if (parseIdentifierOrStringLiteral(pos, expected, database_name))
    {
        result->database_name = database_name;
        return true;
    }
    return false;


}

}