2017-04-01 09:19:00 +00:00
|
|
|
#include <Parsers/parseQuery.h>
|
|
|
|
#include <Parsers/ParserQuery.h>
|
|
|
|
#include <Parsers/ASTInsertQuery.h>
|
2017-07-12 01:49:20 +00:00
|
|
|
#include <Parsers/Lexer.h>
|
|
|
|
#include <Parsers/TokenIterator.h>
|
2018-01-15 19:07:47 +00:00
|
|
|
#include <Common/StringUtils/StringUtils.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Common/typeid_cast.h>
|
2017-07-13 04:20:56 +00:00
|
|
|
#include <Common/UTF8Helpers.h>
|
2018-11-25 00:08:50 +00:00
|
|
|
#include <common/find_symbols.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <IO/WriteHelpers.h>
|
2017-07-31 21:39:24 +00:00
|
|
|
#include <IO/WriteBufferFromString.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <IO/Operators.h>
|
2015-04-11 03:10:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2016-01-11 21:46:36 +00:00
|
|
|
namespace ErrorCodes
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
extern const int SYNTAX_ERROR;
|
2016-01-11 21:46:36 +00:00
|
|
|
}
|
|
|
|
|
2017-07-13 04:20:56 +00:00
|
|
|
namespace
|
|
|
|
{
|
2016-01-11 21:46:36 +00:00
|
|
|
|
2016-08-17 05:38:51 +00:00
|
|
|
/** From position in (possible multiline) query, get line number and column number in line.
|
|
|
|
* Used in syntax error message.
|
2015-04-11 03:10:23 +00:00
|
|
|
*/
|
2017-07-13 04:20:56 +00:00
|
|
|
std::pair<size_t, size_t> getLineAndCol(const char * begin, const char * pos)
|
2015-04-11 03:10:23 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
size_t line = 0;
|
2015-04-11 03:10:23 +00:00
|
|
|
|
2017-07-10 03:41:02 +00:00
|
|
|
const char * nl;
|
2018-08-27 13:56:53 +00:00
|
|
|
while ((nl = find_first_symbols<'\n'>(begin, pos)) < pos)
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
++line;
|
|
|
|
begin = nl + 1;
|
|
|
|
}
|
2015-04-11 03:10:23 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
/// Lines numbered from 1.
|
|
|
|
return { line + 1, pos - begin + 1 };
|
2015-04-11 03:10:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-07-13 04:20:56 +00:00
|
|
|
WriteBuffer & operator<< (WriteBuffer & out, const Expected & expected)
|
|
|
|
{
|
|
|
|
if (expected.variants.empty())
|
|
|
|
return out;
|
|
|
|
|
|
|
|
if (expected.variants.size() == 1)
|
|
|
|
return out << *expected.variants.begin();
|
|
|
|
|
|
|
|
out << "one of: ";
|
|
|
|
bool first = true;
|
|
|
|
for (const auto & variant : expected.variants)
|
|
|
|
{
|
|
|
|
if (!first)
|
|
|
|
out << ", ";
|
|
|
|
first = false;
|
|
|
|
|
|
|
|
out << variant;
|
|
|
|
}
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Hilite place of syntax error.
|
|
|
|
void writeQueryWithHighlightedErrorPositions(
|
|
|
|
WriteBuffer & out,
|
|
|
|
const char * begin,
|
|
|
|
const char * end,
|
2017-07-13 05:38:02 +00:00
|
|
|
const Token * positions_to_hilite, /// must go in ascending order
|
2017-07-13 04:20:56 +00:00
|
|
|
size_t num_positions_to_hilite)
|
|
|
|
{
|
|
|
|
const char * pos = begin;
|
|
|
|
for (size_t position_to_hilite_idx = 0; position_to_hilite_idx < num_positions_to_hilite; ++position_to_hilite_idx)
|
|
|
|
{
|
2017-07-13 05:38:02 +00:00
|
|
|
const char * current_position_to_hilite = positions_to_hilite[position_to_hilite_idx].begin;
|
2017-07-13 04:20:56 +00:00
|
|
|
out.write(pos, current_position_to_hilite - pos);
|
|
|
|
|
2017-07-13 05:18:20 +00:00
|
|
|
if (current_position_to_hilite == end)
|
|
|
|
{
|
|
|
|
out << "\033[41;1m \033[0m";
|
2017-07-13 05:20:25 +00:00
|
|
|
return;
|
2017-07-13 05:18:20 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
size_t bytes_to_hilite = UTF8::seqLength(*current_position_to_hilite);
|
|
|
|
|
|
|
|
/// Bright on red background.
|
|
|
|
out << "\033[41;1m";
|
|
|
|
out.write(current_position_to_hilite, bytes_to_hilite);
|
|
|
|
out << "\033[0m";
|
|
|
|
pos = current_position_to_hilite + bytes_to_hilite;
|
|
|
|
}
|
2017-07-13 04:20:56 +00:00
|
|
|
}
|
|
|
|
out.write(pos, end - pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void writeQueryAroundTheError(
|
|
|
|
WriteBuffer & out,
|
|
|
|
const char * begin,
|
|
|
|
const char * end,
|
|
|
|
bool hilite,
|
2017-07-13 05:38:02 +00:00
|
|
|
const Token * positions_to_hilite,
|
2017-07-13 04:20:56 +00:00
|
|
|
size_t num_positions_to_hilite)
|
|
|
|
{
|
|
|
|
if (hilite)
|
|
|
|
{
|
|
|
|
out << ":\n\n";
|
2017-07-13 05:20:25 +00:00
|
|
|
writeQueryWithHighlightedErrorPositions(out, begin, end, positions_to_hilite, num_positions_to_hilite);
|
2017-07-13 04:20:56 +00:00
|
|
|
out << "\n\n";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (num_positions_to_hilite)
|
2017-08-05 03:31:52 +00:00
|
|
|
out << ": " << std::string(positions_to_hilite[0].begin, std::min(SHOW_CHARS_ON_SYNTAX_ERROR, end - positions_to_hilite[0].begin)) << ". ";
|
2017-07-13 04:20:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void writeCommonErrorMessage(
|
|
|
|
WriteBuffer & out,
|
2017-07-10 03:41:02 +00:00
|
|
|
const char * begin,
|
|
|
|
const char * end,
|
2017-07-13 05:38:02 +00:00
|
|
|
Token last_token,
|
2017-07-13 04:20:56 +00:00
|
|
|
const std::string & query_description)
|
|
|
|
{
|
|
|
|
out << "Syntax error";
|
|
|
|
|
|
|
|
if (!query_description.empty())
|
|
|
|
out << " (" << query_description << ")";
|
|
|
|
|
2017-07-13 05:38:02 +00:00
|
|
|
out << ": failed at position " << (last_token.begin - begin + 1);
|
2017-07-13 04:20:56 +00:00
|
|
|
|
2017-07-13 05:38:02 +00:00
|
|
|
if (last_token.type == TokenType::EndOfStream || last_token.type == TokenType::Semicolon)
|
2017-07-13 04:20:56 +00:00
|
|
|
out << " (end of query)";
|
|
|
|
|
|
|
|
/// If query is multiline.
|
2018-08-26 00:26:51 +00:00
|
|
|
const char * nl = find_first_symbols<'\n'>(begin, end);
|
2018-08-27 13:56:53 +00:00
|
|
|
if (nl + 1 < end)
|
2017-07-13 04:20:56 +00:00
|
|
|
{
|
|
|
|
size_t line = 0;
|
|
|
|
size_t col = 0;
|
2017-07-13 05:38:02 +00:00
|
|
|
std::tie(line, col) = getLineAndCol(begin, last_token.begin);
|
2017-07-13 04:20:56 +00:00
|
|
|
|
|
|
|
out << " (line " << line << ", col " << col << ")";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string getSyntaxErrorMessage(
|
|
|
|
const char * begin,
|
|
|
|
const char * end,
|
2017-07-13 05:38:02 +00:00
|
|
|
Token last_token,
|
2017-07-13 04:20:56 +00:00
|
|
|
const Expected & expected,
|
2017-04-01 07:20:54 +00:00
|
|
|
bool hilite,
|
2017-07-13 04:20:56 +00:00
|
|
|
const std::string & query_description)
|
2015-04-11 03:10:23 +00:00
|
|
|
{
|
2017-07-31 21:39:24 +00:00
|
|
|
WriteBufferFromOwnString out;
|
|
|
|
writeCommonErrorMessage(out, begin, end, last_token, query_description);
|
|
|
|
writeQueryAroundTheError(out, begin, end, hilite, &last_token, 1);
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2017-07-31 21:39:24 +00:00
|
|
|
if (!expected.variants.empty())
|
|
|
|
out << "Expected " << expected;
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2017-07-31 21:39:24 +00:00
|
|
|
return out.str();
|
2017-07-13 04:20:56 +00:00
|
|
|
}
|
2017-04-01 07:20:54 +00:00
|
|
|
|
|
|
|
|
2017-07-13 04:20:56 +00:00
|
|
|
std::string getLexicalErrorMessage(
|
|
|
|
const char * begin,
|
|
|
|
const char * end,
|
2017-07-13 05:38:02 +00:00
|
|
|
Token last_token,
|
2017-07-13 04:20:56 +00:00
|
|
|
bool hilite,
|
|
|
|
const std::string & query_description)
|
|
|
|
{
|
2017-07-31 21:39:24 +00:00
|
|
|
WriteBufferFromOwnString out;
|
|
|
|
writeCommonErrorMessage(out, begin, end, last_token, query_description);
|
|
|
|
writeQueryAroundTheError(out, begin, end, hilite, &last_token, 1);
|
2017-07-13 04:20:56 +00:00
|
|
|
|
2017-07-31 21:39:24 +00:00
|
|
|
out << getErrorTokenDescription(last_token.type);
|
2017-07-13 04:20:56 +00:00
|
|
|
|
2017-07-31 21:39:24 +00:00
|
|
|
return out.str();
|
2017-07-13 04:20:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string getUnmatchedParenthesesErrorMessage(
|
|
|
|
const char * begin,
|
|
|
|
const char * end,
|
|
|
|
const UnmatchedParentheses & unmatched_parens,
|
|
|
|
bool hilite,
|
|
|
|
const std::string & query_description)
|
|
|
|
{
|
2017-07-31 21:39:24 +00:00
|
|
|
WriteBufferFromOwnString out;
|
|
|
|
writeCommonErrorMessage(out, begin, end, unmatched_parens[0], query_description);
|
|
|
|
writeQueryAroundTheError(out, begin, end, hilite, unmatched_parens.data(), unmatched_parens.size());
|
2017-07-13 04:20:56 +00:00
|
|
|
|
2017-07-31 21:39:24 +00:00
|
|
|
out << "Unmatched parentheses: ";
|
|
|
|
for (const Token & paren : unmatched_parens)
|
|
|
|
out << *paren.begin;
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2017-07-31 21:39:24 +00:00
|
|
|
return out.str();
|
2015-04-11 03:10:23 +00:00
|
|
|
}
|
|
|
|
|
2017-07-13 04:20:56 +00:00
|
|
|
}
|
|
|
|
|
2015-04-11 03:10:23 +00:00
|
|
|
|
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,
|
|
|
|
const char * end,
|
2017-04-01 07:20:54 +00:00
|
|
|
std::string & out_error_message,
|
|
|
|
bool hilite,
|
2017-07-13 04:20:56 +00:00
|
|
|
const std::string & query_description,
|
2018-03-26 19:41:55 +00:00
|
|
|
bool allow_multi_statements,
|
2020-01-14 11:11:01 +00:00
|
|
|
size_t max_query_size,
|
|
|
|
size_t max_parser_depth)
|
2015-04-11 03:10:23 +00:00
|
|
|
{
|
2018-03-26 19:41:55 +00:00
|
|
|
Tokens tokens(pos, end, max_query_size);
|
2020-01-14 11:11:01 +00:00
|
|
|
IParser::Pos token_iterator(tokens, max_parser_depth);
|
2017-07-12 01:49:20 +00:00
|
|
|
|
2017-07-13 01:12:13 +00:00
|
|
|
if (token_iterator->isEnd()
|
2017-07-12 01:49:20 +00:00
|
|
|
|| token_iterator->type == TokenType::Semicolon)
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
out_error_message = "Empty query";
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-07-13 04:20:56 +00:00
|
|
|
Expected expected;
|
2017-04-01 07:20:54 +00:00
|
|
|
|
|
|
|
ASTPtr res;
|
2017-07-12 01:49:20 +00:00
|
|
|
bool parse_res = parser.parse(token_iterator, res, expected);
|
2017-07-13 04:51:44 +00:00
|
|
|
Token last_token = token_iterator.max();
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2017-07-13 06:05:38 +00:00
|
|
|
/// If parsed query ends at data for insertion. Data for insertion could be in any format and not necessary be lexical correct.
|
|
|
|
ASTInsertQuery * insert = nullptr;
|
|
|
|
if (parse_res)
|
2019-03-11 13:22:51 +00:00
|
|
|
insert = res->as<ASTInsertQuery>();
|
2017-07-13 04:51:44 +00:00
|
|
|
|
2017-07-13 06:05:38 +00:00
|
|
|
if (!(insert && insert->data))
|
2017-07-13 05:28:51 +00:00
|
|
|
{
|
2017-07-13 06:05:38 +00:00
|
|
|
/// Lexical error
|
|
|
|
if (last_token.isError())
|
|
|
|
{
|
2017-07-13 06:10:56 +00:00
|
|
|
out_error_message = getLexicalErrorMessage(pos, end, last_token, hilite, query_description);
|
2017-07-13 06:05:38 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Unmatched parentheses
|
|
|
|
UnmatchedParentheses unmatched_parens = checkUnmatchedParentheses(TokenIterator(tokens), &last_token);
|
|
|
|
if (!unmatched_parens.empty())
|
|
|
|
{
|
2017-07-13 06:10:56 +00:00
|
|
|
out_error_message = getUnmatchedParenthesesErrorMessage(pos, end, unmatched_parens, hilite, query_description);
|
2017-07-13 06:05:38 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
2017-07-13 05:28:51 +00:00
|
|
|
}
|
2017-07-13 04:51:44 +00:00
|
|
|
|
2017-07-13 05:28:51 +00:00
|
|
|
if (!parse_res)
|
|
|
|
{
|
2017-07-13 04:51:44 +00:00
|
|
|
/// Parse error.
|
2017-07-13 06:10:56 +00:00
|
|
|
out_error_message = getSyntaxErrorMessage(pos, end, last_token, expected, hilite, query_description);
|
2017-07-13 04:51:44 +00:00
|
|
|
return nullptr;
|
2017-07-13 04:20:56 +00:00
|
|
|
}
|
|
|
|
|
2017-07-12 20:45:27 +00:00
|
|
|
/// Excessive input after query. Parsed query must end with end of data or semicolon or data for INSERT.
|
2017-07-13 04:51:44 +00:00
|
|
|
if (!token_iterator->isEnd()
|
2017-07-12 20:45:27 +00:00
|
|
|
&& token_iterator->type != TokenType::Semicolon
|
|
|
|
&& !(insert && insert->data))
|
2017-07-12 01:49:20 +00:00
|
|
|
{
|
2017-07-13 04:20:56 +00:00
|
|
|
expected.add(pos, "end of query");
|
2017-07-13 06:10:56 +00:00
|
|
|
out_error_message = getSyntaxErrorMessage(pos, end, last_token, expected, hilite, query_description);
|
2017-04-01 07:20:54 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-07-12 01:49:20 +00:00
|
|
|
while (token_iterator->type == TokenType::Semicolon)
|
|
|
|
++token_iterator;
|
|
|
|
|
2017-07-12 20:45:27 +00:00
|
|
|
/// If multi-statements are not allowed, then after semicolon, there must be no non-space characters.
|
2017-07-13 04:51:44 +00:00
|
|
|
if (!allow_multi_statements
|
2017-07-13 01:12:13 +00:00
|
|
|
&& !token_iterator->isEnd()
|
2017-07-12 20:45:27 +00:00
|
|
|
&& !(insert && insert->data))
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
2017-07-13 06:10:56 +00:00
|
|
|
out_error_message = getSyntaxErrorMessage(pos, end, last_token, {}, hilite,
|
2017-07-13 04:20:56 +00:00
|
|
|
(query_description.empty() ? std::string() : std::string(". ")) + "Multi-statements are not allowed");
|
2017-07-12 01:49:20 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2017-07-12 20:45:27 +00:00
|
|
|
pos = token_iterator->begin;
|
2017-04-01 07:20:54 +00:00
|
|
|
return res;
|
2015-04-11 03:10:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
const char * end,
|
2017-07-13 04:20:56 +00:00
|
|
|
const std::string & query_description,
|
2018-03-26 19:41:55 +00:00
|
|
|
bool allow_multi_statements,
|
2020-01-14 11:11:01 +00:00
|
|
|
size_t max_query_size,
|
|
|
|
size_t max_parser_depth)
|
2015-04-11 03:10:23 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
std::string error_message;
|
2020-01-14 11:11:01 +00:00
|
|
|
ASTPtr res = tryParseQuery(parser, pos, end, error_message, false, query_description, allow_multi_statements, max_query_size, max_parser_depth);
|
2015-04-11 03:10:23 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
if (res)
|
|
|
|
return res;
|
2015-04-11 03:10:23 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
throw Exception(error_message, ErrorCodes::SYNTAX_ERROR);
|
2015-04-11 03:10:23 +00:00
|
|
|
}
|
|
|
|
|
2015-04-14 20:46:34 +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 & query_description,
|
2020-01-14 11:11:01 +00:00
|
|
|
size_t max_query_size,
|
|
|
|
size_t max_parser_depth)
|
2015-04-14 20:46:34 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
auto pos = begin;
|
2020-01-14 11:11:01 +00:00
|
|
|
return parseQueryAndMovePosition(parser, pos, end, query_description, false, max_query_size, max_parser_depth);
|
2015-04-14 20:46:34 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 03:41:02 +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
|
|
|
{
|
2018-03-26 19:41:55 +00:00
|
|
|
return parseQuery(parser, query.data(), query.data() + query.size(), query_description, max_query_size);
|
2017-10-13 19:13:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-26 19:41:55 +00:00
|
|
|
ASTPtr parseQuery(IParser & parser, const std::string & query, size_t max_query_size)
|
2017-10-13 19:13:41 +00:00
|
|
|
{
|
2018-03-26 19:41:55 +00:00
|
|
|
return parseQuery(parser, query.data(), query.data() + query.size(), parser.getName(), max_query_size);
|
2017-10-13 19:13:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
ASTPtr ast;
|
2016-10-24 18:18:43 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
const char * begin = queries.data(); /// begin of current query
|
|
|
|
const char * pos = begin; /// parser moves pos from begin to the end of current query
|
|
|
|
const char * end = begin + queries.size();
|
2016-10-24 18:18:43 +00:00
|
|
|
|
2017-07-12 01:49:20 +00:00
|
|
|
ParserQuery parser(end);
|
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
queries_list.clear();
|
2016-10-24 18:18:43 +00:00
|
|
|
|
2017-07-12 01:49:20 +00:00
|
|
|
while (pos < end)
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
begin = pos;
|
2016-10-24 18:18:43 +00:00
|
|
|
|
2018-04-16 15:11:13 +00:00
|
|
|
ast = parseQueryAndMovePosition(parser, pos, end, "", true, 0);
|
2016-10-24 18:18:43 +00:00
|
|
|
|
2019-03-11 13:22:51 +00:00
|
|
|
auto * insert = ast->as<ASTInsertQuery>();
|
2016-10-24 18:18:43 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
if (insert && insert->data)
|
|
|
|
{
|
2017-07-10 03:41:02 +00:00
|
|
|
/// Data for INSERT is broken on new line
|
2017-04-01 07:20:54 +00:00
|
|
|
pos = insert->data;
|
|
|
|
while (*pos && *pos != '\n')
|
|
|
|
++pos;
|
|
|
|
insert->end = pos;
|
|
|
|
}
|
2016-10-24 18:18:43 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
queries_list.emplace_back(queries.substr(begin - queries.data(), pos - begin));
|
2016-10-24 18:18:43 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
while (isWhitespaceASCII(*pos) || *pos == ';')
|
|
|
|
++pos;
|
|
|
|
}
|
2016-10-24 18:18:43 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
return std::make_pair(begin, pos == end);
|
2016-10-24 18:18:43 +00:00
|
|
|
}
|
|
|
|
|
2017-10-13 19:13:41 +00:00
|
|
|
|
2015-04-11 03:10:23 +00:00
|
|
|
}
|