Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a4eed37
Add Arrow Flight SQL ODBC driver
alinaliBQ Apr 2, 2024
f4a8678
SQLDriverConnect, SQLConnect and SQLDisconnect
alinaliBQ May 12, 2025
c6a5355
Add odbc.def and cmd file to rat_exclude
alinaliBQ May 22, 2025
c353e2b
Nit - remove duplicate lines
alinaliBQ May 23, 2025
2d8d2fb
Nit - remove usage of nullptr
alinaliBQ May 23, 2025
7f74a3b
DSN window implementation
alinaliBQ May 22, 2025
b3a1df9
Add licenses to `.cmd` and `.def` files
alinaliBQ May 26, 2025
738fdbc
Implement SQLGetDiagRec
rscales May 27, 2025
bd0075e
Build ODBC in Windows Workflow
alinaliBQ May 26, 2025
c885f88
Updates for SQLGetDiagFieldW
rscales Jun 4, 2025
3c38a49
Enable Driver Logging
alinaliBQ May 30, 2025
07a04db
Implement ODBC API with debug logging
rscales Jun 11, 2025
4621824
Enable mock test (#42)
alinaliBQ Jun 12, 2025
af1bab2
Fix connection issues to DBT Labs
alinaliBQ Jun 12, 2025
5bd737a
Implement SQLAllocStmt
rscales Jun 12, 2025
78516d6
Follow-up DBT Labs connection fix
alinaliBQ Jun 13, 2025
81d5a2d
Implement SQLGetDiag Rec and Field for statement
rscales Jun 16, 2025
48093e6
Unicode support for DSN ODBC APIs
alinaliBQ Jun 16, 2025
014f297
Initialize Kernel functions
alinaliBQ Jun 17, 2025
e50d95b
Implement SQLSetConnectAttr and SQLGetConnectAttr
alinaliBQ Jun 18, 2025
4b0f367
ODBC Test Segfault Fix
alinaliBQ Jun 24, 2025
863fb55
SQLExecDirect implementation
alinaliBQ Jun 26, 2025
4bb52aa
Implement SQLGetInfo
rscales Jul 3, 2025
178318f
SQLGetInfo Workflow Fixes
rscales Jul 3, 2025
9109e6f
SQLFetch & SQLGetData Implementation
alinaliBQ Jul 4, 2025
2b0f244
SQLPrepare & SQLExecute Implementation
alinaliBQ Jul 9, 2025
f75f458
Code Style fixes
alinaliBQ Jul 10, 2025
079c4a0
Implement SQLGetStmtAttr and SQLSetStmtAttr
rscales Jul 14, 2025
7c9166e
SQLBindCol Implementation
alinaliBQ Jul 16, 2025
c4b0a0d
Enable TestCloseConnectionWithOpenStatement test case
rscales Jul 16, 2025
9e82b5c
SQLFetchScroll Implementation
alinaliBQ Jul 16, 2025
d7c7128
SQLExtendedFetch Implementation
alinaliBQ Jul 16, 2025
af9f125
GH-46584 Iterate endpoint
alinaliBQ Jul 17, 2025
c03ed46
SQLColumns Implementation
alinaliBQ Jul 22, 2025
822283e
Fix bug of DSN not read properly (#67)
alinaliBQ Jul 23, 2025
a7d97d5
SQLColAttribute implementation
alinaliBQ Jul 24, 2025
50c190d
Implement SQLTables
rscales Jul 25, 2025
ad0ea1e
Use C++ 20 standard for ODBC
alinaliBQ Jul 28, 2025
ef402a3
Add tests for SQLMoreResults
alinaliBQ Jul 28, 2025
ac226b4
Implement SQLNativeSql
rscales Jul 28, 2025
b1fdf76
Add diagnostic records
alinaliBQ Jul 28, 2025
328485f
Implement tests for SQLNumResultCols
rscales Jul 29, 2025
2d36a46
SQLCloseCursor Implementation
alinaliBQ Jul 30, 2025
6d8f28e
Add SQLColumns and SQLColAttribute tests with nullptr
alinaliBQ Jul 30, 2025
ec09b41
Implement tests for SQLRowCount
rscales Jul 31, 2025
8f5ec2e
Implement SQLDescribeCol
rscales Jul 31, 2025
8ac65f1
Fix merge issue
rscales Jul 31, 2025
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
4 changes: 4 additions & 0 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependency-reduced-pom.xml
MANIFEST
compile_commands.json
build.ninja
build*/

# Generated Visual Studio files
*.vcxproj
Expand Down
2 changes: 2 additions & 0 deletions ci/scripts/cpp_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -206,6 +207,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} \
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,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()
set(ARROW_BOOST_OPTIONAL_COMPONENTS process)
Expand Down
4 changes: 3 additions & 1 deletion cpp/src/arrow/flight/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ if(ARROW_TESTING)
STATIC_INSTALL_INTERFACE_LIBS
${ARROW_FLIGHT_TESTING_STATIC_INSTALL_INTERFACE_LIBS}
PRIVATE_INCLUDES
"${Protobuf_INCLUDE_DIRS}")
"${Protobuf_INCLUDE_DIRS}"
SHARED_PRIVATE_LINK_LIBS
GTest::gmock)

