diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/CMakeLists.txt b/cpp/src/flightsql_odbc/flightsql-odbc/CMakeLists.txt index cd7966fac61d7..2f8ff5216c0cc 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/CMakeLists.txt +++ b/cpp/src/flightsql_odbc/flightsql-odbc/CMakeLists.txt @@ -4,7 +4,7 @@ # cmake_minimum_required(VERSION 3.11) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) project(flightsql_odbc) diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/CMakeLists.txt b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/CMakeLists.txt index c2fb049d29db9..50b41f9918479 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/CMakeLists.txt +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/CMakeLists.txt @@ -4,7 +4,7 @@ # cmake_minimum_required(VERSION 3.11) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -115,7 +115,7 @@ endif() # If build fails, need to remove build folder to re-build. set(ARROW_GIT_REPOSITORY "https://github.com/apache/arrow.git" CACHE STRING "Arrow repository path or URL") -set(ARROW_GIT_TAG "b050bd0d31db6412256cec3362c0d57c9732e1f2" CACHE STRING "Tag for the Arrow repository") +set(ARROW_GIT_TAG "apache-arrow-14.0.1" CACHE STRING "Tag for the Arrow repository") message("Using Arrow from ${ARROW_GIT_REPOSITORY} on tag ${ARROW_GIT_TAG}") ExternalProject_Add( @@ -134,7 +134,7 @@ link_directories(${CMAKE_CURRENT_BINARY_DIR}/ApacheArrow-prefix/src/ApacheArrow- if (MSVC) # the following definitions stop arrow from using __declspec when staticly linking and will break on windows without them - add_compile_definitions(ARROW_STATIC ARROW_FLIGHT_STATIC) + add_compile_definitions(ARROW_STATIC ARROW_FLIGHT_STATIC ARROW_FLIGHT_SQL_STATIC) endif() enable_testing() diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_auth_method.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_auth_method.cc index ac4ae67eddfbe..ad49259f03158 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_auth_method.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_auth_method.cc @@ -66,10 +66,10 @@ class UserPasswordAuthMethod : public FlightSqlAuthMethod { FlightCallOptions auth_call_options; const boost::optional &login_timeout = connection.GetAttribute(Connection::LOGIN_TIMEOUT); - if (login_timeout && boost::get(*login_timeout) > 0) { + if (login_timeout && std::get(*login_timeout) > 0) { // ODBC's LOGIN_TIMEOUT attribute and FlightCallOptions.timeout use // seconds as time unit. - double timeout_seconds = static_cast(boost::get(*login_timeout)); + double timeout_seconds = static_cast(std::get(*login_timeout)); if (timeout_seconds > 0) { auth_call_options.timeout = TimeoutDuration{timeout_seconds}; } diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_connection.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_connection.cc index d0b62888dec74..eaa5bb18ebed9 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_connection.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_connection.cc @@ -174,7 +174,7 @@ void FlightSqlConnection::Connect(const ConnPropertyMap &properties, std::unique_ptr flight_client; ThrowIfNotOK( - FlightClient::Connect(location, client_options, &flight_client)); + FlightClient::Connect(location, client_options).Value(&flight_client)); std::unique_ptr auth_method = FlightSqlAuthMethod::FromProperties(flight_client, properties); @@ -251,9 +251,9 @@ FlightSqlConnection::PopulateCallOptions(const ConnPropertyMap &props) { // is the first request. const boost::optional &connection_timeout = closed_ ? GetAttribute(LOGIN_TIMEOUT) : GetAttribute(CONNECTION_TIMEOUT); - if (connection_timeout && boost::get(*connection_timeout) > 0) { + if (connection_timeout && std::get(*connection_timeout) > 0) { call_options_.timeout = - TimeoutDuration{static_cast(boost::get(*connection_timeout))}; + TimeoutDuration{static_cast(std::get(*connection_timeout))}; } for (auto prop : props) { @@ -342,7 +342,7 @@ FlightSqlConnection::BuildLocation(const ConnPropertyMap &properties, operation_result = address_info.GetAddressInfo(host, host_name_info, NI_MAXHOST); if (operation_result) { - ThrowIfNotOK(Location::ForGrpcTls(host_name_info, port, &location)); + ThrowIfNotOK(Location::ForGrpcTls(host_name_info, port).Value(&location)); return location; } // TODO: We should log that we could not convert an IP to hostname here. @@ -353,11 +353,11 @@ FlightSqlConnection::BuildLocation(const ConnPropertyMap &properties, // if it is not an IP. } - ThrowIfNotOK(Location::ForGrpcTls(host, port, &location)); + ThrowIfNotOK(Location::ForGrpcTls(host, port).Value(&location)); return location; } - ThrowIfNotOK(Location::ForGrpcTcp(host, port, &location)); + ThrowIfNotOK(Location::ForGrpcTcp(host, port).Value(&location)); return location; } @@ -415,7 +415,7 @@ Connection::Info FlightSqlConnection::GetInfo(uint16_t 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(result)); + diagnostics_.SetDataSourceComponent(std::get(result)); } return result; } diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_connection_test.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_connection_test.cc index 9369f007e7c43..395cae007d320 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_connection_test.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_connection_test.cc @@ -28,7 +28,7 @@ TEST(AttributeTests, SetAndGetAttribute) { EXPECT_TRUE(firstValue); - EXPECT_EQ(boost::get(*firstValue), static_cast(200)); + EXPECT_EQ(std::get(*firstValue), static_cast(200)); connection.SetAttribute(Connection::CONNECTION_TIMEOUT, static_cast(300)); @@ -36,7 +36,7 @@ TEST(AttributeTests, SetAndGetAttribute) { connection.GetAttribute(Connection::CONNECTION_TIMEOUT); EXPECT_TRUE(changeValue); - EXPECT_EQ(boost::get(*changeValue), static_cast(300)); + EXPECT_EQ(std::get(*changeValue), static_cast(300)); connection.Close(); } @@ -48,7 +48,7 @@ TEST(AttributeTests, GetAttributeWithoutSetting) { connection.GetAttribute(Connection::CONNECTION_TIMEOUT); connection.SetClosed(false); - EXPECT_EQ(0, boost::get(*optional)); + EXPECT_EQ(0, std::get(*optional)); connection.Close(); } @@ -113,7 +113,7 @@ TEST(BuildLocationTests, ForTcp) { Location expected_location; ASSERT_TRUE( - Location::ForGrpcTcp("localhost", 32010, &expected_location).ok()); + Location::ForGrpcTcp("localhost", 32010).Value(&expected_location).ok()); ASSERT_EQ(expected_location, actual_location1); ASSERT_NE(expected_location, actual_location2); } @@ -146,7 +146,7 @@ TEST(BuildLocationTests, ForTls) { Location expected_location; ASSERT_TRUE( - Location::ForGrpcTls("localhost", 32010, &expected_location).ok()); + Location::ForGrpcTls("localhost", 32010).Value(&expected_location).ok()); ASSERT_EQ(expected_location, actual_location1); ASSERT_NE(expected_location, actual_location2); } diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_tables_reader.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_tables_reader.cc index e6b01293e9ca9..f041f74b416c1 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_tables_reader.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_tables_reader.cc @@ -18,7 +18,7 @@ namespace driver { namespace flight_sql { using arrow::internal::checked_pointer_cast; -using arrow::util::nullopt; +using std::nullopt; GetTablesReader::GetTablesReader(std::shared_ptr record_batch) : record_batch_(std::move(record_batch)), current_row_(-1) {} diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_tables_reader.h b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_tables_reader.h index 0e10c1e5ee39e..05e4a24f2047c 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_tables_reader.h +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_tables_reader.h @@ -5,13 +5,12 @@ */ #include "record_batch_transformer.h" -#include namespace driver { namespace flight_sql { using namespace arrow; -using arrow::util::optional; +using std::optional; class GetTablesReader { private: diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_type_info_reader.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_type_info_reader.cc index 6907c501a6f72..97c7f6e8b3af7 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_type_info_reader.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_type_info_reader.cc @@ -16,7 +16,7 @@ namespace driver { namespace flight_sql { using arrow::internal::checked_pointer_cast; -using arrow::util::nullopt; +using std::nullopt; GetTypeInfoReader::GetTypeInfoReader(std::shared_ptr record_batch) : record_batch_(std::move(record_batch)), current_row_(-1) {} diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_type_info_reader.h b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_type_info_reader.h index 78729d763a34d..4b954b3b925ed 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_type_info_reader.h +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_get_type_info_reader.h @@ -4,14 +4,15 @@ * See "LICENSE" for license information. */ +#include + #include "record_batch_transformer.h" -#include namespace driver { namespace flight_sql { using namespace arrow; -using arrow::util::optional; +using std::optional; class GetTypeInfoReader { private: diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_result_set.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_result_set.cc index 42fbf4352d4c5..c3495eaeb0701 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_result_set.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_result_set.cc @@ -51,7 +51,7 @@ FlightSqlResultSet::FlightSqlResultSet( if (transformer_) { schema_ = transformer_->GetTransformedSchema(); } else { - ThrowIfNotOK(flight_info->GetSchema(nullptr, &schema_)); + ThrowIfNotOK(flight_info->GetSchema(nullptr).Value(&schema_)); } for (size_t i = 0; i < columns_.size(); ++i) { diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_result_set_metadata.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_result_set_metadata.cc index 8188b36045f69..3823fab6a6081 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_result_set_metadata.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_result_set_metadata.cc @@ -20,8 +20,8 @@ namespace flight_sql { using namespace odbcabstraction; using arrow::DataType; using arrow::Field; -using arrow::util::make_optional; -using arrow::util::nullopt; +using std::make_optional; +using std::nullopt; constexpr int32_t DefaultDecimalPrecision = 38; @@ -251,7 +251,7 @@ FlightSqlResultSetMetadata::FlightSqlResultSetMetadata( metadata_settings_(metadata_settings){ arrow::ipc::DictionaryMemo dict_memo; - ThrowIfNotOK(flight_info->GetSchema(&dict_memo, &schema_)); + ThrowIfNotOK(flight_info->GetSchema(&dict_memo).Value(&schema_)); } } // namespace flight_sql diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement.cc index 943a35589c6ad..859b0944e2eda 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement.cc @@ -75,9 +75,9 @@ bool FlightSqlStatement::SetAttribute(StatementAttributeId attribute, case MAX_LENGTH: return CheckIfSetToOnlyValidValue(value, static_cast(0)); case QUERY_TIMEOUT: - if (boost::get(value) > 0) { + if (std::get(value) > 0) { call_options_.timeout = - TimeoutDuration{static_cast(boost::get(value))}; + TimeoutDuration{static_cast(std::get(value))}; } else { call_options_.timeout = TimeoutDuration{-1}; // Intentional fall-through. diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_columns.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_columns.cc index 49994eb1e95c4..93cc067aa06f6 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_columns.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_columns.cc @@ -15,9 +15,9 @@ namespace driver { namespace flight_sql { using arrow::flight::sql::ColumnMetadata; -using arrow::util::make_optional; -using arrow::util::nullopt; -using arrow::util::optional; +using std::make_optional; +using std::nullopt; +using std::optional; namespace { std::shared_ptr GetColumns_V3_Schema() { diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_columns.h b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_columns.h index d5bbc47752689..9110078665f46 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_columns.h +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_columns.h @@ -4,18 +4,19 @@ * See "LICENSE" for license information. */ +#include + #include "record_batch_transformer.h" #include #include #include -#include #include namespace driver { namespace flight_sql { using odbcabstraction::MetadataSettings; -using arrow::util::optional; +using std::optional; class GetColumns_RecordBatchBuilder { private: diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_tables.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_tables.cc index 1536a13a8bd09..687a38d6e7920 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_tables.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_tables.cc @@ -76,7 +76,7 @@ GetTablesForSQLAllCatalogs(const ColumnNames &names, ThrowIfNotOK(result.status()); flight_info = result.ValueOrDie(); - ThrowIfNotOK(flight_info->GetSchema(nullptr, &schema)); + ThrowIfNotOK(flight_info->GetSchema(nullptr).Value(&schema)); auto transformer = RecordBatchTransformerWithTasksBuilder(schema) .RenameField("catalog_name", names.catalog_column) @@ -102,7 +102,7 @@ std::shared_ptr GetTablesForSQLAllDbSchemas( ThrowIfNotOK(result.status()); flight_info = result.ValueOrDie(); - ThrowIfNotOK(flight_info->GetSchema(nullptr, &schema)); + ThrowIfNotOK(flight_info->GetSchema(nullptr).Value(&schema)); auto transformer = RecordBatchTransformerWithTasksBuilder(schema) .AddFieldOfNulls(names.catalog_column, utf8()) @@ -130,7 +130,7 @@ GetTablesForSQLAllTableTypes(const ColumnNames &names, ThrowIfNotOK(result.status()); flight_info = result.ValueOrDie(); - ThrowIfNotOK(flight_info->GetSchema(nullptr, &schema)); + ThrowIfNotOK(flight_info->GetSchema(nullptr).Value(&schema)); auto transformer = RecordBatchTransformerWithTasksBuilder(schema) .AddFieldOfNulls(names.catalog_column, utf8()) @@ -158,7 +158,7 @@ std::shared_ptr GetTablesForGenericUse( ThrowIfNotOK(result.status()); flight_info = result.ValueOrDie(); - ThrowIfNotOK(flight_info->GetSchema(nullptr, &schema)); + ThrowIfNotOK(flight_info->GetSchema(nullptr).Value(&schema)); auto transformer = RecordBatchTransformerWithTasksBuilder(schema) .RenameField("catalog_name", names.catalog_column) diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_type_info.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_type_info.cc index 8679c6dc6945c..402660c5f94f3 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_type_info.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_type_info.cc @@ -14,9 +14,9 @@ namespace driver { namespace flight_sql { -using arrow::util::make_optional; -using arrow::util::nullopt; -using arrow::util::optional; +using std::make_optional; +using std::nullopt; +using std::optional; namespace { std::shared_ptr GetTypeInfo_V3_Schema() { diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_type_info.h b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_type_info.h index 5b94c14319c3b..41ed769631a83 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_type_info.h +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/flight_sql_statement_get_type_info.h @@ -4,18 +4,19 @@ * See "LICENSE" for license information. */ +#include + #include "record_batch_transformer.h" #include #include #include -#include #include namespace driver { namespace flight_sql { using odbcabstraction::MetadataSettings; -using arrow::util::optional; +using std::optional; class GetTypeInfo_RecordBatchBuilder { private: diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/get_info_cache.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/get_info_cache.cc index b87ab94553c14..a1d5899932ea3 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/get_info_cache.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/get_info_cache.cc @@ -168,15 +168,15 @@ uint32_t GetCvtBitForArrowConvertEntry(int32_t convert_entry) { } inline int32_t ScalarToInt32(arrow::UnionScalar *scalar) { - return reinterpret_cast(scalar->value.get())->value; + return reinterpret_cast(scalar->child_value().get())->value; } inline int64_t ScalarToInt64(arrow::UnionScalar *scalar) { - return reinterpret_cast(scalar->value.get())->value; + return reinterpret_cast(scalar->child_value().get())->value; } inline std::string ScalarToBoolString(arrow::UnionScalar *scalar) { - return reinterpret_cast(scalar->value.get())->value ? "Y" : "N"; + return reinterpret_cast(scalar->child_value().get())->value ? "Y" : "N"; } inline void SetDefaultIfMissing(std::unordered_map& cache, @@ -310,7 +310,7 @@ bool GetInfoCache::LoadInfoFromServer() { switch (info_type) { // String properties case SqlInfoOptions::FLIGHT_SQL_SERVER_NAME: { - std::string server_name(reinterpret_cast(scalar->value.get())->view()); + std::string server_name(reinterpret_cast(scalar->child_value().get())->view()); // TODO: Consider creating different properties in GetSqlInfo. // TODO: Investigate if SQL_SERVER_NAME should just be the host @@ -325,7 +325,7 @@ bool GetInfoCache::LoadInfoFromServer() { } case SqlInfoOptions::FLIGHT_SQL_SERVER_VERSION: { info_[SQL_DBMS_VER] = ConvertToDBMSVer( - std::string(reinterpret_cast(scalar->value.get())->view())); + std::string(reinterpret_cast(scalar->child_value().get())->view())); break; } case SqlInfoOptions::FLIGHT_SQL_SERVER_ARROW_VERSION: { @@ -333,27 +333,27 @@ bool GetInfoCache::LoadInfoFromServer() { break; } case SqlInfoOptions::SQL_SEARCH_STRING_ESCAPE: { - info_[SQL_SEARCH_PATTERN_ESCAPE] = std::string(reinterpret_cast(scalar->value.get())->view()); + info_[SQL_SEARCH_PATTERN_ESCAPE] = std::string(reinterpret_cast(scalar->child_value().get())->view()); break; } case ARROW_SQL_IDENTIFIER_QUOTE_CHAR: { - info_[SQL_IDENTIFIER_QUOTE_CHAR] = std::string(reinterpret_cast(scalar->value.get())->view()); + info_[SQL_IDENTIFIER_QUOTE_CHAR] = std::string(reinterpret_cast(scalar->child_value().get())->view()); break; } case SqlInfoOptions::SQL_EXTRA_NAME_CHARACTERS: { - info_[SQL_SPECIAL_CHARACTERS] = std::string(reinterpret_cast(scalar->value.get())->view()); + info_[SQL_SPECIAL_CHARACTERS] = std::string(reinterpret_cast(scalar->child_value().get())->view()); break; } case ARROW_SQL_SCHEMA_TERM: { - info_[SQL_SCHEMA_TERM] = std::string(reinterpret_cast(scalar->value.get())->view()); + info_[SQL_SCHEMA_TERM] = std::string(reinterpret_cast(scalar->child_value().get())->view()); break; } case ARROW_SQL_PROCEDURE_TERM: { - info_[SQL_PROCEDURE_TERM] = std::string(reinterpret_cast(scalar->value.get())->view()); + info_[SQL_PROCEDURE_TERM] = std::string(reinterpret_cast(scalar->child_value().get())->view()); break; } case ARROW_SQL_CATALOG_TERM: { - std::string catalog_term(std::string(reinterpret_cast(scalar->value.get())->view())); + std::string catalog_term(std::string(reinterpret_cast(scalar->child_value().get())->view())); if (catalog_term.empty()) { info_[SQL_CATALOG_NAME] = "N"; info_[SQL_CATALOG_NAME_SEPARATOR] = ""; @@ -363,7 +363,7 @@ bool GetInfoCache::LoadInfoFromServer() { info_[SQL_CATALOG_NAME_SEPARATOR] = "."; info_[SQL_CATALOG_LOCATION] = static_cast(SQL_CL_START); } - info_[SQL_CATALOG_TERM] = std::string(reinterpret_cast(scalar->value.get())->view()); + info_[SQL_CATALOG_TERM] = std::string(reinterpret_cast(scalar->child_value().get())->view()); break; } @@ -384,7 +384,7 @@ bool GetInfoCache::LoadInfoFromServer() { break; case SqlInfoOptions::SQL_DDL_SCHEMA: { bool supports_schema_ddl = - reinterpret_cast(scalar->value.get())->value; + reinterpret_cast(scalar->child_value().get())->value; // Note: this is a bitmask and we can't describe cascade or restrict // flags. info_[SQL_DROP_SCHEMA] = static_cast(SQL_DS_DROP_SCHEMA); @@ -397,7 +397,7 @@ bool GetInfoCache::LoadInfoFromServer() { } case SqlInfoOptions::SQL_DDL_TABLE: { bool supports_table_ddl = - reinterpret_cast(scalar->value.get())->value; + reinterpret_cast(scalar->child_value().get())->value; // This is a bitmask and we cannot describe all clauses. info_[SQL_CREATE_TABLE] = static_cast(SQL_CT_CREATE_TABLE); @@ -414,7 +414,7 @@ bool GetInfoCache::LoadInfoFromServer() { } case SqlInfoOptions::SQL_NULL_PLUS_NULL_IS_NULL: { info_[SQL_CONCAT_NULL_BEHAVIOR] = static_cast( - reinterpret_cast(scalar->value.get())->value + reinterpret_cast(scalar->child_value().get())->value ? SQL_CB_NULL : SQL_CB_NON_NULL); break; @@ -424,7 +424,7 @@ bool GetInfoCache::LoadInfoFromServer() { // SQL_SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES since we need both // properties to determine the value for SQL_CORRELATION_NAME. supports_correlation_name = - reinterpret_cast(scalar->value.get())->value; + reinterpret_cast(scalar->child_value().get())->value; break; } case SqlInfoOptions::SQL_SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES: { @@ -432,7 +432,7 @@ bool GetInfoCache::LoadInfoFromServer() { // SQL_SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES since we need both // properties to determine the value for SQL_CORRELATION_NAME. requires_different_correlation_name = - reinterpret_cast(scalar->value.get())->value; + reinterpret_cast(scalar->child_value().get())->value; break; } case SqlInfoOptions::SQL_SUPPORTS_EXPRESSIONS_IN_ORDER_BY: { @@ -442,7 +442,7 @@ bool GetInfoCache::LoadInfoFromServer() { case SqlInfoOptions::SQL_SUPPORTS_ORDER_BY_UNRELATED: { // Note: this is the negation of the Flight SQL property. info_[SQL_ORDER_BY_COLUMNS_IN_SELECT] = - reinterpret_cast(scalar->value.get())->value ? "N" + reinterpret_cast(scalar->child_value().get())->value ? "N" : "Y"; break; } @@ -452,7 +452,7 @@ bool GetInfoCache::LoadInfoFromServer() { } case SqlInfoOptions::SQL_SUPPORTS_NON_NULLABLE_COLUMNS: { info_[SQL_NON_NULLABLE_COLUMNS] = static_cast( - reinterpret_cast(scalar->value.get())->value + reinterpret_cast(scalar->child_value().get())->value ? SQL_NNC_NON_NULL : SQL_NNC_NULL); break; @@ -463,7 +463,7 @@ bool GetInfoCache::LoadInfoFromServer() { } case SqlInfoOptions::SQL_CATALOG_AT_START: { info_[SQL_CATALOG_LOCATION] = static_cast( - reinterpret_cast(scalar->value.get())->value + reinterpret_cast(scalar->child_value().get())->value ? SQL_CL_START : SQL_CL_END); break; @@ -481,22 +481,22 @@ bool GetInfoCache::LoadInfoFromServer() { } case SqlInfoOptions::SQL_TRANSACTIONS_SUPPORTED: { transactions_supported = - reinterpret_cast(scalar->value.get())->value; + reinterpret_cast(scalar->child_value().get())->value; break; } case SqlInfoOptions::SQL_DATA_DEFINITION_CAUSES_TRANSACTION_COMMIT: { transaction_ddl_commit = - reinterpret_cast(scalar->value.get())->value; + reinterpret_cast(scalar->child_value().get())->value; break; } case SqlInfoOptions::SQL_DATA_DEFINITIONS_IN_TRANSACTIONS_IGNORED: { transaction_ddl_ignore = - reinterpret_cast(scalar->value.get())->value; + reinterpret_cast(scalar->child_value().get())->value; break; } case SqlInfoOptions::SQL_BATCH_UPDATES_SUPPORTED: { info_[SQL_BATCH_SUPPORT] = static_cast( - reinterpret_cast(scalar->value.get())->value + reinterpret_cast(scalar->child_value().get())->value ? SQL_BS_ROW_COUNT_EXPLICIT : 0); break; @@ -936,7 +936,7 @@ bool GetInfoCache::LoadInfoFromServer() { // List properties case ARROW_SQL_NUMERIC_FUNCTIONS: { std::shared_ptr list_value = - reinterpret_cast(scalar->value.get())->value; + reinterpret_cast(scalar->child_value().get())->value; uint32_t result_val = 0; for (int64_t list_index = 0; list_index < list_value->length(); ++list_index) { @@ -953,7 +953,7 @@ bool GetInfoCache::LoadInfoFromServer() { case ARROW_SQL_STRING_FUNCTIONS: { std::shared_ptr list_value = - reinterpret_cast(scalar->value.get())->value; + reinterpret_cast(scalar->child_value().get())->value; uint32_t result_val = 0; for (int64_t list_index = 0; list_index < list_value->length(); ++list_index) { @@ -969,7 +969,7 @@ bool GetInfoCache::LoadInfoFromServer() { } case ARROW_SQL_SYSTEM_FUNCTIONS: { std::shared_ptr list_value = - reinterpret_cast(scalar->value.get())->value; + reinterpret_cast(scalar->child_value().get())->value; uint32_t sys_result = 0; uint32_t convert_result = 0; for (int64_t list_index = 0; list_index < list_value->length(); @@ -987,7 +987,7 @@ bool GetInfoCache::LoadInfoFromServer() { } case SqlInfoOptions::SQL_DATETIME_FUNCTIONS: { std::shared_ptr list_value = - reinterpret_cast(scalar->value.get())->value; + reinterpret_cast(scalar->child_value().get())->value; uint32_t result_val = 0; for (int64_t list_index = 0; list_index < list_value->length(); ++list_index) { @@ -1004,7 +1004,7 @@ bool GetInfoCache::LoadInfoFromServer() { case ARROW_SQL_KEYWORDS: { std::shared_ptr list_value = - reinterpret_cast(scalar->value.get())->value; + reinterpret_cast(scalar->child_value().get())->value; std::string result_str; for (int64_t list_index = 0; list_index < list_value->length(); ++list_index) { @@ -1024,7 +1024,7 @@ bool GetInfoCache::LoadInfoFromServer() { // Map properties case SqlInfoOptions::SQL_SUPPORTS_CONVERT: { arrow::MapScalar *map_scalar = - reinterpret_cast(scalar->value.get()); + reinterpret_cast(scalar->child_value().get()); auto data_array = map_scalar->value; arrow::StructArray *map_contents = reinterpret_cast(data_array.get()); diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/json_converter.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/json_converter.cc index fbe59f91dd3ea..fd66e988b8b63 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/json_converter.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/json_converter.cc @@ -265,7 +265,7 @@ class ScalarToJson : public arrow::ScalarVisitor { } Status Visit(const SparseUnionScalar &scalar) override { - return scalar.value->Accept(this); + return scalar.child_value()->Accept(this); } Status Visit(const DenseUnionScalar &scalar) override { diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/ui/dsn_configuration_window.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/ui/dsn_configuration_window.cc index 37503a07e7574..6d9f2d7a13304 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/ui/dsn_configuration_window.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/ui/dsn_configuration_window.cc @@ -30,8 +30,8 @@ namespace { // This should have been checked before enabling the Test button. assert(missingProperties.empty()); - std::string serverName = boost::get(flightSqlConn->GetInfo(SQL_SERVER_NAME)); - std::string serverVersion = boost::get(flightSqlConn->GetInfo(SQL_DBMS_VER)); + std::string serverName = std::get(flightSqlConn->GetInfo(SQL_SERVER_NAME)); + std::string serverVersion = std::get(flightSqlConn->GetInfo(SQL_DBMS_VER)); return "Server Name: " + serverName + "\n" + "Server Version: " + serverVersion; } diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/utils.cc b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/utils.cc index 70dab8803fd7e..28f1715e63045 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/utils.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/utils.cc @@ -53,8 +53,8 @@ odbcabstraction::CDataType GetDefaultCCharType(bool useWideChar) { } using namespace odbcabstraction; -using arrow::util::make_optional; -using arrow::util::nullopt; +using std::make_optional; +using std::nullopt; /// \brief Returns the mapping from Arrow type to SqlDataType /// \param field the field to return the SqlDataType for @@ -274,7 +274,7 @@ GetRadixFromSqlDataType(odbcabstraction::SqlDataType data_type) { case SqlDataType_DOUBLE: return 2; default: - return arrow::util::nullopt; + return std::nullopt; } } @@ -338,7 +338,7 @@ optional GetSqlDateTimeSubCode(SqlDataType data_type) { case SqlDataType_INTERVAL_MINUTE_TO_SECOND: return SqlDateTimeSubCode_MINUTE_TO_SECOND; default: - return arrow::util::nullopt; + return std::nullopt; } } @@ -354,7 +354,7 @@ optional GetCharOctetLength(SqlDataType data_type, if (column_size.ok()) { return column_size.ValueOrDie(); } else { - return arrow::util::nullopt; + return std::nullopt; } case SqlDataType_WCHAR: case SqlDataType_WVARCHAR: @@ -362,7 +362,7 @@ optional GetCharOctetLength(SqlDataType data_type, if (column_size.ok()) { return column_size.ValueOrDie() * GetSqlWCharSize(); } else { - return arrow::util::nullopt; + return std::nullopt; } case SqlDataType_TINYINT: case SqlDataType_BIT: @@ -400,7 +400,7 @@ optional GetCharOctetLength(SqlDataType data_type, case SqlDataType_GUID: return 16; default: - return arrow::util::nullopt; + return std::nullopt; } } optional GetTypeScale(SqlDataType data_type, @@ -419,7 +419,7 @@ optional GetTypeScale(SqlDataType data_type, case SqlDataType_BIGINT: return 0; default: - return arrow::util::nullopt; + return std::nullopt; } } optional GetColumnSize(SqlDataType data_type, @@ -432,8 +432,8 @@ optional GetColumnSize(SqlDataType data_type, case SqlDataType_WCHAR: case SqlDataType_WVARCHAR: case SqlDataType_WLONGVARCHAR: - return column_size.has_value() ? arrow::util::make_optional(column_size.value() * GetSqlWCharSize()) - : arrow::util::nullopt; + return column_size.has_value() ? std::make_optional(column_size.value() * GetSqlWCharSize()) + : std::nullopt; case SqlDataType_BINARY: case SqlDataType_VARBINARY: case SqlDataType_LONGVARBINARY: @@ -479,7 +479,7 @@ optional GetColumnSize(SqlDataType data_type, case SqlDataType_GUID: return 16; default: - return arrow::util::nullopt; + return std::nullopt; } } @@ -493,8 +493,8 @@ optional GetBufferLength(SqlDataType data_type, case SqlDataType_WCHAR: case SqlDataType_WVARCHAR: case SqlDataType_WLONGVARCHAR: - return column_size.has_value() ? arrow::util::make_optional(column_size.value() * GetSqlWCharSize()) - : arrow::util::nullopt; + return column_size.has_value() ? std::make_optional(column_size.value() * GetSqlWCharSize()) + : std::nullopt; case SqlDataType_BINARY: case SqlDataType_VARBINARY: case SqlDataType_LONGVARBINARY: @@ -539,7 +539,7 @@ optional GetBufferLength(SqlDataType data_type, case SqlDataType_GUID: return 16; default: - return arrow::util::nullopt; + return std::nullopt; } } @@ -595,7 +595,7 @@ optional GetLength(SqlDataType data_type, const optional& colu case SqlDataType_GUID: return 16; default: - return arrow::util::nullopt; + return std::nullopt; } } diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/utils.h b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/utils.h index 374c3064ee946..390e08484f0e7 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/utils.h +++ b/cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/utils.h @@ -6,8 +6,9 @@ #pragma once +#include + #include -#include #include #include #include @@ -20,7 +21,7 @@ typedef std::function< std::shared_ptr(const std::shared_ptr &)> ArrayConvertTask; -using arrow::util::optional; +using std::optional; inline void ThrowIfNotOK(const arrow::Status &status) { if (!status.ok()) { @@ -30,7 +31,7 @@ inline void ThrowIfNotOK(const arrow::Status &status) { template inline bool CheckIfSetToOnlyValidValue(const AttributeTypeT &value, T allowed_value) { - return boost::get(value) == allowed_value; + return std::get(value) == allowed_value; } template diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/include/odbcabstraction/spi/connection.h b/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/include/odbcabstraction/spi/connection.h index 9fafc44d4bb41..ad68668afddfe 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/include/odbcabstraction/spi/connection.h +++ b/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/include/odbcabstraction/spi/connection.h @@ -8,8 +8,8 @@ #include #include -#include #include +#include #include #include @@ -19,8 +19,7 @@ namespace driver { namespace odbcabstraction { /// \brief Case insensitive comparator -struct CaseInsensitiveComparator - : std::binary_function { +struct CaseInsensitiveComparator { bool operator()(const std::string &s1, const std::string &s2) const { return boost::lexicographical_compare(s1, s2, boost::is_iless()); } @@ -49,8 +48,8 @@ class Connection { PACKET_SIZE, // uint32_t - The Packet Size }; - typedef boost::variant Attribute; - typedef boost::variant Info; + typedef std::variant Attribute; + typedef std::variant Info; typedef PropertyMap ConnPropertyMap; /// \brief Establish the connection. diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/include/odbcabstraction/spi/statement.h b/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/include/odbcabstraction/spi/statement.h index 0d5776a824c71..0f7da998bf85e 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/include/odbcabstraction/spi/statement.h +++ b/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/include/odbcabstraction/spi/statement.h @@ -7,8 +7,8 @@ #pragma once #include -#include #include +#include #include namespace driver { @@ -37,7 +37,7 @@ class Statement { QUERY_TIMEOUT, // size_t - The time to wait in seconds for queries to execute. 0 to have no timeout. }; - typedef boost::variant Attribute; + typedef std::variant Attribute; /// \brief Set a statement attribute (may be called at any time) /// diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/odbc_impl/ODBCConnection.cc b/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/odbc_impl/ODBCConnection.cc index 313b7b04f3c24..df4e8a6745ad4 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/odbc_impl/ODBCConnection.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/odbc_impl/ODBCConnection.cc @@ -274,7 +274,7 @@ void ODBCConnection::GetInfo(SQLUSMALLINT infoType, SQLPOINTER value, SQLSMALLIN case SQL_XOPEN_CLI_YEAR: { const auto& info = m_spiConnection->GetInfo(infoType); - const std::string& infoValue = boost::get(info); + const std::string& infoValue = std::get(info); GetStringAttribute(isUnicode, infoValue, true, value, bufferLength, outputLength, GetDiagnostics()); break; } @@ -365,7 +365,7 @@ void ODBCConnection::GetInfo(SQLUSMALLINT infoType, SQLPOINTER value, SQLSMALLIN case SQL_STANDARD_CLI_CONFORMANCE: { const auto& info = m_spiConnection->GetInfo(infoType); - uint32_t infoValue = boost::get(info); + uint32_t infoValue = std::get(info); GetAttribute(infoValue, value, bufferLength, outputLength); break; } @@ -401,7 +401,7 @@ void ODBCConnection::GetInfo(SQLUSMALLINT infoType, SQLPOINTER value, SQLSMALLIN case SQL_ODBC_SAG_CLI_CONFORMANCE: { const auto& info = m_spiConnection->GetInfo(infoType); - uint16_t infoValue = boost::get(info); + uint16_t infoValue = std::get(info); GetAttribute(infoValue, value, bufferLength, outputLength); break; } @@ -414,7 +414,7 @@ void ODBCConnection::GetInfo(SQLUSMALLINT infoType, SQLPOINTER value, SQLSMALLIN if (!attr) { throw DriverException("Optional feature not supported.", "HYC00"); } - const std::string &infoValue = boost::get(*attr); + const std::string &infoValue = std::get(*attr); GetStringAttribute(isUnicode, infoValue, true, value, bufferLength,outputLength, GetDiagnostics()); break; } @@ -599,7 +599,7 @@ void ODBCConnection::GetConnectAttr(SQLINTEGER attribute, SQLPOINTER value, if (!catalog) { throw DriverException("Optional feature not supported.", "HYC00"); } - const std::string &infoValue = boost::get(*catalog); + const std::string &infoValue = std::get(*catalog); GetStringAttribute(isUnicode, infoValue, true, value, bufferLength,outputLength, GetDiagnostics()); return; } @@ -628,7 +628,7 @@ void ODBCConnection::GetConnectAttr(SQLINTEGER attribute, SQLPOINTER value, throw DriverException("Invalid attribute", "HY092"); } - GetAttribute(static_cast(boost::get(*spiAttribute)), value, bufferLength, outputLength); + GetAttribute(static_cast(std::get(*spiAttribute)), value, bufferLength, outputLength); } void ODBCConnection::disconnect() { diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/odbc_impl/ODBCStatement.cc b/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/odbc_impl/ODBCStatement.cc index 20524f7e7cdf9..b3e680fa7e1e6 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/odbc_impl/ODBCStatement.cc +++ b/cpp/src/flightsql_odbc/flightsql-odbc/odbcabstraction/odbc_impl/ODBCStatement.cc @@ -20,7 +20,6 @@ #include #include #include -#include using namespace ODBC; using namespace driver::odbcabstraction; @@ -451,7 +450,7 @@ void ODBCStatement::GetStmtAttr(SQLINTEGER statementAttribute, } if (spiAttribute) { - GetAttribute(static_cast(boost::get(*spiAttribute)), + GetAttribute(static_cast(std::get(spiAttribute.get())), output, bufferSize, strLenPtr); return; } diff --git a/cpp/src/flightsql_odbc/flightsql-odbc/vcpkg.json b/cpp/src/flightsql_odbc/flightsql-odbc/vcpkg.json index 8c065a15654a1..c5b4875b12848 100644 --- a/cpp/src/flightsql_odbc/flightsql-odbc/vcpkg.json +++ b/cpp/src/flightsql_odbc/flightsql-odbc/vcpkg.json @@ -1,6 +1,5 @@ { "name": "flightsql-odbc", - "version-string": "1.0.0", "dependencies": [ "abseil", "benchmark", @@ -19,13 +18,13 @@ "gflags", "openssl", "protobuf", - { "name": "zlib", "version>=": "1.3" }, "re2", "spdlog", "grpc", "utf8proc", + "xsimd", + "zlib", "zstd", "rapidjson" - ], - "builtin-baseline": "4e485c34f5e056327ef00c14e2e3620bc50de098" + ] }