ClickHouse/src/Functions/base64Decode.cpp

25 lines
1.2 KiB
C++
Raw Normal View History

2018-10-11 16:22:50 +00:00
#include <Functions/FunctionBase64Conversion.h>
2018-10-11 16:22:50 +00:00
#if USE_BASE64
2019-06-20 09:12:49 +00:00
#include <Functions/FunctionFactory.h>
2018-10-10 01:04:07 +00:00
namespace DB
{
REGISTER_FUNCTION(Base64Decode)
2018-10-10 01:04:07 +00:00
{
FunctionDocumentation::Description description = R"(Accepts a String and decodes it from base64, according to RFC 4648 (https://datatracker.ietf.org/doc/html/rfc4648#section-4). Throws an exception in case of an error. Alias: FROM_BASE64.)";
FunctionDocumentation::Syntax syntax = "base64Decode(encoded)";
FunctionDocumentation::Arguments arguments = {{"encoded", "String column or constant. If the string is not a valid Base64-encoded value, an exception is thrown."}};
FunctionDocumentation::ReturnedValue returned_value = "A string containing the decoded value of the argument.";
FunctionDocumentation::Examples examples = {{"Example", "SELECT base64Decode('Y2xpY2tob3VzZQ==')", "clickhouse"}};
FunctionDocumentation::Categories categories = {"String encoding"};
factory.registerFunction<FunctionBase64Conversion<Base64Decode<Base64Variant::Normal>>>({description, syntax, arguments, returned_value, examples, categories});
2023-09-09 16:48:17 +00:00
/// MySQL compatibility alias.
factory.registerAlias("FROM_BASE64", "base64Decode", FunctionFactory::CaseInsensitive);
2018-10-10 01:04:07 +00:00
}
2018-10-11 16:22:50 +00:00
}
2018-11-23 18:54:23 +00:00
#endif