1#pragma once
2
3#include "FunctionsURL.h"
4#include <common/find_symbols.h>
5
6
7namespace DB
8{
9
10template <bool without_leading_char>
11struct ExtractQueryStringAndFragment
12{
13 static size_t getReserveLengthForElement() { return 20; }
14
15 static void execute(Pos data, size_t size, Pos & res_data, size_t & res_size)
16 {
17 res_data = data;
18 res_size = 0;
19
20 Pos end = data + size;
21 Pos pos;
22
23 if (end != (pos = find_first_symbols<'?'>(data, end)))
24 {
25 res_data = pos + (without_leading_char ? 1 : 0);
26 res_size = end - res_data;
27 }
28 else if (end != (pos = find_first_symbols<'#'>(data, end)))
29 {
30 res_data = pos;
31 res_size = end - res_data;
32 }
33 }
34};
35
36}
37
38