| 1 | #include <Functions/FunctionFactory.h> |
|---|---|
| 2 | #include <Functions/FunctionStringToString.h> |
| 3 | #include "FunctionsURL.h" |
| 4 | #include <common/find_symbols.h> |
| 5 | |
| 6 | namespace DB |
| 7 | { |
| 8 | |
| 9 | struct ExtractPathFull |
| 10 | { |
| 11 | static size_t getReserveLengthForElement() { return 30; } |
| 12 | |
| 13 | static void execute(const Pos data, const size_t size, Pos & res_data, size_t & res_size) |
| 14 | { |
| 15 | res_data = data; |
| 16 | res_size = 0; |
| 17 | |
| 18 | Pos pos = data; |
| 19 | Pos end = pos + size; |
| 20 | |
| 21 | if (end != (pos = find_first_symbols<'/'>(pos, end)) && pos[1] == '/' && end != (pos = find_first_symbols<'/'>(pos + 2, end))) |
| 22 | { |
| 23 | res_data = pos; |
| 24 | res_size = end - res_data; |
| 25 | } |
| 26 | } |
| 27 | }; |
| 28 | |
| 29 | struct NamePathFull { static constexpr auto name = "pathFull"; }; |
| 30 | using FunctionPathFull = FunctionStringToString<ExtractSubstringImpl<ExtractPathFull>, NamePathFull>; |
| 31 | |
| 32 | void registerFunctionPathFull(FunctionFactory & factory) |
| 33 | { |
| 34 | factory.registerFunction<FunctionPathFull>(); |
| 35 | } |
| 36 | |
| 37 | } |
| 38 |