mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 02:12:21 +00:00
30 lines
670 B
C++
30 lines
670 B
C++
#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(Keyword::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;
|
|
|
|
|
|
}
|
|
|
|
}
|