Skip to content

Commit 20545e8

Browse files
committed
Address Sutou's comments
1 parent 4d254df commit 20545e8

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
lines changed

.github/workflows/cpp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ jobs:
479479
- name: Register Flight SQL ODBC Driver
480480
shell: cmd
481481
run: |
482-
call "cpp\src\arrow\flight\sql\odbc\install\install_amd64.cmd" ${{github.workspace}}\build\cpp\%ARROW_BUILD_TYPE%\libarrow_flight_sql_odbc.dll
482+
call "cpp\src\arrow\flight\sql\odbc\install\install_odbc.cmd" ${{ github.workspace }}\build\cpp\%ARROW_BUILD_TYPE%\libarrow_flight_sql_odbc.dll
483483
- name: Test
484484
shell: msys2 {0}
485485
run: |

cpp/src/arrow/flight/sql/odbc/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ add_subdirectory(odbc_impl)
3737

3838
arrow_install_all_headers("arrow/flight/sql/odbc")
3939

40-
# Compile entry_points.cc before odbc_api.cc due to conflict from sql.h and flight/types.h
41-
set(ARROW_FLIGHT_SQL_ODBC_SRCS odbc_api.cc entry_points.cc)
40+
set(ARROW_FLIGHT_SQL_ODBC_SRCS entry_points.cc odbc_api.cc )
4241

4342
if(WIN32)
4443
list(APPEND ARROW_FLIGHT_SQL_ODBC_SRCS odbc.def)

cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
namespace arrow::flight::sql::odbc {
2525
namespace {
2626

27-
#if defined _WIN32 || defined _WIN64
27+
#if defined _WIN32
2828
std::string Utf8ToCLocale(const char* utf8_str, int len) {
2929
thread_local boost::locale::generator g;
3030
g.locale_cache_enabled(true);
@@ -36,7 +36,7 @@ std::string Utf8ToCLocale(const char* utf8_str, int len) {
3636
template <typename CHAR_TYPE>
3737
inline RowStatus MoveSingleCellToCharBuffer(
3838
std::vector<uint8_t>& buffer, int64_t& last_retrieved_arrow_row,
39-
#if defined _WIN32 || defined _WIN64
39+
#if defined _WIN32
4040
std::string& clocale_str,
4141
#endif
4242
ColumnBinding* binding, StringArray* array, int64_t arrow_row, int64_t i,
@@ -57,7 +57,7 @@ inline RowStatus MoveSingleCellToCharBuffer(
5757
value = buffer.data();
5858
size_in_bytes = buffer.size();
5959
} else {
60-
#if defined _WIN32 || defined _WIN64
60+
#if defined _WIN32
6161
// Convert to C locale string
6262
if (last_retrieved_arrow_row != arrow_row) {
6363
clocale_str = Utf8ToCLocale(raw_value, raw_value_length);
@@ -124,7 +124,7 @@ RowStatus StringArrayFlightSqlAccessor<TARGET_TYPE, CHAR_TYPE>::MoveSingleCellIm
124124
ColumnBinding* binding, int64_t arrow_row, int64_t i, int64_t& value_offset,
125125
bool update_value_offset, Diagnostics& diagnostics) {
126126
return MoveSingleCellToCharBuffer<CHAR_TYPE>(buffer_, last_arrow_row_,
127-
#if defined _WIN32 || defined _WIN64
127+
#if defined _WIN32
128128
clocale_str_,
129129
#endif
130130
binding, this->GetArray(), arrow_row, i,

cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class StringArrayFlightSqlAccessor
4141

4242
private:
4343
std::vector<uint8_t> buffer_;
44-
#if defined _WIN32 || defined _WIN64
44+
#if defined _WIN32
4545
std::string clocale_str_;
4646
#endif
4747
int64_t last_arrow_row_;

cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ boost::optional<int32_t> FlightSqlConnection::GetStringColumnLength(
212212
}
213213

214214
bool FlightSqlConnection::GetUseWideChar(const ConnPropertyMap& conn_property_map) {
215-
#if defined _WIN32 || defined _WIN64
215+
#if defined _WIN32
216216
// Windows should use wide chars by default
217217
bool default_value = true;
218218
#else

cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#include "arrow/flight/sql/odbc/odbc_impl/system_trust_store.h"
1919

20-
#if defined _WIN32 || defined _WIN64
20+
#if defined _WIN32
2121

2222
namespace arrow::flight::sql::odbc {
2323
bool SystemTrustStore::HasNext() {

cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#pragma once
1919

20-
#if defined _WIN32 || defined _WIN64
20+
#if defined _WIN32
2121

2222
# include <windows.h>
2323

cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/custom_window.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
// before Windowsx.h and commctrl.h
2020
#include "arrow/flight/sql/odbc/odbc_impl/platform.h"
2121

22+
#include "arrow/util/logging.h"
23+
2224
#include <Windowsx.h>
2325
#include <commctrl.h>
2426

2527
#include <wtypes.h>
26-
#include <cassert>
2728
#include <sstream>
2829

2930
#include "arrow/flight/sql/odbc/odbc_impl/exceptions.h"
@@ -53,7 +54,7 @@ LRESULT CALLBACK CustomWindow::WndProc(HWND hwnd, UINT msg, WPARAM wparam,
5354

5455
switch (msg) {
5556
case WM_NCCREATE: {
56-
assert(lparam != NULL);
57+
ARROW_DCHECK_NE(lparam, NULL);
5758

5859
CREATESTRUCT* create_struct = reinterpret_cast<CREATESTRUCT*>(lparam);
5960

@@ -65,7 +66,7 @@ LRESULT CALLBACK CustomWindow::WndProc(HWND hwnd, UINT msg, WPARAM wparam,
6566
}
6667

6768
case WM_CREATE: {
68-
assert(window != NULL);
69+
ARROW_DCHECK_NE(window, NULL);
6970

7071
window->SetHandle(hwnd);
7172

cpp/src/arrow/flight/sql/odbc/install/install_amd64.cmd renamed to cpp/src/arrow/flight/sql/odbc/script/install_odbc.cmd

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,37 @@
1717

1818
@echo off
1919

20-
set ODBC_AMD64=%1
20+
set ODBC_64BIT=%1
2121

2222
@REM enable delayed variable expansion to make environment variables enclosed with "!" to be evaluated
2323
@REM when the command is executed instead of when the command is parsed
2424
setlocal enableextensions enabledelayedexpansion
2525

26-
if [%ODBC_AMD64%] == [] (
27-
echo error: 64-bit driver is not specified. Call format: install_amd64 abs_path_to_64_bit_driver
26+
if [%ODBC_64BIT%] == [] (
27+
echo error: 64-bit driver is not specified. Call format: install_odbc abs_path_to_64_bit_driver
2828
pause
2929
exit /b 1
3030
)
3131

32-
if exist %ODBC_AMD64% (
33-
for %%i IN (%ODBC_AMD64%) DO IF EXIST %%~si\NUL (
32+
if exist %ODBC_64BIT% (
33+
for %%i IN (%ODBC_64BIT%) DO IF EXIST %%~si\NUL (
3434
echo warning: The path you have specified seems to be a directory. Note that you have to specify path to driver file itself instead.
3535
)
36-
echo Installing 64-bit driver: %ODBC_AMD64%
36+
echo Installing 64-bit driver: %ODBC_64BIT%
3737
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v DriverODBCVer /t REG_SZ /d "03.80" /f
3838
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v UsageCount /t REG_DWORD /d 00000001 /f
39-
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v Driver /t REG_SZ /d %ODBC_AMD64% /f
40-
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v Setup /t REG_SZ /d %ODBC_AMD64% /f
39+
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v Driver /t REG_SZ /d %ODBC_64BIT% /f
40+
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v Setup /t REG_SZ /d %ODBC_64BIT% /f
4141
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" /v "Apache Arrow Flight SQL ODBC Driver" /t REG_SZ /d "Installed" /f
4242

43-
IF !ERRORLEVEL! NEQ 0 (
43+
if !ERRORLEVEL! NEQ 0 (
4444
echo Error occurred while registering 64-bit driver. Exiting.
4545
echo ERRORLEVEL: !ERRORLEVEL!
4646
exit !ERRORLEVEL!
4747
)
4848
) else (
49-
echo 64-bit driver can not be found: %ODBC_AMD64%
50-
echo Call format: install_amd64 abs_path_to_64_bit_driver
49+
echo 64-bit driver can not be found: %ODBC_64BIT%
50+
echo Call format: install_odbc abs_path_to_64_bit_driver
5151
pause
5252
exit /b 1
5353
)

0 commit comments

Comments
 (0)