ClickHouse/dbms/src/Parsers/ParserQuery.cpp

49 lines
1.8 KiB
C++
Raw Normal View History

#include <DB/Parsers/ParserQuery.h>
#include <DB/Parsers/ParserQueryWithOutput.h>
2011-10-30 11:30:52 +00:00
#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-07-31 19:08:49 +00:00
#include <DB/Parsers/ParserOptimizeQuery.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>
2013-08-07 13:07:42 +00:00
#include <DB/Parsers/ParserAlterQuery.h>
//#include <DB/Parsers/ParserMultiQuery.h>
2011-10-30 11:30:52 +00:00
namespace DB
{
bool ParserQuery::parseImpl(Pos & pos, Pos end, ASTPtr & node, Pos & max_parsed_pos, Expected & expected)
2011-10-30 11:30:52 +00:00
{
ParserQueryWithOutput query_with_output_p;
2011-10-30 11:30:52 +00:00
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;
2013-08-07 13:07:42 +00:00
ParserAlterQuery alter_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;
// ParserMultiQuery multi_p;
bool res = query_with_output_p.parse(pos, end, node, max_parsed_pos, expected)
|| insert_p.parse(pos, end, node, max_parsed_pos, expected)
|| create_p.parse(pos, end, node, max_parsed_pos, expected)
|| rename_p.parse(pos, end, node, max_parsed_pos, expected)
|| drop_p.parse(pos, end, node, max_parsed_pos, expected)
|| alter_p.parse(pos, end, node, max_parsed_pos, expected)
|| use_p.parse(pos, end, node, max_parsed_pos, expected)
|| set_p.parse(pos, end, node, max_parsed_pos, expected)
2017-01-24 13:39:39 +00:00
|| optimize_p.parse(pos, end, node, max_parsed_pos, expected);
/* || multi_p.parse(pos, end, node, max_parsed_pos, expected)*/;
2012-07-12 19:49:22 +00:00
2015-04-14 01:39:30 +00:00
if (!res && (!expected || !*expected))
2017-01-24 13:39:39 +00:00
expected = "One of: SHOW TABLES, SHOW DATABASES, SHOW CREATE TABLE, SELECT, INSERT, CREATE, ATTACH, RENAME, DROP, DETACH, USE, SET, OPTIMIZE, EXISTS, DESCRIBE, DESC, ALTER, SHOW PROCESSLIST, CHECK, KILL QUERY, opening curly brace";
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
}