1#include <Functions/FunctionFactory.h>
2#include <Functions/FunctionsVisitParam.h>
3#include <Functions/FunctionsStringSearch.h>
4
5
6namespace DB
7{
8
9struct ExtractBool
10{
11 using ResultType = UInt8;
12
13 static UInt8 extract(const UInt8 * begin, const UInt8 * end)
14 {
15 return begin + 4 <= end && 0 == strncmp(reinterpret_cast<const char *>(begin), "true", 4);
16 }
17};
18
19struct NameVisitParamExtractBool { static constexpr auto name = "visitParamExtractBool"; };
20using FunctionVisitParamExtractBool = FunctionsStringSearch<ExtractParamImpl<ExtractBool>, NameVisitParamExtractBool>;
21
22
23void registerFunctionVisitParamExtractBool(FunctionFactory & factory)
24{
25 factory.registerFunction<FunctionVisitParamExtractBool>();
26}
27
28}
29