From e0e81b340d33157a054c0e5258a48950b3885599 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Tue, 18 Jan 2022 09:49:10 +0300 Subject: [PATCH] Fix w/o ODBC build --- base/bridge/IBridge.cpp | 1 + contrib/nanodbc-cmake/CMakeLists.txt | 4 ++-- contrib/unixodbc-cmake/CMakeLists.txt | 1 - programs/odbc-bridge/ColumnInfoHandler.h | 3 ++- programs/odbc-bridge/HandlerFactory.cpp | 1 + programs/odbc-bridge/IdentifierQuoteHandler.h | 2 +- programs/odbc-bridge/MainHandler.cpp | 1 + programs/odbc-bridge/SchemaAllowedHandler.h | 1 + programs/odbc-bridge/getIdentifierQuote.h | 2 ++ src/Common/config.h.in | 1 + src/Core/config_core.h.in | 1 + src/Dictionaries/XDBCDictionarySource.cpp | 1 + .../System/StorageSystemBuildOptions.generated.cpp.in | 1 + src/configure_config.cmake | 3 +++ 14 files changed, 18 insertions(+), 5 deletions(-) diff --git a/base/bridge/IBridge.cpp b/base/bridge/IBridge.cpp index 553973b645d..4c808278ed0 100644 --- a/base/bridge/IBridge.cpp +++ b/base/bridge/IBridge.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include diff --git a/contrib/nanodbc-cmake/CMakeLists.txt b/contrib/nanodbc-cmake/CMakeLists.txt index b1f4d867685..8b5a70e65df 100644 --- a/contrib/nanodbc-cmake/CMakeLists.txt +++ b/contrib/nanodbc-cmake/CMakeLists.txt @@ -4,7 +4,7 @@ endif () set (LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/nanodbc") -if (NOT TARGET unixodbc) +if (NOT TARGET ch_contrib::unixodbc) message(FATAL_ERROR "Configuration error: unixodbc is not a target") endif() @@ -14,6 +14,6 @@ set (SRCS add_library(nanodbc ${SRCS}) -target_link_libraries (nanodbc PUBLIC unixodbc) +target_link_libraries (nanodbc PUBLIC ch_contrib::unixodbc) target_include_directories (nanodbc SYSTEM PUBLIC "${LIBRARY_DIR}/") add_library(ch_contrib::nanodbc ALIAS nanodbc) diff --git a/contrib/unixodbc-cmake/CMakeLists.txt b/contrib/unixodbc-cmake/CMakeLists.txt index ca0742326de..9adf9ce6d79 100644 --- a/contrib/unixodbc-cmake/CMakeLists.txt +++ b/contrib/unixodbc-cmake/CMakeLists.txt @@ -303,6 +303,5 @@ target_compile_options (unixodbc -Wno-reserved-id-macro -O2 ) -target_compile_definitions (unixodbc INTERFACE USE_ODBC=1) add_library (ch_contrib::unixodbc ALIAS unixodbc) diff --git a/programs/odbc-bridge/ColumnInfoHandler.h b/programs/odbc-bridge/ColumnInfoHandler.h index bc976f54aee..76c0103d604 100644 --- a/programs/odbc-bridge/ColumnInfoHandler.h +++ b/programs/odbc-bridge/ColumnInfoHandler.h @@ -1,11 +1,12 @@ #pragma once +#include + #if USE_ODBC #include #include #include -#include #include diff --git a/programs/odbc-bridge/HandlerFactory.cpp b/programs/odbc-bridge/HandlerFactory.cpp index 6a5ef89ab8b..1a6df287a5c 100644 --- a/programs/odbc-bridge/HandlerFactory.cpp +++ b/programs/odbc-bridge/HandlerFactory.cpp @@ -1,6 +1,7 @@ #include "HandlerFactory.h" #include "PingHandler.h" #include "ColumnInfoHandler.h" +#include #include #include #include diff --git a/programs/odbc-bridge/IdentifierQuoteHandler.h b/programs/odbc-bridge/IdentifierQuoteHandler.h index ef3806fd802..23ffd84663b 100644 --- a/programs/odbc-bridge/IdentifierQuoteHandler.h +++ b/programs/odbc-bridge/IdentifierQuoteHandler.h @@ -2,7 +2,7 @@ #include #include - +#include #include #if USE_ODBC diff --git a/programs/odbc-bridge/MainHandler.cpp b/programs/odbc-bridge/MainHandler.cpp index 82d1bd61c24..1252d1ae70a 100644 --- a/programs/odbc-bridge/MainHandler.cpp +++ b/programs/odbc-bridge/MainHandler.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/programs/odbc-bridge/SchemaAllowedHandler.h b/programs/odbc-bridge/SchemaAllowedHandler.h index d7b922ed05b..7afa77ca091 100644 --- a/programs/odbc-bridge/SchemaAllowedHandler.h +++ b/programs/odbc-bridge/SchemaAllowedHandler.h @@ -2,6 +2,7 @@ #include #include +#include #include #if USE_ODBC diff --git a/programs/odbc-bridge/getIdentifierQuote.h b/programs/odbc-bridge/getIdentifierQuote.h index f4227af5c07..a7620da2291 100644 --- a/programs/odbc-bridge/getIdentifierQuote.h +++ b/programs/odbc-bridge/getIdentifierQuote.h @@ -1,5 +1,7 @@ #pragma once +#include + #if USE_ODBC #include diff --git a/src/Common/config.h.in b/src/Common/config.h.in index 47d56ca6abd..1ac07af574c 100644 --- a/src/Common/config.h.in +++ b/src/Common/config.h.in @@ -18,3 +18,4 @@ #cmakedefine01 USE_BZIP2 #cmakedefine01 USE_SNAPPY #cmakedefine01 USE_HIVE +#cmakedefine01 USE_ODBC diff --git a/src/Core/config_core.h.in b/src/Core/config_core.h.in index de37190b394..481849f6977 100644 --- a/src/Core/config_core.h.in +++ b/src/Core/config_core.h.in @@ -16,3 +16,4 @@ #cmakedefine01 USE_NLP #cmakedefine01 USE_KRB5 #cmakedefine01 USE_FILELOG +#cmakedefine01 USE_ODBC diff --git a/src/Dictionaries/XDBCDictionarySource.cpp b/src/Dictionaries/XDBCDictionarySource.cpp index ab7cf65eb8b..e95094cac47 100644 --- a/src/Dictionaries/XDBCDictionarySource.cpp +++ b/src/Dictionaries/XDBCDictionarySource.cpp @@ -18,6 +18,7 @@ #include #include #include +#include namespace DB diff --git a/src/Storages/System/StorageSystemBuildOptions.generated.cpp.in b/src/Storages/System/StorageSystemBuildOptions.generated.cpp.in index 6e3163c7641..a14f4996d52 100644 --- a/src/Storages/System/StorageSystemBuildOptions.generated.cpp.in +++ b/src/Storages/System/StorageSystemBuildOptions.generated.cpp.in @@ -42,6 +42,7 @@ const char * auto_config_build[] "USE_SSL", "@USE_SSL@", "USE_HYPERSCAN", "@ENABLE_HYPERSCAN@", "USE_SIMDJSON", "@USE_SIMDJSON@", + "USE_ODBC", "@USE_ODBC@", "USE_GRPC", "@USE_GRPC@", "USE_LDAP", "@USE_LDAP@", "TZDATA_VERSION", "@TZDATA_VERSION@", diff --git a/src/configure_config.cmake b/src/configure_config.cmake index 278148d2c1c..af19c24b594 100644 --- a/src/configure_config.cmake +++ b/src/configure_config.cmake @@ -85,3 +85,6 @@ endif() if (TARGET ch_contrib::llvm) set(USE_EMBEDDED_COMPILER 1) endif() +if (TARGET ch_contrib::unixodbc) + set(USE_ODBC 1) +endif()