Skip to content

Commit

Permalink
refactor(c/driver/sqlite): port to driver base
Browse files Browse the repository at this point in the history
Fixes apache#1141.
Fixes apache#1355.
Fixes apache#1602.
  • Loading branch information
lidavidm committed Mar 14, 2024
1 parent 9f991ad commit 46cb1c5
Show file tree
Hide file tree
Showing 19 changed files with 4,096 additions and 52 deletions.
1 change: 1 addition & 0 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ include(CTest)

add_subdirectory(vendor/nanoarrow)
add_subdirectory(driver/common)
add_subdirectory(driver/framework)

if(ADBC_BUILD_TESTS)
add_subdirectory(validation)
Expand Down
19 changes: 0 additions & 19 deletions c/driver/common/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,6 @@ AdbcStatusCode BatchToArrayStream(struct ArrowArray* values, struct ArrowSchema*
if (adbc_status_code != ADBC_STATUS_OK) return adbc_status_code; \
} while (0)

/// \defgroup adbc-connection-utils Connection Utilities
/// Utilities for implementing connection-related functions for drivers
///
/// @{
AdbcStatusCode AdbcInitConnectionGetInfoSchema(struct ArrowSchema* schema,
struct ArrowArray* array,
struct AdbcError* error);
AdbcStatusCode AdbcConnectionGetInfoAppendString(struct ArrowArray* array,
uint32_t info_code,
const char* info_value,
struct AdbcError* error);
AdbcStatusCode AdbcConnectionGetInfoAppendInt(struct ArrowArray* array,
uint32_t info_code, int64_t info_value,
struct AdbcError* error);

AdbcStatusCode AdbcInitConnectionObjectsSchema(struct ArrowSchema* schema,
struct AdbcError* error);
/// @}

struct AdbcGetObjectsUsage {
struct ArrowStringView fk_catalog;
struct ArrowStringView fk_db_schema;
Expand Down
50 changes: 50 additions & 0 deletions c/driver/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 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.

include(FetchContent)

# Common library: fmtlib
fetchcontent_declare(fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 10.2.1)
fetchcontent_makeavailable(fmt)

add_library(adbc_driver_framework STATIC connection.cc driver.cc objects.cc)
adbc_configure_target(adbc_driver_framework)
set_target_properties(adbc_driver_framework PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(adbc_driver_framework
PRIVATE "${REPOSITORY_ROOT}" "${REPOSITORY_ROOT}/c/"
"${REPOSITORY_ROOT}/c/vendor")
target_link_libraries(adbc_driver_framework PUBLIC adbc_driver_common fmt::fmt)

# if(ADBC_BUILD_TESTS)
# add_test_case(driver_framework_test
# PREFIX
# adbc
# EXTRA_LABELS
# driver-framework
# SOURCES
# utils_test.cc
# driver_test.cc
# EXTRA_LINK_LIBS
# adbc_driver_framework
# nanoarrow)
# target_compile_features(adbc-driver-framework-test PRIVATE cxx_std_17)
# target_include_directories(adbc-driver-framework-test
# PRIVATE "${REPOSITORY_ROOT}" "${REPOSITORY_ROOT}/c/vendor")
# adbc_configure_target(adbc-driver-framework-test)
# endif()
Loading

0 comments on commit 46cb1c5

Please sign in to comment.