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>
|
2013-02-21 10:02:33 +00:00
|
|
|
#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>
|
2013-02-21 10:02:33 +00:00
|
|
|
#include <DB/Parsers/ParserTablePropertiesQuery.h>
|
2013-08-07 13:07:42 +00:00
|
|
|
#include <DB/Parsers/ParserAlterQuery.h>
|
2013-09-03 20:21:28 +00:00
|
|
|
#include <DB/Parsers/ParserShowProcesslistQuery.h>
|
2014-08-05 10:52:06 +00:00
|
|
|
#include <DB/Parsers/ParserCheckQuery.h>
|
2014-06-26 00:58:14 +00:00
|
|
|
//#include <DB/Parsers/ParserMultiQuery.h>
|
2011-10-30 11:30:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
|
2015-04-11 03:10:23 +00:00
|
|
|
bool ParserQuery::parseImpl(Pos & pos, Pos end, ASTPtr & node, Pos & max_parsed_pos, Expected & expected)
|
2011-10-30 11:30:52 +00:00
|
|
|
{
|
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;
|
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;
|
2013-02-21 10:02:33 +00:00
|
|
|
ParserTablePropertiesQuery table_p;
|
2013-09-03 20:21:28 +00:00
|
|
|
ParserShowProcesslistQuery show_processlist_p;
|
2014-08-05 10:52:06 +00:00
|
|
|
ParserCheckQuery check_p;
|
2014-06-26 01:01:16 +00:00
|
|
|
// ParserMultiQuery multi_p;
|
2014-06-26 00:58:14 +00:00
|
|
|
|
2015-04-11 03:10:23 +00:00
|
|
|
bool res = show_tables_p.parse(pos, end, node, max_parsed_pos, expected)
|
|
|
|
|| select_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)
|
|
|
|
|| optimize_p.parse(pos, end, node, max_parsed_pos, expected)
|
|
|
|
|| table_p.parse(pos, end, node, max_parsed_pos, expected)
|
|
|
|
|| show_processlist_p.parse(pos, end, node, max_parsed_pos, expected)
|
|
|
|
|| check_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
|
|
|
|
|
|
|
if (!res)
|
2014-08-05 10:52:06 +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, 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
|
|
|
}
|