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>
|
2012-12-15 03:09:04 +00:00
|
|
|
#include <DB/Parsers/ParserExistsQuery.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>
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
2012-12-15 03:09:04 +00:00
|
|
|
ParserExistsQuery exists_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)
|
2012-12-15 03:09:04 +00:00
|
|
|
|| optimize_p.parse(pos, end, node, expected)
|
|
|
|
|| exists_p.parse(pos, end, node, expected);
|
2012-07-12 19:49:22 +00:00
|
|
|
|
|
|
|
if (!res)
|
2012-12-15 03:09:04 +00:00
|
|
|
expected = "One of: SHOW TABLES, SHOW DATABASES, SELECT, INSERT, CREATE, ATTACH, RENAME, DROP, DETACH, USE, SET, OPTIMIZE, EXISTS";
|
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
|
|
|
}
|