Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cpp/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ takes precedence over ccache if a storage backend is configured" ON)
"Build the Arrow Flight SQL ODBC extension"
OFF
DEPENDS
ARROW_FLIGHT_SQL)
ARROW_FLIGHT_SQL
ARROW_COMPUTE)

define_option(ARROW_GANDIVA
"Build the Gandiva libraries"
Expand Down
12 changes: 11 additions & 1 deletion cpp/src/arrow/flight/sql/odbc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ if(WIN32)
list(APPEND ARROW_FLIGHT_SQL_ODBC_SRCS odbc.def)
endif()

if(WIN32)
if (MSVC_VERSION GREATER_EQUAL 1900)
set(ODBCINST legacy_stdio_definitions odbccp32 shlwapi)
endif()
elseif(APPLE)
set(ODBCINST iodbcinst)
else()
set(ODBCINST odbcinst)
endif()

add_arrow_lib(arrow_flight_sql_odbc
CMAKE_PACKAGE_NAME ArrowFlightSqlOdbc
PKG_CONFIG_NAME arrow-flight-sql-odbc
Expand All @@ -54,7 +64,7 @@ add_arrow_lib(arrow_flight_sql_odbc
SHARED_INSTALL_INTERFACE_LIBS ArrowFlight::arrow_flight_sql_shared
STATIC_LINK_LIBS arrow_flight_sql_static
STATIC_INSTALL_INTERFACE_LIBS ArrowFlight::arrow_flight_sql_static
SHARED_PRIVATE_LINK_LIBS ODBC::ODBC odbcabstraction arrow_odbc_spi_impl)
SHARED_PRIVATE_LINK_LIBS ${ODBC_LIBRARIES} ${ODBCINST} odbcabstraction arrow_odbc_spi_impl)

foreach(LIB_TARGET ${ARROW_FLIGHT_SQL_ODBC_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_FLIGHT_SQL_ODBC_EXPORTING)
Expand Down
89 changes: 37 additions & 52 deletions cpp/src/arrow/flight/sql/odbc/flight_sql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,38 +88,35 @@ add_library(arrow_odbc_spi_impl
flight_sql_statement_get_type_info.h
flight_sql_stream_chunk_buffer.cc
flight_sql_stream_chunk_buffer.h
# TODO - fix build issues from get_info_cache
# get_info_cache.cc
# get_info_cache.h
get_info_cache.cc
get_info_cache.h
json_converter.cc
json_converter.h
record_batch_transformer.cc
record_batch_transformer.h
scalar_function_reporter.cc
scalar_function_reporter.h
# TODO - fix build issues from system_trust_store
# system_trust_store.cc
# system_trust_store.h
system_trust_store.cc
system_trust_store.h
utils.cc)
target_include_directories(arrow_odbc_spi_impl PUBLIC ${CMAKE_CURRENT_LIST_DIR})

# TODO - fix build errors with configuration window
# if(WIN32)
# target_sources(arrow_odbc_spi_impl PRIVATE
# include/flight_sql/config/configuration.h
# include/flight_sql/config/connection_string_parser.h
# include/flight_sql/ui/add_property_window.h
# include/flight_sql/ui/custom_window.h
# include/flight_sql/ui/dsn_configuration_window.h
# include/flight_sql/ui/window.h
# config/configuration.cc
# config/connection_string_parser.cc
# ui/custom_window.cc
# ui/window.cc
# ui/dsn_configuration_window.cc
# ui/add_property_window.cc
# system_dsn.cc)
# endif()
if(WIN32)
target_sources(arrow_odbc_spi_impl PRIVATE
include/flight_sql/config/configuration.h
include/flight_sql/config/connection_string_parser.h
include/flight_sql/ui/add_property_window.h
include/flight_sql/ui/custom_window.h
include/flight_sql/ui/dsn_configuration_window.h
include/flight_sql/ui/window.h
config/configuration.cc
config/connection_string_parser.cc
ui/custom_window.cc
ui/window.cc
ui/dsn_configuration_window.cc
ui/add_property_window.cc
system_dsn.cc)
endif()

find_package(ArrowFlightSql)

Expand Down Expand Up @@ -160,32 +157,20 @@ set_target_properties(arrow_odbc_spi_impl_cli
target_link_libraries(arrow_odbc_spi_impl_cli arrow_odbc_spi_impl)

# Unit tests
# TODO - fix test build errors and enable "Run tests" command
# add_executable(arrow_odbc_spi_impl_test
# accessors/boolean_array_accessor_test.cc
# accessors/binary_array_accessor_test.cc
# accessors/date_array_accessor_test.cc
# accessors/decimal_array_accessor_test.cc
# accessors/primitive_array_accessor_test.cc
# accessors/string_array_accessor_test.cc
# accessors/time_array_accessor_test.cc
# accessors/timestamp_array_accessor_test.cc
# flight_sql_connection_test.cc
# parse_table_types_test.cc
# json_converter_test.cc
# record_batch_transformer_test.cc
# utils_test.cc)

# set_target_properties(arrow_odbc_spi_impl_test
# PROPERTIES RUNTIME_OUTPUT_DIRECTORY
# ${CMAKE_BINARY_DIR}/test/$<CONFIG>/bin)
# target_link_libraries(arrow_odbc_spi_impl_test arrow_odbc_spi_impl gtest gtest_main)

# add_test(connection_test arrow_odbc_spi_impl_test)
# add_test(transformer_test arrow_odbc_spi_impl_test)

# add_custom_command(TARGET arrow_odbc_spi_impl_test
# COMMENT "Run tests"
# POST_BUILD
# COMMAND ${CMAKE_BINARY_DIR}/test/$<CONFIG>/bin/arrow_odbc_spi_impl_test
# )
add_arrow_test(arrow_odbc_spi_impl_test
SOURCES
accessors/boolean_array_accessor_test.cc
accessors/binary_array_accessor_test.cc
accessors/date_array_accessor_test.cc
accessors/decimal_array_accessor_test.cc
accessors/primitive_array_accessor_test.cc
accessors/string_array_accessor_test.cc
accessors/time_array_accessor_test.cc
accessors/timestamp_array_accessor_test.cc
flight_sql_connection_test.cc
parse_table_types_test.cc
json_converter_test.cc
record_batch_transformer_test.cc
utils_test.cc
EXTRA_LINK_LIBS
arrow_odbc_spi_impl)
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace {

using namespace arrow;
namespace driver::odbcabstraction {
using namespace driver::odbcabstraction;

using driver::flight_sql::ThrowIfNotOK;

Expand Down Expand Up @@ -59,7 +59,7 @@ std::string ConvertNumericToString(NUMERIC_STRUCT& numeric) {

return string;
}
} // namespace driver::odbcabstraction
}

namespace driver {
namespace flight_sql {
Expand Down Expand Up @@ -121,4 +121,3 @@ TEST(DecimalArrayFlightSqlAccessor,

} // namespace flight_sql
} // namespace driver
} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

#include "arrow/flight/sql/odbc/flight_sql/timestamp_array_accessor.h"
#include "arrow/flight/sql/odbc/flight_sql/accessors/timestamp_array_accessor.h"
#include "arrow/flight/sql/odbc/flight_sql/utils.h"
#include "arrow/testing/builder.h"
#include "gtest/gtest.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
// under the License.

#include "arrow/flight/sql/odbc/flight_sql/include/flight_sql/config/configuration.h"
#include "arrow/flight/sql/odbc/flight_sql/flight_sql_connection.h"

#include <sstream>
#include <iterator>
#include <odbcinst.h>
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <iterator>
#include <sstream>
#include "arrow/flight/sql/odbc/flight_sql/flight_sql_connection.h"

namespace driver {
namespace flight_sql {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include <utility>

using namespace driver::flight_sql; //-AL- todo see if this is needed.
using namespace driver::flight_sql;

namespace driver {
namespace flight_sql {
Expand Down
18 changes: 3 additions & 15 deletions cpp/src/arrow/flight/sql/odbc/flight_sql/flight_sql_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
#include <sql.h>
#include <sqlext.h>

// TODO - fix build issues from system_trust_store
// #include "arrow/flight/sql/odbc/flight_sql/system_trust_store.h"
#include "arrow/flight/sql/odbc/flight_sql/system_trust_store.h"

#ifndef NI_MAXHOST
# define NI_MAXHOST 1025
Expand Down Expand Up @@ -106,9 +105,6 @@ constexpr auto SYSTEM_TRUST_STORE_DEFAULT = true;
constexpr auto STORES = {"CA", "MY", "ROOT", "SPC"};

inline std::string GetCerts() {
// TODO - fix build issues from system_trust_store and return proper value
return "";
/*
std::string certs;

for (auto store : STORES) {
Expand All @@ -125,7 +121,6 @@ inline std::string GetCerts() {
}

return certs;
*/
}

#else
Expand Down Expand Up @@ -209,8 +204,7 @@ void FlightSqlConnection::Connect(const ConnPropertyMap& properties,
// connection properties to allow reporting a user for other auth mechanisms
// and also decouple the database user from user credentials.

// TODO - fix build issues from get_info_cache
// info_.SetProperty(SQL_USER_NAME, auth_method->GetUser());
info_.SetProperty(SQL_USER_NAME, auth_method->GetUser());
attribute_[CONNECTION_DEAD] = static_cast<uint32_t>(SQL_FALSE);

PopulateMetadataSettings(properties);
Expand Down Expand Up @@ -432,26 +426,20 @@ boost::optional<Connection::Attribute> FlightSqlConnection::GetAttribute(
}

Connection::Info FlightSqlConnection::GetInfo(uint16_t info_type) {
// TODO - fix build issues from get_info_cache and return proper value.
uint16_t result = 0;
return result;
/*
auto result = info_.GetInfo(info_type);
if (info_type == SQL_DBMS_NAME || info_type == SQL_SERVER_NAME) {
// Update the database component reported in error messages.
// We do this lazily for performance reasons.
diagnostics_.SetDataSourceComponent(boost::get<std::string>(result));
}
return result;
*/
}

FlightSqlConnection::FlightSqlConnection(OdbcVersion odbc_version,
const std::string& driver_version)
: diagnostics_("Apache Arrow", "Flight SQL", odbc_version),
odbc_version_(odbc_version),
// TODO - fix build issues from get_info_cache and set proper value.
// info_(call_options_, sql_client_, driver_version),
info_(call_options_, sql_client_, driver_version),
closed_(true) {
attribute_[CONNECTION_DEAD] = static_cast<uint32_t>(SQL_TRUE);
attribute_[LOGIN_TIMEOUT] = static_cast<uint32_t>(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

#include "arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/spi/connection.h"

#include <vector>

#include "arrow/flight/api.h"
#include "arrow/flight/sql/api.h"
#include <vector>

// TODO - fix build issues from get_info_cache
// #include "arrow/flight/sql/odbc/flight_sql/get_info_cache.h"
#include "arrow/flight/sql/odbc/flight_sql/get_info_cache.h"
#include "arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/types.h"

namespace driver {
Expand All @@ -46,8 +46,7 @@ class FlightSqlConnection : public odbcabstraction::Connection {
arrow::flight::FlightClientOptions client_options_;
arrow::flight::FlightCallOptions call_options_;
std::unique_ptr<arrow::flight::sql::FlightSqlClient> sql_client_;
// TODO - fix build issues from get_info_cache
// GetInfoCache info_;
GetInfoCache info_;
odbcabstraction::Diagnostics diagnostics_;
odbcabstraction::OdbcVersion odbc_version_;
bool closed_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ TEST(BuildLocationTests, ForTcp) {
missing_attr, ssl_config);

Location expected_location;
ASSERT_TRUE(Location::ForGrpcTcp("localhost", 32010, &expected_location).ok());
ASSERT_TRUE(Location::ForGrpcTcp("localhost", 32010).Value(&expected_location).ok());
ASSERT_EQ(expected_location, actual_location1);
ASSERT_NE(expected_location, actual_location2);
}
Expand Down Expand Up @@ -204,3 +204,8 @@ TEST(PopulateCallOptionsTest, GenericOptionWithSpaces) {

} // namespace flight_sql
} // namespace driver

int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Loading