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: 3 additions & 0 deletions .github/workflows/cpp_extra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ jobs:
export ARROW_CMAKE_ARGS="-DODBC_INCLUDE_DIR=$ODBC_INCLUDE_DIR"
export CXXFLAGS="$CXXFLAGS -I$ODBC_INCLUDE_DIR"
ci/scripts/cpp_build.sh $(pwd) $(pwd)/build
- name: Register Flight SQL ODBC Driver
run: |
sudo cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc.sh $(pwd)/build/cpp/debug/libarrow_flight_sql_odbc.dylib
- name: Test
shell: bash
run: |
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ repos:
?^cpp/build-support/update-thrift\.sh$|
?^cpp/examples/minimal_build/run\.sh$|
?^cpp/examples/tutorial_examples/run\.sh$|
?^cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc\.sh$|
?^dev/release/05-binary-upload\.sh$|
?^dev/release/08-binary-verify\.sh$|
?^dev/release/binary-recover\.sh$|
Expand All @@ -379,6 +380,7 @@ repos:
files: >-
(
?^ci/scripts/python_test_type_annotations\.sh$|
?^cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc\.sh$|
?^dev/release/05-binary-upload\.sh$|
?^dev/release/binary-recover\.sh$|
?^dev/release/post-03-binary\.sh$|
Expand Down
77 changes: 77 additions & 0 deletions cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add this to lint targets?

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 566ade9172..a33aa3acb4 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -353,6 +353,7 @@ repos:
           ?^cpp/build-support/update-thrift\.sh$|
           ?^cpp/examples/minimal_build/run\.sh$|
           ?^cpp/examples/tutorial_examples/run\.sh$|
+          ?^cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc\.sh$|
           ?^dev/release/05-binary-upload\.sh$|
           ?^dev/release/08-binary-verify\.sh$|
           ?^dev/release/binary-recover\.sh$|
@@ -379,6 +380,7 @@ repos:
         files: >-
           (
           ?^ci/scripts/python_test_type_annotations\.sh$|
+          ?^cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc\.sh$|
           ?^dev/release/05-binary-upload\.sh$|
           ?^dev/release/binary-recover\.sh$|
           ?^dev/release/post-03-binary\.sh$|

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, added to lint targets

Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash
#
# 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.

# Used by macOS ODBC installer script `install_odbc_ini.sh` and macOS ODBC testing

set -euo pipefail

# Admin privilege is needed to add ODBC driver registration
if [ $EUID -ne 0 ]; then
echo "Please run this script with sudo"
exit 1
fi

ODBC_64BIT="$1"

if [[ -z "$ODBC_64BIT" ]]; then
echo "error: 64-bit driver is not specified. Call format: install_odbc abs_path_to_64_bit_driver"
exit 1
fi

if [ ! -f "$ODBC_64BIT" ]; then
echo "64-bit driver can not be found: $ODBC_64BIT"
echo "Call format: install_odbc abs_path_to_64_bit_driver"
exit 1
fi

USER_ODBCINST_FILE="$HOME/Library/ODBC/odbcinst.ini"
DRIVER_NAME="Apache Arrow Flight SQL ODBC Driver"

mkdir -p "$HOME"/Library/ODBC

touch "$USER_ODBCINST_FILE"

if grep -q "^\[$DRIVER_NAME\]" "$USER_ODBCINST_FILE"; then
echo "Driver [$DRIVER_NAME] already exists in odbcinst.ini"
else
echo "Adding [$DRIVER_NAME] to odbcinst.ini..."
echo "
[$DRIVER_NAME]
Description=An ODBC Driver for Apache Arrow Flight SQL
Driver=$ODBC_64BIT
" >>"$USER_ODBCINST_FILE"
fi

# Check if [ODBC Drivers] section exists
if grep -q '^\[ODBC Drivers\]' "$USER_ODBCINST_FILE"; then
# Section exists: check if driver entry exists
if ! grep -q "^${DRIVER_NAME}=" "$USER_ODBCINST_FILE"; then
# Driver entry does not exist, add under [ODBC Drivers]
sed -i '' "/^\[ODBC Drivers\]/a\\
${DRIVER_NAME}=Installed
" "$USER_ODBCINST_FILE"
fi
else
# Section doesn't exist, append both section and driver entry at end
{
echo ""
echo "[ODBC Drivers]"
echo "${DRIVER_NAME}=Installed"
} >>"$USER_ODBCINST_FILE"
fi
Loading