2015-04-11 03:10:23 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-11-26 16:04:21 +00:00
|
|
|
#include <Parsers/IAST_fwd.h>
|
2015-04-11 03:10:23 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2021-11-26 16:04:21 +00:00
|
|
|
class IParser;
|
|
|
|
|
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,
|
2021-01-18 12:15:46 +00:00
|
|
|
const char * & _out_query_end, // query start as input parameter, query end as output
|
2017-07-10 03:41:02 +00:00
|
|
|
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.
|
2020-01-14 11:11:01 +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".
|
2018-04-16 15:11:13 +00:00
|
|
|
/// Disabled if zero. Is used in order to check query size if buffer can contains data for INSERT query.
|
2020-04-15 20:28:05 +00:00
|
|
|
size_t max_parser_depth);
|
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,
|
2020-04-15 20:28:05 +00:00
|
|
|
size_t max_query_size,
|
|
|
|
size_t max_parser_depth);
|
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,
|
2020-01-14 11:11:01 +00:00
|
|
|
size_t max_query_size,
|
2020-04-15 20:28:05 +00:00
|
|
|
size_t max_parser_depth);
|
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,
|
2020-04-15 20:28:05 +00:00
|
|
|
size_t max_query_size,
|
|
|
|
size_t max_parser_depth);
|
2017-10-13 19:13:41 +00:00
|
|
|
|
|
|
|
ASTPtr parseQuery(
|
|
|
|
IParser & parser,
|
2018-03-26 19:41:55 +00:00
|
|
|
const std::string & query,
|
2020-04-15 20:28:05 +00:00
|
|
|
size_t max_query_size,
|
|
|
|
size_t max_parser_depth);
|
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
|
2019-01-22 19:56:53 +00:00
|
|
|
* Returns pointer to the end of last successfully parsed query (first), and true if all queries are successfully parsed (second)
|
2016-11-11 17:01:02 +00:00
|
|
|
* NOTE: INSERT's data should be placed in single line.
|
|
|
|
*/
|
2020-04-15 20:28:05 +00:00
|
|
|
std::pair<const char *, bool> splitMultipartQuery(
|
|
|
|
const std::string & queries,
|
|
|
|
std::vector<std::string> & queries_list,
|
|
|
|
size_t max_query_size,
|
2022-04-04 08:09:22 +00:00
|
|
|
size_t max_parser_depth,
|
|
|
|
bool allow_settings_after_format_in_insert);
|
2016-10-24 18:18:43 +00:00
|
|
|
|
2015-04-11 03:10:23 +00:00
|
|
|
}
|