MCPcopy Create free account
hub / github.com/ByConity/ByConity / splitMultipartQuery

Function splitMultipartQuery

src/Parsers/parseQuery.cpp:407–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405
406
407std::pair<const char *, bool> splitMultipartQuery(
408 const std::string & queries,
409 std::vector<std::string> & queries_list,
410 size_t max_query_size,
411 size_t max_parser_depth,
412 ParserSettingsImpl dialect_type)
413{
414 ASTPtr ast;
415
416 const char * begin = queries.data(); /// begin of current query
417 const char * pos = begin; /// parser moves pos from begin to the end of current query
418 const char * end = begin + queries.size();
419
420 ParserQuery parser(end, dialect_type);
421
422 queries_list.clear();
423
424 while (pos < end)
425 {
426 begin = pos;
427
428 ast = parseQueryAndMovePosition(parser, pos, end, "", true, max_query_size, max_parser_depth);
429
430 auto * insert = ast->as<ASTInsertQuery>();
431
432 if (insert && insert->data)
433 {
434 /// Data for INSERT is broken on new line
435 pos = insert->data;
436 while (*pos && *pos != '\n')
437 ++pos;
438 insert->end = pos;
439 }
440
441 queries_list.emplace_back(queries.substr(begin - queries.data(), pos - begin));
442
443 while (isWhitespaceASCII(*pos) || *pos == ';')
444 ++pos;
445 }
446
447 return std::make_pair(begin, pos == end);
448}
449
450
451}

Callers 2

processQueriesMethod · 0.85
processQueryMethod · 0.85

Calls 6

isWhitespaceASCIIFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected