2015-04-11 03:10:23 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Parsers/IParser.h>
|
2015-04-11 03:10:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2016-08-17 05:38:51 +00:00
|
|
|
/// Parse query or set 'out_error_message'.
|
2015-04-11 04:15:14 +00:00
|
|
|
ASTPtr tryParseQuery(
|
2017-04-01 07:20:54 +00:00
|
|
|
IParser & parser,
|
2017-07-10 03:41:02 +00:00
|
|
|
const char * & pos, /// Moved to end of parsed fragment.
|
|
|
|
const char * end,
|
2017-04-01 07:20:54 +00:00
|
|
|
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.
|
2015-04-11 04:15:14 +00:00
|
|
|
|
2015-04-11 03:10:23 +00:00
|
|
|
|
2016-08-17 05:38:51 +00:00
|
|
|
/// Parse query or throw an exception with error message.
|
2015-04-14 20:46:34 +00:00
|
|
|
ASTPtr parseQueryAndMovePosition(
|
2017-04-01 07:20:54 +00:00
|
|
|
IParser & parser,
|
2017-07-10 03:41:02 +00:00
|
|
|
const char * & pos, /// Moved to end of parsed fragment.
|
|
|
|
const char * end,
|
2017-04-01 07:20:54 +00:00
|
|
|
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);
|
2015-04-14 20:46:34 +00:00
|
|
|
|
|
|
|
|
2015-04-11 04:15:14 +00:00
|
|
|
ASTPtr parseQuery(
|
2017-04-01 07:20:54 +00:00
|
|
|
IParser & parser,
|
2017-07-10 03:41:02 +00:00
|
|
|
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);
|
2015-04-11 03:10:23 +00:00
|
|
|
|
2017-10-13 19:13:41 +00:00
|
|
|
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);
|
2017-10-13 19:13:41 +00:00
|
|
|
|
|
|
|
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);
|
2017-10-13 19:13:41 +00:00
|
|
|
|
2016-10-24 18:18:43 +00:00
|
|
|
|
2016-11-11 17:01:02 +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.
|
|
|
|
*/
|
2016-10-25 12:14:27 +00:00
|
|
|
std::pair<const char *, bool> splitMultipartQuery(const std::string & queries, std::vector<std::string> & queries_list);
|
2016-10-24 18:18:43 +00:00
|
|
|
|
2015-04-11 03:10:23 +00:00
|
|
|
}
|