302700 {
302701 auto &config = ClientConfig::GetConfig(context);
302702 auto parameter = input.
ToString();
302703
302704 if (!parameter.empty() && config.profiler_print_format != ProfilerPrintFormat::NO_OUTPUT) {
302705 auto &file_system = FileSystem::GetFileSystem(context);
302706 const auto file_type = file_system.ExtractExtension(parameter);
302707 if (file_type != "txt") {
302708 try {
302709 EnumUtil::FromString<ProfilerPrintFormat>(file_type);
302710 } catch (std::exception &e) {
302711 throw ParserException("Invalid output file type: %s", file_type);
302712 }
302713 }
302714
302715 const auto printer_format =
StringUtil::Lower(EnumUtil::ToString(config.profiler_print_format));
302716 if (file_type != printer_format && file_type != "txt") {
302717 throw ParserException("Profiler file type (%s) must either have the same file extension as the profiling "
302718 "output type (%s), or be a '.txt' file. Set \"enable_profiling = \'%s\'\" first.",
302719 parameter, printer_format, file_type);
302720 }
302721 }
302722
302723 config.profiler_save_location = parameter;
302724}
static DUCKDB_API string Lower(const string &str)
Convert a string to lowercase.
Definition duckdb.cpp:109630
DUCKDB_API string ToString() const
Convert this value to a string.
Definition duckdb.cpp:133318