blob: 603450d102b83b231684ad00c67f1e4ae5691a53 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#pragma once
#include <base/find_symbols.h>
#include <Functions/StringHelpers.h>
namespace DB
{
template <bool without_leading_char>
struct ExtractQueryString
{
static size_t getReserveLengthForElement() { return 10; }
static void execute(Pos data, size_t size, Pos & res_data, size_t & res_size)
{
res_data = data;
res_size = 0;
Pos pos = data;
Pos end = pos + size;
if (end != (pos = find_first_symbols<'?'>(pos, end)))
{
Pos fragment = find_first_symbols<'#'>(pos, end);
res_data = pos + (without_leading_char ? 1 : 0);
res_size = fragment - res_data;
}
}
};
}
|