ClickHouse/dbms/src/Parsers/ParserQuery.cpp

50 lines
1.5 KiB
C++
Raw Normal View History

2011-10-30 11:30:52 +00:00
#include <DB/Parsers/ParserSelectQuery.h>
#include <DB/Parsers/ParserCreateQuery.h>
#include <DB/Parsers/ParserInsertQuery.h>
2011-11-05 23:31:19 +00:00
#include <DB/Parsers/ParserDropQuery.h>
2012-06-18 06:19:13 +00:00
#include <DB/Parsers/ParserRenameQuery.h>
2012-06-18 07:49:19 +00:00
#include <DB/Parsers/ParserShowTablesQuery.h>
2012-07-31 19:08:49 +00:00
#include <DB/Parsers/ParserOptimizeQuery.h>
#include <DB/Parsers/TablePropertiesQueriesASTs.h>
2012-07-12 19:49:22 +00:00
#include <DB/Parsers/ParserUseQuery.h>
2012-08-02 19:03:32 +00:00
#include <DB/Parsers/ParserSetQuery.h>
2011-10-30 11:30:52 +00:00
#include <DB/Parsers/ParserQuery.h>
#include <DB/Parsers/ParserTablePropertiesQuery.h>
2011-10-30 11:30:52 +00:00
namespace DB
{
bool ParserQuery::parseImpl(Pos & pos, Pos end, ASTPtr & node, String & expected)
{
2012-06-18 07:49:19 +00:00
ParserShowTablesQuery show_tables_p;
2011-10-30 11:30:52 +00:00
ParserSelectQuery select_p;
ParserInsertQuery insert_p;
ParserCreateQuery create_p;
2012-06-18 06:19:13 +00:00
ParserRenameQuery rename_p;
2011-11-05 23:31:19 +00:00
ParserDropQuery drop_p;
2012-07-12 19:49:22 +00:00
ParserUseQuery use_p;
2012-08-02 19:03:32 +00:00
ParserSetQuery set_p;
2012-07-31 19:08:49 +00:00
ParserOptimizeQuery optimize_p;
ParserTablePropertiesQuery table_p;
2012-08-02 19:03:32 +00:00
2012-07-12 19:49:22 +00:00
bool res = show_tables_p.parse(pos, end, node, expected)
2012-06-18 07:49:19 +00:00
|| select_p.parse(pos, end, node, expected)
2011-10-30 11:30:52 +00:00
|| insert_p.parse(pos, end, node, expected)
2011-11-05 23:31:19 +00:00
|| create_p.parse(pos, end, node, expected)
2012-06-18 06:19:13 +00:00
|| rename_p.parse(pos, end, node, expected)
2012-07-12 19:49:22 +00:00
|| drop_p.parse(pos, end, node, expected)
2012-07-31 19:08:49 +00:00
|| use_p.parse(pos, end, node, expected)
2012-08-02 19:03:32 +00:00
|| set_p.parse(pos, end, node, expected)
|| optimize_p.parse(pos, end, node, expected)
|| table_p.parse(pos, end, node, expected);
2012-07-12 19:49:22 +00:00
if (!res)
expected = "One of: SHOW TABLES, SHOW DATABASES, SHOW CREATE TABLE, SELECT, INSERT, CREATE, ATTACH, RENAME, DROP, DETACH, USE, SET, OPTIMIZE, EXISTS, DESCRIBE, DESC";
2012-07-12 19:49:22 +00:00
return res;
2011-10-30 11:30:52 +00:00
}
2012-07-12 19:49:22 +00:00
}