Skip to content
Open
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
8 changes: 4 additions & 4 deletions cpp/src/arrow/flight/sql/odbc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if(WIN32)
set(VER_COMPANYNAME_STR ${ODBC_PACKAGE_VENDOR})
set(VER_PRODUCTNAME_STR ${ODBC_PACKAGE_NAME})

configure_file("install/versioninfo.rc.in" "install/versioninfo.rc" @ONLY)
configure_file("install/windows/versioninfo.rc.in" "install/versioninfo.rc" @ONLY)

list(APPEND ARROW_FLIGHT_SQL_ODBC_SRCS odbc.def install/versioninfo.rc)
endif()
Expand Down Expand Up @@ -136,11 +136,11 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)
PATTERN "zlib1.dll")

set(CPACK_WIX_EXTRA_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/install/arrow-flight-sql-odbc.wxs")
"${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-flight-sql-odbc.wxs")
set(CPACK_WIX_PATCH_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/install/arrow-flight-sql-odbc-patch.xml")
"${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-flight-sql-odbc-patch.xml")

set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/install/arrow-wix-banner.bmp")
set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-wix-banner.bmp")
endif()

get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/flight/sql/odbc/README
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ After the build succeeds, the ODBC DLL will be located in
i. `cd to repo.`
ii. `cd <path\to\repo>`
iii. Run script to register your ODBC DLL as Apache Arrow Flight SQL ODBC Driver
`.\cpp\src\arrow\flight\sql\odbc\install\install_amd64.cmd <path\to\repo>\cpp\build\< release | debug >\< Release | Debug>\arrow_flight_sql_odbc.dll`
`.\cpp\src\arrow\flight\sql\odbc\tests\install_odbc.cmd <path\to\repo>\cpp\build\< release | debug >\< Release | Debug>\arrow_flight_sql_odbc.dll`
Example command for reference:
`.\cpp\src\arrow\flight\sql\odbc\install\install_amd64.cmd C:\path\to\arrow\cpp\build\release\Release\arrow_flight_sql_odbc.dll`
`.\cpp\src\arrow\flight\sql\odbc\tests\install_odbc.cmd C:\path\to\arrow\cpp\build\release\Release\arrow_flight_sql_odbc.dll`

If the registration is successful, then Apache Arrow Flight SQL ODBC Driver
should show as an available ODBC driver in the x64 ODBC Driver Manager.
Expand Down
82 changes: 82 additions & 0 deletions cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc_ini.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# GH-47876 TODO: create macOS ODBC Installer.
# Script for installing macOS ODBC driver, to be used for macOS installer.

source_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

odbc_install_script="${source_dir}/install_odbc.sh"

chmod +x "$odbc_install_script"
. "$odbc_install_script" /Library/Apache/ArrowFlightSQLODBC/lib/libarrow_flight_sql_odbc.dylib

USER_ODBC_FILE="$HOME/Library/ODBC/odbc.ini"
DRIVER_NAME="Apache Arrow Flight SQL ODBC Driver"
DSN_NAME="Apache Arrow Flight SQL ODBC DSN"

touch "$USER_ODBC_FILE"

if [ $EUID -ne 0 ]; then
echo "Please run this script with sudo"
exit 1
fi

if grep -q "^\[$DSN_NAME\]" "$USER_ODBC_FILE"; then
echo "DSN [$DSN_NAME] already exists in $USER_ODBC_FILE"
else
echo "Adding [$DSN_NAME] to $USER_ODBC_FILE..."
cat >> "$USER_ODBC_FILE" <<EOF

[$DSN_NAME]
Description = An ODBC Driver DSN for Apache Arrow Flight SQL
Driver = Apache Arrow Flight SQL ODBC Driver
Host =
Port =
UID =
PWD =
EOF
fi

# Check if [ODBC Data Sources] section exists
if grep -q '^\[ODBC Data Sources\]' "$USER_ODBC_FILE"; then
# Section exists: check if DSN entry exists
if ! grep -q "^${DSN_NAME}=" "$USER_ODBC_FILE"; then
# Add DSN entry under [ODBC Data Sources] section

# Use awk to insert the line immediately after [ODBC Data Sources]
awk -v dsn="$DSN_NAME" -v driver="$DRIVER_NAME" '
$0 ~ /^\[ODBC Data Sources\]/ && !inserted {
print
print dsn "=" driver
inserted=1
next
}
{ print }
' "$USER_ODBC_FILE" > "${USER_ODBC_FILE}.tmp" && mv "${USER_ODBC_FILE}.tmp" "$USER_ODBC_FILE"
fi
else
# Section doesn't exist, append section and DSN entry at end
{
echo ""
echo "[ODBC Data Sources]"
echo "${DSN_NAME}=${DRIVER_NAME}"
} >> "$USER_ODBC_FILE"
fi