ClickHouse/dbms/src/Parsers/parseQuery.h

58 lines
1.8 KiB
C++
Raw Normal View History

#pragma once
#include <Parsers/IParser.h>
namespace DB
{
/// Parse query or set 'out_error_message'.
ASTPtr tryParseQuery(
IParser & parser,
const char * & pos, /// Moved to end of parsed fragment.
const char * end,
std::string & out_error_message,
bool hilite,
const std::string & description,
2018-03-26 19:41:55 +00:00
bool allow_multi_statements, /// If false, check for non-space characters after semicolon and set error message if any.
2018-04-16 15:11:13 +00:00
size_t max_query_size); /// If (end - pos) > max_query_size and query is longer than max_query_size then throws "Max query size exceeded".
/// Disabled if zero. Is used in order to check query size if buffer can contains data for INSERT query.
/// Parse query or throw an exception with error message.
ASTPtr parseQueryAndMovePosition(
IParser & parser,
const char * & pos, /// Moved to end of parsed fragment.
const char * end,
const std::string & description,
2018-03-26 19:41:55 +00:00
bool allow_multi_statements,
2018-04-16 15:11:13 +00:00
size_t max_query_size);
ASTPtr parseQuery(
IParser & parser,
const char * begin,
const char * end,
2018-03-26 19:41:55 +00:00
const std::string & description,
2018-04-16 15:11:13 +00:00
size_t max_query_size);
ASTPtr parseQuery(
IParser & parser,
const std::string & query,
2018-03-26 19:41:55 +00:00
const std::string & query_description,
size_t max_query_size);
ASTPtr parseQuery(
IParser & parser,
2018-03-26 19:41:55 +00:00
const std::string & query,
2018-04-16 15:11:13 +00:00
size_t max_query_size);
2016-10-24 18:18:43 +00:00
/** Split queries separated by ; on to list of single queries
* Returns pointer to the end of last sucessfuly parsed query (first), and true if all queries are sucessfuly parsed (second)
* NOTE: INSERT's data should be placed in single line.
*/
std::pair<const char *, bool> splitMultipartQuery(const std::string & queries, std::vector<std::string> & queries_list);
2016-10-24 18:18:43 +00:00
}