foreach(LIB_TARGET ${ARROW_FLIGHT_TESTING_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_FLIGHT_EXPORTING)
Expand Down
38 changes: 38 additions & 0 deletions cpp/src/arrow/flight/sql/odbc/ArrowFlightSqlOdbcConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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.
#
# This config sets the following variables in your project::
#
# ArrowFlightSqlOdbc_FOUND - true if Arrow Flight SQL ODBC found on the system
#
# This config sets the following targets in your project::
#
# ArrowFlightSqlOdbc::arrow_flight_sql_odbc_shared - for linked as shared library if shared library is built
# ArrowFlightSqlOdbc::arrow_flight_sql_odbc_static - for linked as static library if static library is built

@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(ArrowFlightSql)

include("${CMAKE_CURRENT_LIST_DIR}/ArrowFlightSqlOdbcTargets.cmake")

arrow_keep_backward_compatibility(ArrowFlightSqlOdbc arrow_flight_sql_odbc)

check_required_components(ArrowFlightSqlOdbc)

arrow_show_details(ArrowFlightSqlOdbc ARROW_FLIGHT_SQL_ODBC)
72 changes: 72 additions & 0 deletions cpp/src/arrow/flight/sql/odbc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,79 @@
# specific language governing permissions and limitations
# under the License.

# Use C++ 20 for ODBC and its subdirectory
# GH-44792: Arrow will switch to C++ 20
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_custom_target(arrow_flight_sql_odbc)

# Ensure fmt is loaded as header only
add_compile_definitions(FMT_HEADER_ONLY)

if(WIN32)
if(MSVC_VERSION GREATER_EQUAL 1900)
set(ODBCINST legacy_stdio_definitions odbccp32 shlwapi)
elseif(MINGW)
set(ODBCINST odbccp32 shlwapi)
endif()
elseif(APPLE)
set(ODBCINST iodbcinst)
else()
set(ODBCINST odbcinst)
endif()

add_definitions(-DUNICODE=1)

include(FetchContent)
fetchcontent_declare(spdlog
URL https://github.com/gabime/spdlog/archive/refs/tags/v1.15.3.zip
CONFIGURE_COMMAND
""
BUILD_COMMAND
"")
fetchcontent_makeavailable(spdlog)

add_subdirectory(flight_sql)
add_subdirectory(odbcabstraction)
add_subdirectory(tests)

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

set(ARROW_FLIGHT_SQL_ODBC_SRCS entry_points.cc odbc_api.cc)

if(WIN32)
list(APPEND ARROW_FLIGHT_SQL_ODBC_SRCS odbc.def)
endif()

add_arrow_lib(arrow_flight_sql_odbc
CMAKE_PACKAGE_NAME
ArrowFlightSqlOdbc
PKG_CONFIG_NAME
arrow-flight-sql-odbc
OUTPUTS
ARROW_FLIGHT_SQL_ODBC_LIBRARIES
SOURCES
${ARROW_FLIGHT_SQL_ODBC_SRCS}
DEPENDENCIES
arrow_flight_sql
SHARED_LINK_FLAGS
${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt
SHARED_LINK_LIBS
arrow_flight_sql_shared
SHARED_INSTALL_INTERFACE_LIBS
ArrowFlight::arrow_flight_sql_shared
STATIC_LINK_LIBS
arrow_flight_sql_static
STATIC_INSTALL_INTERFACE_LIBS
ArrowFlight::arrow_flight_sql_static
SHARED_PRIVATE_LINK_LIBS
${ODBC_LIBRARIES}
${ODBCINST}
odbcabstraction
arrow_odbc_spi_impl
spdlog::spdlog)

foreach(LIB_TARGET ${ARROW_FLIGHT_SQL_ODBC_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_FLIGHT_SQL_ODBC_EXPORTING)
endforeach()
19 changes: 19 additions & 0 deletions cpp/src/arrow/flight/sql/odbc/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Steps to Register the 64-bit Apache Arrow ODBC driver on Windows

After the build succeeds, the ODBC DLL will be located in
`build\debug\Debug` for a debug build and `build\release\Release` for a release build.

1. Open Power Shell as administrator.

2. Register your ODBC DLL:
Need to replace <path\to\repo> with actual path to repository in the commands.

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`
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`

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.
27 changes: 27 additions & 0 deletions cpp/src/arrow/flight/sql/odbc/arrow-flight-sql-odbc.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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.

prefix=@CMAKE_INSTALL_PREFIX@
includedir=@ARROW_PKG_CONFIG_INCLUDEDIR@
libdir=@ARROW_PKG_CONFIG_LIBDIR@

Name: Apache Arrow Flight SQL ODBC
Description: Apache Arrow Flight SQL ODBC extension
Version: @ARROW_VERSION@
Requires: arrow-flight-sql
Libs: -L${libdir} -larrow_flight_sql_odbc
Cflags.private: -DARROW_FLIGHT_SQL_ODBC_STATIC
Loading
Loading