mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 18:42:26 +00:00
45 lines
947 B
C++
45 lines
947 B
C++
|
#include <Parsers/TablePropertiesQueriesASTs.h>
|
||
|
|
||
|
#include <Parsers/CommonParsers.h>
|
||
|
#include <Parsers/ParserDescribeTableQuery.h>
|
||
|
#include <Parsers/ParserTablesInSelectQuery.h>
|
||
|
|
||
|
#include <Common/typeid_cast.h>
|
||
|
|
||
|
|
||
|
namespace DB
|
||
|
{
|
||
|
|
||
|
|
||
|
bool ParserDescribeTableQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||
|
{
|
||
|
ParserKeyword s_describe("DESCRIBE");
|
||
|
ParserKeyword s_desc("DESC");
|
||
|
ParserKeyword s_table("TABLE");
|
||
|
ParserToken s_dot(TokenType::Dot);
|
||
|
ParserIdentifier name_p;
|
||
|
|
||
|
ASTPtr database;
|
||
|
ASTPtr table;
|
||
|
|
||
|
if (!s_describe.ignore(pos, expected) && !s_desc.ignore(pos, expected))
|
||
|
return false;
|
||
|
|
||
|
auto query = std::make_shared<ASTDescribeQuery>();
|
||
|
|
||
|
s_table.ignore(pos, expected);
|
||
|
|
||
|
ASTPtr table_expression;
|
||
|
if (!ParserTableExpression().parse(pos, table_expression, expected))
|
||
|
return false;
|
||
|
|
||
|
query->table_expression = table_expression;
|
||
|
|
||
|
node = query;
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|