1 | #include <Functions/FunctionFactory.h> |
---|---|
2 | #include <Functions/FunctionsVisitParam.h> |
3 | #include <Functions/FunctionsStringSearch.h> |
4 | |
5 | |
6 | namespace DB |
7 | { |
8 | |
9 | struct ExtractString |
10 | { |
11 | static void extract(const UInt8 * pos, const UInt8 * end, ColumnString::Chars & res_data) |
12 | { |
13 | size_t old_size = res_data.size(); |
14 | ReadBufferFromMemory in(pos, end - pos); |
15 | if (!tryReadJSONStringInto(res_data, in)) |
16 | res_data.resize(old_size); |
17 | } |
18 | }; |
19 | |
20 | struct NameVisitParamExtractString { static constexpr auto name = "visitParamExtractString"; }; |
21 | using FunctionVisitParamExtractString = FunctionsStringSearchToString<ExtractParamToStringImpl<ExtractString>, NameVisitParamExtractString>; |
22 | |
23 | |
24 | void registerFunctionVisitParamExtractString(FunctionFactory & factory) |
25 | { |
26 | factory.registerFunction<FunctionVisitParamExtractString>(); |
27 | } |
28 | |
29 | } |
30 |