From e344d1dd199f4dfd8317aa16273e8b35c6170dca Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Thu, 2 Oct 2025 13:51:18 -0700 Subject: [PATCH 1/5] Build ODBC in C++ Windows Workflow Enable ODBC build in Windows MSVC workflow --- ci/scripts/cpp_build.sh | 2 ++ cpp/cmake_modules/DefineOptions.cmake | 2 +- cpp/cmake_modules/ThirdpartyToolchain.cmake | 2 +- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 3 ++- .../odbc/odbc_impl/accessors/string_array_accessor_test.cc | 1 - cpp/src/arrow/flight/sql/odbc/odbc_impl/address_info.h | 1 + .../sql/odbc/odbc_impl/flight_sql_statement_get_columns.h | 2 ++ .../sql/odbc/odbc_impl/flight_sql_statement_get_type_info.h | 2 ++ cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h | 1 + cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/custom_window.cc | 5 +++-- testing | 2 +- 11 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ci/scripts/cpp_build.sh b/ci/scripts/cpp_build.sh index 79fc79cc724..eb4291bafbd 100755 --- a/ci/scripts/cpp_build.sh +++ b/ci/scripts/cpp_build.sh @@ -64,6 +64,7 @@ if [ "${ARROW_ENABLE_THREADING:-ON}" = "OFF" ]; then ARROW_AZURE=OFF ARROW_FLIGHT=OFF ARROW_FLIGHT_SQL=OFF + ARROW_FLIGHT_SQL_ODBC=OFF ARROW_GCS=OFF ARROW_JEMALLOC=OFF ARROW_MIMALLOC=OFF @@ -212,6 +213,7 @@ else -DARROW_FILESYSTEM=${ARROW_FILESYSTEM:-ON} \ -DARROW_FLIGHT=${ARROW_FLIGHT:-OFF} \ -DARROW_FLIGHT_SQL=${ARROW_FLIGHT_SQL:-OFF} \ + -DARROW_FLIGHT_SQL_ODBC=${ARROW_FLIGHT_SQL_ODBC:-OFF} \ -DARROW_FUZZING=${ARROW_FUZZING:-OFF} \ -DARROW_GANDIVA_PC_CXX_FLAGS=${ARROW_GANDIVA_PC_CXX_FLAGS:-} \ -DARROW_GANDIVA=${ARROW_GANDIVA:-OFF} \ diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake index dfd99e4c7a4..0f6674c7143 100644 --- a/cpp/cmake_modules/DefineOptions.cmake +++ b/cpp/cmake_modules/DefineOptions.cmake @@ -108,7 +108,7 @@ endmacro() macro(resolve_option_dependencies) # Arrow Flight SQL ODBC is available only for Windows for now. - if(NOT MSVC_TOOLCHAIN) + if(NOT WIN32) set(ARROW_FLIGHT_SQL_ODBC OFF) endif() if(MSVC_TOOLCHAIN) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 4ced2a66bf5..3548e946e98 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1269,7 +1269,7 @@ if(ARROW_USE_BOOST) endif() if(ARROW_BOOST_REQUIRE_LIBRARY) set(ARROW_BOOST_COMPONENTS filesystem system) - if(ARROW_FLIGHT_SQL_ODBC AND MSVC) + if(ARROW_FLIGHT_SQL_ODBC) list(APPEND ARROW_BOOST_COMPONENTS locale) endif() if(ARROW_ENABLE_THREADING) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 79f351ae9cb..8b7eb99a1c0 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -37,7 +37,8 @@ add_subdirectory(odbc_impl) arrow_install_all_headers("arrow/flight/sql/odbc") -set(ARROW_FLIGHT_SQL_ODBC_SRCS entry_points.cc odbc_api.cc) +# Compile entry_points.cc before odbc_api.cc due to conflict from sql.h and flight/types.h +set(ARROW_FLIGHT_SQL_ODBC_SRCS odbc_api.cc entry_points.cc) if(WIN32) list(APPEND ARROW_FLIGHT_SQL_ODBC_SRCS odbc.def) diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor_test.cc index f0d8f898ba9..eb7a9c88b3b 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor_test.cc @@ -126,7 +126,6 @@ TEST(StringArrayAccessor, Test_CDataType_WCHAR_Truncation) { ColumnBinding binding(CDataType_WCHAR, 0, 0, buffer.data(), max_str_len, str_len_buffer.data()); - std::basic_stringstream ss; int64_t value_offset = 0; // Construct the whole string by concatenating smaller chunks from diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/address_info.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/address_info.h index 6ba9ca23b80..c127c0f4a29 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/address_info.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/address_info.h @@ -22,6 +22,7 @@ #include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include +#include #if !_WIN32 # include #endif diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_statement_get_columns.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_statement_get_columns.h index 39f0cce1eac..b764fe76e3a 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_statement_get_columns.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_statement_get_columns.h @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +#pragma once + #include #include "arrow/array/builder_binary.h" #include "arrow/array/builder_primitive.h" diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_statement_get_type_info.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_statement_get_type_info.h index 7741d71bd4b..3f47d88bbd3 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_statement_get_type_info.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_statement_get_type_info.h @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +#pragma once + #include #include "arrow/array/builder_binary.h" #include "arrow/array/builder_primitive.h" diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h index 94ad924aaa3..6d176675a27 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h @@ -25,6 +25,7 @@ # include # include +# include # include # include diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/custom_window.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/custom_window.cc index 9aded323d0d..f8075ab29e7 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/custom_window.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/custom_window.cc @@ -23,6 +23,7 @@ #include #include +#include #include #include "arrow/flight/sql/odbc/odbc_impl/exceptions.h" @@ -52,7 +53,7 @@ LRESULT CALLBACK CustomWindow::WndProc(HWND hwnd, UINT msg, WPARAM wparam, switch (msg) { case WM_NCCREATE: { - _ASSERT(lparam != NULL); + assert(lparam != NULL); CREATESTRUCT* create_struct = reinterpret_cast(lparam); @@ -64,7 +65,7 @@ LRESULT CALLBACK CustomWindow::WndProc(HWND hwnd, UINT msg, WPARAM wparam, } case WM_CREATE: { - _ASSERT(window != NULL); + assert(window != NULL); window->SetHandle(hwnd); diff --git a/testing b/testing index 9a02925d1ba..da65f4f1b8f 160000 --- a/testing +++ b/testing @@ -1 +1 @@ -Subproject commit 9a02925d1ba80bd493b6d4da6e8a777588d57ac4 +Subproject commit da65f4f1b8f255abbf51a461dffd595f2cfd8b2a From ee31cf96c91b35dca9c671b0ecf73dbb42b01043 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Thu, 9 Oct 2025 10:24:44 -0700 Subject: [PATCH 2/5] Fix build issue --- cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h index 6d176675a27..6c962594351 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h @@ -24,9 +24,12 @@ # include # include -# include + +// prsht.h needs to be included before cryptuiapi.h to avoid build conflict # include +# include + # include # include # include From ec5008d588f6bc934b10f2044d14e4b57c22794a Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Thu, 9 Oct 2025 12:40:06 -0700 Subject: [PATCH 3/5] Register ODBC driver ODBC driver registration is required for ODBC tests (enabled in a separate PR) --- .github/workflows/cpp.yml | 4 ++ .../flight/sql/odbc/install/install_amd64.cmd | 53 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 cpp/src/arrow/flight/sql/odbc/install/install_amd64.cmd diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 0122f01e757..112d82b512e 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -476,6 +476,10 @@ jobs: PIPX_BASE_PYTHON: ${{ steps.python-install.outputs.python-path }} run: | ci/scripts/install_gcs_testbench.sh default + - name: Register Flight SQL ODBC Driver + shell: cmd + run: | + call "cpp\src\arrow\flight\sql\odbc\install\install_amd64.cmd" ${{github.workspace}}\build\cpp\%ARROW_BUILD_TYPE%\libarrow_flight_sql_odbc.dll - name: Test shell: msys2 {0} run: | diff --git a/cpp/src/arrow/flight/sql/odbc/install/install_amd64.cmd b/cpp/src/arrow/flight/sql/odbc/install/install_amd64.cmd new file mode 100644 index 00000000000..b1fd85d578e --- /dev/null +++ b/cpp/src/arrow/flight/sql/odbc/install/install_amd64.cmd @@ -0,0 +1,53 @@ +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. + +@echo off + +set ODBC_AMD64=%1 + +@REM enable delayed variable expansion to make environment variables enclosed with "!" to be evaluated +@REM when the command is executed instead of when the command is parsed +setlocal enableextensions enabledelayedexpansion + +if [%ODBC_AMD64%] == [] ( + echo error: 64-bit driver is not specified. Call format: install_amd64 abs_path_to_64_bit_driver + pause + exit /b 1 +) + +if exist %ODBC_AMD64% ( + for %%i IN (%ODBC_AMD64%) DO IF EXIST %%~si\NUL ( + echo warning: The path you have specified seems to be a directory. Note that you have to specify path to driver file itself instead. + ) + echo Installing 64-bit driver: %ODBC_AMD64% + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v DriverODBCVer /t REG_SZ /d "03.80" /f + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v UsageCount /t REG_DWORD /d 00000001 /f + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v Driver /t REG_SZ /d %ODBC_AMD64% /f + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v Setup /t REG_SZ /d %ODBC_AMD64% /f + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" /v "Apache Arrow Flight SQL ODBC Driver" /t REG_SZ /d "Installed" /f + + IF !ERRORLEVEL! NEQ 0 ( + echo Error occurred while registering 64-bit driver. Exiting. + echo ERRORLEVEL: !ERRORLEVEL! + exit !ERRORLEVEL! + ) +) else ( + echo 64-bit driver can not be found: %ODBC_AMD64% + echo Call format: install_amd64 abs_path_to_64_bit_driver + pause + exit /b 1 +) From a5af2f75d69d6f1c1d0a60bdc6a31d41fddcef82 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Fri, 10 Oct 2025 16:16:41 -0700 Subject: [PATCH 4/5] Address Sutou's comments --- .github/workflows/cpp.yml | 2 +- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 3 +-- .../accessors/string_array_accessor.cc | 8 +++---- .../accessors/string_array_accessor.h | 2 +- .../odbc/odbc_impl/flight_sql_connection.cc | 2 +- .../sql/odbc/odbc_impl/system_trust_store.cc | 2 +- .../sql/odbc/odbc_impl/system_trust_store.h | 2 +- .../sql/odbc/odbc_impl/ui/custom_window.cc | 7 +++--- .../install_odbc.cmd} | 22 +++++++++---------- 9 files changed, 25 insertions(+), 25 deletions(-) rename cpp/src/arrow/flight/sql/odbc/{install/install_amd64.cmd => script/install_odbc.cmd} (81%) diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 112d82b512e..e6a19b1850a 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -479,7 +479,7 @@ jobs: - name: Register Flight SQL ODBC Driver shell: cmd run: | - call "cpp\src\arrow\flight\sql\odbc\install\install_amd64.cmd" ${{github.workspace}}\build\cpp\%ARROW_BUILD_TYPE%\libarrow_flight_sql_odbc.dll + call "cpp\src\arrow\flight\sql\odbc\install\install_odbc.cmd" ${{ github.workspace }}\build\cpp\%ARROW_BUILD_TYPE%\libarrow_flight_sql_odbc.dll - name: Test shell: msys2 {0} run: | diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 8b7eb99a1c0..f73d4435365 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -37,8 +37,7 @@ add_subdirectory(odbc_impl) arrow_install_all_headers("arrow/flight/sql/odbc") -# Compile entry_points.cc before odbc_api.cc due to conflict from sql.h and flight/types.h -set(ARROW_FLIGHT_SQL_ODBC_SRCS odbc_api.cc entry_points.cc) +set(ARROW_FLIGHT_SQL_ODBC_SRCS entry_points.cc odbc_api.cc ) if(WIN32) list(APPEND ARROW_FLIGHT_SQL_ODBC_SRCS odbc.def) diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor.cc index 340b68620be..69b3b304945 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor.cc @@ -24,7 +24,7 @@ namespace arrow::flight::sql::odbc { namespace { -#if defined _WIN32 || defined _WIN64 +#if defined _WIN32 std::string Utf8ToCLocale(const char* utf8_str, int len) { thread_local boost::locale::generator g; g.locale_cache_enabled(true); @@ -36,7 +36,7 @@ std::string Utf8ToCLocale(const char* utf8_str, int len) { template inline RowStatus MoveSingleCellToCharBuffer( std::vector& buffer, int64_t& last_retrieved_arrow_row, -#if defined _WIN32 || defined _WIN64 +#if defined _WIN32 std::string& clocale_str, #endif ColumnBinding* binding, StringArray* array, int64_t arrow_row, int64_t i, @@ -57,7 +57,7 @@ inline RowStatus MoveSingleCellToCharBuffer( value = buffer.data(); size_in_bytes = buffer.size(); } else { -#if defined _WIN32 || defined _WIN64 +#if defined _WIN32 // Convert to C locale string if (last_retrieved_arrow_row != arrow_row) { clocale_str = Utf8ToCLocale(raw_value, raw_value_length); @@ -124,7 +124,7 @@ RowStatus StringArrayFlightSqlAccessor::MoveSingleCellIm ColumnBinding* binding, int64_t arrow_row, int64_t i, int64_t& value_offset, bool update_value_offset, Diagnostics& diagnostics) { return MoveSingleCellToCharBuffer(buffer_, last_arrow_row_, -#if defined _WIN32 || defined _WIN64 +#if defined _WIN32 clocale_str_, #endif binding, this->GetArray(), arrow_row, i, diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor.h index db68084f408..60a8e37f577 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor.h @@ -41,7 +41,7 @@ class StringArrayFlightSqlAccessor private: std::vector buffer_; -#if defined _WIN32 || defined _WIN64 +#if defined _WIN32 std::string clocale_str_; #endif int64_t last_arrow_row_; diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.cc index b4f9c69b39b..479a72f3fea 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.cc @@ -212,7 +212,7 @@ boost::optional FlightSqlConnection::GetStringColumnLength( } bool FlightSqlConnection::GetUseWideChar(const ConnPropertyMap& conn_property_map) { -#if defined _WIN32 || defined _WIN64 +#if defined _WIN32 // Windows should use wide chars by default bool default_value = true; #else diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.cc index d7d2e72b4b5..14302ed5a62 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.cc @@ -20,7 +20,7 @@ #include "arrow/flight/sql/odbc/odbc_impl/system_trust_store.h" -#if defined _WIN32 || defined _WIN64 +#if defined _WIN32 namespace arrow::flight::sql::odbc { bool SystemTrustStore::HasNext() { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h index 6c962594351..499eba1d1f8 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h @@ -17,7 +17,7 @@ #pragma once -#if defined _WIN32 || defined _WIN64 +#if defined _WIN32 # include diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/custom_window.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/custom_window.cc index f8075ab29e7..179303b68e3 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/custom_window.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/custom_window.cc @@ -19,11 +19,12 @@ // before Windowsx.h and commctrl.h #include "arrow/flight/sql/odbc/odbc_impl/platform.h" +#include "arrow/util/logging.h" + #include #include #include -#include #include #include "arrow/flight/sql/odbc/odbc_impl/exceptions.h" @@ -53,7 +54,7 @@ LRESULT CALLBACK CustomWindow::WndProc(HWND hwnd, UINT msg, WPARAM wparam, switch (msg) { case WM_NCCREATE: { - assert(lparam != NULL); + ARROW_DCHECK_NE(lparam, NULL); CREATESTRUCT* create_struct = reinterpret_cast(lparam); @@ -65,7 +66,7 @@ LRESULT CALLBACK CustomWindow::WndProc(HWND hwnd, UINT msg, WPARAM wparam, } case WM_CREATE: { - assert(window != NULL); + ARROW_DCHECK_NE(window, NULL); window->SetHandle(hwnd); diff --git a/cpp/src/arrow/flight/sql/odbc/install/install_amd64.cmd b/cpp/src/arrow/flight/sql/odbc/script/install_odbc.cmd similarity index 81% rename from cpp/src/arrow/flight/sql/odbc/install/install_amd64.cmd rename to cpp/src/arrow/flight/sql/odbc/script/install_odbc.cmd index b1fd85d578e..dc09bf781d6 100644 --- a/cpp/src/arrow/flight/sql/odbc/install/install_amd64.cmd +++ b/cpp/src/arrow/flight/sql/odbc/script/install_odbc.cmd @@ -17,37 +17,37 @@ @echo off -set ODBC_AMD64=%1 +set ODBC_64BIT=%1 @REM enable delayed variable expansion to make environment variables enclosed with "!" to be evaluated @REM when the command is executed instead of when the command is parsed setlocal enableextensions enabledelayedexpansion -if [%ODBC_AMD64%] == [] ( - echo error: 64-bit driver is not specified. Call format: install_amd64 abs_path_to_64_bit_driver +if [%ODBC_64BIT%] == [] ( + echo error: 64-bit driver is not specified. Call format: install_odbc abs_path_to_64_bit_driver pause exit /b 1 ) -if exist %ODBC_AMD64% ( - for %%i IN (%ODBC_AMD64%) DO IF EXIST %%~si\NUL ( +if exist %ODBC_64BIT% ( + for %%i IN (%ODBC_64BIT%) DO IF EXIST %%~si\NUL ( echo warning: The path you have specified seems to be a directory. Note that you have to specify path to driver file itself instead. ) - echo Installing 64-bit driver: %ODBC_AMD64% + echo Installing 64-bit driver: %ODBC_64BIT% reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v DriverODBCVer /t REG_SZ /d "03.80" /f reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v UsageCount /t REG_DWORD /d 00000001 /f - reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v Driver /t REG_SZ /d %ODBC_AMD64% /f - reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v Setup /t REG_SZ /d %ODBC_AMD64% /f + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v Driver /t REG_SZ /d %ODBC_64BIT% /f + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v Setup /t REG_SZ /d %ODBC_64BIT% /f reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" /v "Apache Arrow Flight SQL ODBC Driver" /t REG_SZ /d "Installed" /f - IF !ERRORLEVEL! NEQ 0 ( + if !ERRORLEVEL! NEQ 0 ( echo Error occurred while registering 64-bit driver. Exiting. echo ERRORLEVEL: !ERRORLEVEL! exit !ERRORLEVEL! ) ) else ( - echo 64-bit driver can not be found: %ODBC_AMD64% - echo Call format: install_amd64 abs_path_to_64_bit_driver + echo 64-bit driver can not be found: %ODBC_64BIT% + echo Call format: install_odbc abs_path_to_64_bit_driver pause exit /b 1 ) From c880d47dce60ee0661d405af60b29e20cc2cb240 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Fri, 10 Oct 2025 17:15:17 -0700 Subject: [PATCH 5/5] Fix build and lint issues --- .github/workflows/cpp.yml | 2 +- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 2 +- .../arrow/flight/sql/odbc/{script => tests}/install_odbc.cmd | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename cpp/src/arrow/flight/sql/odbc/{script => tests}/install_odbc.cmd (100%) diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index e6a19b1850a..6303a414c4e 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -479,7 +479,7 @@ jobs: - name: Register Flight SQL ODBC Driver shell: cmd run: | - call "cpp\src\arrow\flight\sql\odbc\install\install_odbc.cmd" ${{ github.workspace }}\build\cpp\%ARROW_BUILD_TYPE%\libarrow_flight_sql_odbc.dll + call "cpp\src\arrow\flight\sql\odbc\tests\install_odbc.cmd" ${{ github.workspace }}\build\cpp\%ARROW_BUILD_TYPE%\libarrow_flight_sql_odbc.dll - name: Test shell: msys2 {0} run: | diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index f73d4435365..79f351ae9cb 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -37,7 +37,7 @@ add_subdirectory(odbc_impl) arrow_install_all_headers("arrow/flight/sql/odbc") -set(ARROW_FLIGHT_SQL_ODBC_SRCS entry_points.cc odbc_api.cc ) +set(ARROW_FLIGHT_SQL_ODBC_SRCS entry_points.cc odbc_api.cc) if(WIN32) list(APPEND ARROW_FLIGHT_SQL_ODBC_SRCS odbc.def) diff --git a/cpp/src/arrow/flight/sql/odbc/script/install_odbc.cmd b/cpp/src/arrow/flight/sql/odbc/tests/install_odbc.cmd similarity index 100% rename from cpp/src/arrow/flight/sql/odbc/script/install_odbc.cmd rename to cpp/src/arrow/flight/sql/odbc/tests/install_odbc.cmd