diff --git a/src/TableFunctions/ITableFunctionXDBC.cpp b/src/TableFunctions/ITableFunctionXDBC.cpp index 6d2b508aaa3..3d72d98e7ea 100644 --- a/src/TableFunctions/ITableFunctionXDBC.cpp +++ b/src/TableFunctions/ITableFunctionXDBC.cpp @@ -1,9 +1,6 @@ -#include -#include - -#include #include #include +#include #include #include #include @@ -16,10 +13,9 @@ #include #include #include -#include -#include #include "registerTableFunctions.h" + namespace DB { namespace ErrorCodes @@ -33,13 +29,12 @@ void ITableFunctionXDBC::parseArguments(const ASTPtr & ast_function, ContextPtr const auto & args_func = ast_function->as(); if (!args_func.arguments) - throw Exception("Table function '" + getName() + "' must have arguments.", ErrorCodes::LOGICAL_ERROR); + throw Exception(ErrorCodes::LOGICAL_ERROR, "Table function '{}' must have arguments.", getName()); ASTs & args = args_func.arguments->children; if (args.size() != 2 && args.size() != 3) - throw Exception("Table function '" + getName() + "' requires 2 or 3 arguments: " + getName() + "('DSN', table) or " + getName() - + "('DSN', schema, table)", - ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); + throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, + "Table function '{0}' requires 2 or 3 arguments: {0}('DSN', table) or {0}('DSN', schema, table)", getName()); for (auto & arg : args) arg = evaluateConstantExpressionOrIdentifierAsLiteral(arg, context); @@ -61,7 +56,6 @@ void ITableFunctionXDBC::startBridgeIfNot(ContextPtr context) const { if (!helper) { - /// Have to const_cast, because bridges store their commands inside context helper = createBridgeHelper(context, context->getSettingsRef().http_receive_timeout.value, connection_string); helper->startBridgeSync(); } @@ -71,16 +65,15 @@ ColumnsDescription ITableFunctionXDBC::getActualTableStructure(ContextPtr contex { startBridgeIfNot(context); - /* Infer external table structure */ + /// Infer external table structure. Poco::URI columns_info_uri = helper->getColumnsInfoURI(); columns_info_uri.addQueryParameter("connection_string", connection_string); if (!schema_name.empty()) columns_info_uri.addQueryParameter("schema", schema_name); columns_info_uri.addQueryParameter("table", remote_table_name); - const auto use_nulls = context->getSettingsRef().external_table_functions_use_nulls; - columns_info_uri.addQueryParameter("external_table_functions_use_nulls", - Poco::NumberFormatter::format(use_nulls)); + bool use_nulls = context->getSettingsRef().external_table_functions_use_nulls; + columns_info_uri.addQueryParameter("external_table_functions_use_nulls", toString(use_nulls)); Poco::Net::HTTPBasicCredentials credentials{}; ReadWriteBufferFromHTTP buf(columns_info_uri, Poco::Net::HTTPRequest::HTTP_POST, {}, ConnectionTimeouts::getHTTPTimeouts(context), credentials);