From e1cc8289b24b8350f800731d99d2e37cd2b63b6b Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Fri, 21 Jul 2017 09:46:50 +0300 Subject: [PATCH] Fixed error after merge [#CLICKHOUSE-3150]. --- dbms/src/Functions/FunctionsMiscellaneous.cpp | 34 +++++++++---------- dbms/src/IO/ReadHelpers.cpp | 2 +- dbms/src/IO/WriteHelpers.h | 2 +- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/dbms/src/Functions/FunctionsMiscellaneous.cpp b/dbms/src/Functions/FunctionsMiscellaneous.cpp index 72c41f25209..fdb62513585 100644 --- a/dbms/src/Functions/FunctionsMiscellaneous.cpp +++ b/dbms/src/Functions/FunctionsMiscellaneous.cpp @@ -1755,35 +1755,33 @@ void FunctionHasColumnInTable::executeImpl(Block & block, const ColumnNumbers & }; size_t arg = 0; - const String * host_name = nullptr; - const String * user_name = nullptr; - const String * password = nullptr; + String host_name; + String user_name; + String password; + if (arguments.size() > 3) - { - host_name = &get_string_from_block(arguments[arg++]); - } + host_name = get_string_from_block(arguments[arg++]); + if (arguments.size() > 4) - { - user_name = &get_string_from_block(arguments[arg++]); - } + user_name = get_string_from_block(arguments[arg++]); + if (arguments.size() > 5) - { - password = &get_string_from_block(arguments[arg++]); - } - const String & database_name = get_string_from_block(arguments[arg++]); - const String & table_name = get_string_from_block(arguments[arg++]); - const String & column_name = get_string_from_block(arguments[arg++]); + password = get_string_from_block(arguments[arg++]); + + String database_name = get_string_from_block(arguments[arg++]); + String table_name = get_string_from_block(arguments[arg++]); + String column_name = get_string_from_block(arguments[arg++]); bool has_column; - if (host_name == nullptr) + if (host_name.empty()) { const StoragePtr & table = global_context.getTable(database_name, table_name); has_column = table->hasColumn(column_name); } else { - std::vector> host_names = {{ *host_name }}; - auto cluster = std::make_shared(global_context.getSettings(), host_names, user_name != nullptr ? *user_name : "default", password != nullptr ? *password : ""); + std::vector> host_names = {{ host_name }}; + auto cluster = std::make_shared(global_context.getSettings(), host_names, !user_name.empty() ? *user_name : "default", password); auto names_and_types_list = std::make_shared(getStructureOfRemoteTable(*cluster, database_name, table_name, global_context)); const auto & names = names_and_types_list->getNames(); has_column = std::find(names.begin(), names.end(), column_name) != names.end(); diff --git a/dbms/src/IO/ReadHelpers.cpp b/dbms/src/IO/ReadHelpers.cpp index 55d0c502889..f0aed1c356d 100644 --- a/dbms/src/IO/ReadHelpers.cpp +++ b/dbms/src/IO/ReadHelpers.cpp @@ -20,7 +20,7 @@ namespace ErrorCodes } template -void parseHex(IteratorSrc __restrict src, IteratorDst __restrict dst, const size_t num_bytes) +void parseHex(IteratorSrc src, IteratorDst dst, const size_t num_bytes) { size_t src_pos = 0; size_t dst_pos = 0; diff --git a/dbms/src/IO/WriteHelpers.h b/dbms/src/IO/WriteHelpers.h index f7d165c5795..295817302a6 100644 --- a/dbms/src/IO/WriteHelpers.h +++ b/dbms/src/IO/WriteHelpers.h @@ -476,7 +476,7 @@ inline void writeXMLString(const StringRef & s, WriteBuffer & buf) } template -void formatHex(IteratorSrc __restrict src, IteratorDst __restrict dst, const size_t num_bytes); +void formatHex(IteratorSrc src, IteratorDst dst, const size_t num_bytes); void formatUUID(const UInt8 * src16, UInt8 * dst36); void formatUUID(std::reverse_iterator dst16, UInt8 * dst36);