diff --git a/.github/workflows/sql-odbc-main.yml b/.github/workflows/sql-odbc-main.yml index 6e01be6bc3..5ebfcf4dc3 100644 --- a/.github/workflows/sql-odbc-main.yml +++ b/.github/workflows/sql-odbc-main.yml @@ -13,14 +13,15 @@ env: CI_OUTPUT_PATH: "sql-odbc/ci-output" ODBC_LIB_PATH: "./build/odbc/lib" ODBC_BIN_PATH: "./build/odbc/bin" - ODBC_BUILD_PATH: "./build/odbc/build" - AWS_SDK_INSTALL_PATH: "./build/aws-sdk/install" + ODBC_BUILD_PATH: "./build/odbc/cmake" + VCPKG_X64_INSTALL_PATH: ".\\src\\vcpkg_installed\\x64-windows" + VCPKG_X86_INSTALL_PATH: ".\\src\\vcpkg_installed\\x86-windows" # Tests are disabled (commented out) in all jobs because they are fail and/or outdated # Keeping them for the brighten future when we can re-activate them jobs: build-mac: - runs-on: macos-10.15 + runs-on: macos-12 defaults: run: working-directory: sql-odbc @@ -103,7 +104,7 @@ jobs: - name: build-installer if: success() run: | - .\scripts\build_installer.ps1 Release Win32 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH + .\scripts\build_installer.ps1 Release Win32 .\src $Env:ODBC_BUILD_PATH $Env:VCPKG_X86_INSTALL_PATH #- name: test # run: | # cp .\\libraries\\VisualLeakDetector\\bin32\\*.* .\\bin32\\Release @@ -148,7 +149,7 @@ jobs: - name: build-installer if: success() run: | - .\scripts\build_installer.ps1 Release x64 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH + .\scripts\build_installer.ps1 Release x64 .\src $Env:ODBC_BUILD_PATH $Env:VCPKG_X64_INSTALL_PATH #- name: test # run: | # cp .\\libraries\\VisualLeakDetector\\bin64\\*.* .\\bin64\\Release diff --git a/sql-odbc/aws_sdk_cpp_setup.sh b/sql-odbc/aws_sdk_cpp_setup.sh deleted file mode 100755 index b75cc01aa7..0000000000 --- a/sql-odbc/aws_sdk_cpp_setup.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -cd src -git clone -b "1.7.329" "https://github.com/aws/aws-sdk-cpp.git" -cd .. diff --git a/sql-odbc/build_mac_debug64.sh b/sql-odbc/build_mac_debug64.sh index 3522137921..784aeade81 100755 --- a/sql-odbc/build_mac_debug64.sh +++ b/sql-odbc/build_mac_debug64.sh @@ -1,14 +1,18 @@ -# Build AWS SDK -# $BITNESS=64 +#!/bin/bash cd src -git clone -b "1.7.329" "https://github.com/aws/aws-sdk-cpp.git" +vcpkg install cd .. +vcpkg_installed_dir='x64-osx' +if [[ $MACHTYPE == 'arm64-apple-darwin'* ]]; then + vcpkg_installed_dir='arm64-osx' +fi + PREFIX_PATH=$(pwd) mkdir cmake-build64 cd cmake-build64 -cmake ../src -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH}/AWSSDK/ -DCMAKE_BUILD_TYPE=Debug -DBUILD_ONLY="core" -DCUSTOM_MEMORY_MANAGEMENT="OFF" -DENABLE_RTTI="OFF" -DENABLE_TESTING="OFF" +cmake ../src -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH}/src/vcpkg_installed/${vcpkg_installed_dir}/ -DCMAKE_BUILD_TYPE=Debug -DBUILD_ONLY="core" -DCUSTOM_MEMORY_MANAGEMENT="OFF" -DENABLE_RTTI="OFF" -DENABLE_TESTING="OFF" cd .. cmake --build cmake-build64 -- -j 4 diff --git a/sql-odbc/build_mac_release64.sh b/sql-odbc/build_mac_release64.sh index 707a0ee53f..8fab73efc3 100755 --- a/sql-odbc/build_mac_release64.sh +++ b/sql-odbc/build_mac_release64.sh @@ -1,14 +1,18 @@ -# Build AWS SDK -# $BITNESS=64 +#!/bin/bash cd src -git clone -b "1.7.329" "https://github.com/aws/aws-sdk-cpp.git" +vcpkg install cd .. +vcpkg_installed_dir='x64-osx' +if [[ $MACHTYPE == 'arm64-apple-darwin'* ]]; then + vcpkg_installed_dir='arm64-osx' +fi + PREFIX_PATH=$(pwd) mkdir cmake-build64 cd cmake-build64 -cmake ../src -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH}/AWSSDK/ -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="core" -DCUSTOM_MEMORY_MANAGEMENT="OFF" -DENABLE_RTTI="OFF" -DENABLE_TESTING="OFF" +cmake ../src -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH}/src/vcpkg_installed/${vcpkg_installed_dir}/ -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="core" -DCUSTOM_MEMORY_MANAGEMENT="OFF" -DENABLE_RTTI="OFF" -DENABLE_TESTING="OFF" cd .. cmake --build cmake-build64 -- -j 4 diff --git a/sql-odbc/build_win_debug32.ps1 b/sql-odbc/build_win_debug32.ps1 index 7e23ada173..2717064b14 100644 --- a/sql-odbc/build_win_debug32.ps1 +++ b/sql-odbc/build_win_debug32.ps1 @@ -1,2 +1,6 @@ $WORKING_DIR = (Get-Location).Path +$env:VCPKG_DEFAULT_TRIPLET = 'x86-windows' +cd src +vcpkg install +cd .. .\scripts\build_windows.ps1 $WORKING_DIR Debug 32 diff --git a/sql-odbc/build_win_debug64.ps1 b/sql-odbc/build_win_debug64.ps1 index ea7084bada..98a9a24ff1 100644 --- a/sql-odbc/build_win_debug64.ps1 +++ b/sql-odbc/build_win_debug64.ps1 @@ -1,2 +1,6 @@ $WORKING_DIR = (Get-Location).Path +$env:VCPKG_DEFAULT_TRIPLET = 'x64-windows' +cd src +vcpkg install +cd .. .\scripts\build_windows.ps1 $WORKING_DIR Debug 64 diff --git a/sql-odbc/build_win_release32.ps1 b/sql-odbc/build_win_release32.ps1 index 4bcf4bd48e..c7e41da659 100644 --- a/sql-odbc/build_win_release32.ps1 +++ b/sql-odbc/build_win_release32.ps1 @@ -1,2 +1,6 @@ $WORKING_DIR = (Get-Location).Path +$env:VCPKG_DEFAULT_TRIPLET = 'x86-windows' +cd src +vcpkg install +cd .. .\scripts\build_windows.ps1 $WORKING_DIR Release 32 diff --git a/sql-odbc/build_win_release64.ps1 b/sql-odbc/build_win_release64.ps1 index 82b1199b33..a17f4d63f6 100644 --- a/sql-odbc/build_win_release64.ps1 +++ b/sql-odbc/build_win_release64.ps1 @@ -1,2 +1,6 @@ $WORKING_DIR = (Get-Location).Path +$env:VCPKG_DEFAULT_TRIPLET = 'x64-windows' +cd src +vcpkg install +cd .. .\scripts\build_windows.ps1 $WORKING_DIR Release 64 diff --git a/sql-odbc/libraries/rabbit/include/rabbit.hpp b/sql-odbc/libraries/rabbit/include/rabbit.hpp index ea4cddebc8..736de5e1b5 100644 --- a/sql-odbc/libraries/rabbit/include/rabbit.hpp +++ b/sql-odbc/libraries/rabbit/include/rabbit.hpp @@ -1150,10 +1150,6 @@ class basic_array : public basic_value : base_type(alloc) {} - basic_array(const basic_array& other) - : base_type(other) - {} - template basic_array(const basic_value_ref& other) : base_type(other) diff --git a/sql-odbc/scripts/build_aws-sdk-cpp.ps1 b/sql-odbc/scripts/build_aws-sdk-cpp.ps1 deleted file mode 100644 index 999d12f5bf..0000000000 --- a/sql-odbc/scripts/build_aws-sdk-cpp.ps1 +++ /dev/null @@ -1,45 +0,0 @@ -$CONFIGURATION = $args[0] -$WIN_ARCH = $args[1] -$SRC_DIR = $args[2] -$BUILD_DIR = $args[3] -$INSTALL_DIR = $args[4] -$VCPKG_DIR = $args[5] -$LIBCURL_WIN_ARCH = $args[6] - -Write-Host $args - -# Clone the AWS SDK CPP repo -$SDK_VER = "1.9.199" - -git clone ` - --branch ` - $SDK_VER ` - --single-branch ` - "https://github.com/aws/aws-sdk-cpp.git" ` - --recurse-submodules ` - $SRC_DIR - -# Make and move to build directory -New-Item -Path $BUILD_DIR -ItemType Directory -Force | Out-Null -Set-Location $BUILD_DIR - -# Configure and build -cmake $SRC_DIR ` - -A $WIN_ARCH ` - -D CMAKE_VERBOSE_MAKEFILE=ON ` - -D CMAKE_INSTALL_PREFIX=$INSTALL_DIR ` - -D CMAKE_BUILD_TYPE=$CONFIGURATION ` - -D BUILD_ONLY="core" ` - -D ENABLE_UNITY_BUILD="ON" ` - -D CUSTOM_MEMORY_MANAGEMENT="OFF" ` - -D ENABLE_RTTI="OFF" ` - -D ENABLE_TESTING="OFF" ` - -D FORCE_CURL="ON" ` - -D ENABLE_CURL_CLIENT="ON" ` - -DCMAKE_TOOLCHAIN_FILE="${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake" ` - -D CURL_LIBRARY="${VCPKG_DIR}/packages/curl_${LIBCURL_WIN_ARCH}-windows/lib" ` - -D CURL_INCLUDE_DIR="${VCPKG_DIR}/packages/curl_${LIBCURL_WIN_ARCH}-windows/include/" - -# Build AWS SDK and install to $INSTALL_DIR -msbuild ALL_BUILD.vcxproj /m /p:Configuration=$CONFIGURATION -msbuild INSTALL.vcxproj /m /p:Configuration=$CONFIGURATION diff --git a/sql-odbc/scripts/build_driver.ps1 b/sql-odbc/scripts/build_driver.ps1 index 1c0f8a799c..7f514a08c3 100644 --- a/sql-odbc/scripts/build_driver.ps1 +++ b/sql-odbc/scripts/build_driver.ps1 @@ -2,13 +2,17 @@ $CONFIGURATION = $args[0] $WIN_ARCH = $args[1] $SRC_DIR = $args[2] $BUILD_DIR = $args[3] -$INSTALL_DIR = $args[4] +$VCPKG_INSTALLED_DIR = $args[4] + +# aws-sdk-cpp fails compilation with warning: +# "Various members of std::allocator are deprecated in C++17" +$env:CL='-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING' cmake -S $SRC_DIR ` -B $BUILD_DIR ` -A $WIN_ARCH ` -D CMAKE_BUILD_TYPE=$CONFIGURATION ` - -D CMAKE_INSTALL_PREFIX=$INSTALL_DIR ` + -D CMAKE_INSTALL_PREFIX=$VCPKG_INSTALLED_DIR ` -D BUILD_WITH_TESTS=ON # # Build Project diff --git a/sql-odbc/scripts/build_installer.ps1 b/sql-odbc/scripts/build_installer.ps1 index b6a8e6edc0..63857b4705 100644 --- a/sql-odbc/scripts/build_installer.ps1 +++ b/sql-odbc/scripts/build_installer.ps1 @@ -6,6 +6,10 @@ $INSTALL_DIR = $args[4] Write-Host $args +# aws-sdk-cpp fails compilation with warning: +# "Various members of std::allocator are deprecated in C++17" +$env:CL='-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING' + cmake -S $SRC_DIR ` -B $BUILD_DIR ` -A $WIN_ARCH ` diff --git a/sql-odbc/scripts/build_windows.ps1 b/sql-odbc/scripts/build_windows.ps1 index 48e32345b6..f2090df541 100644 --- a/sql-odbc/scripts/build_windows.ps1 +++ b/sql-odbc/scripts/build_windows.ps1 @@ -9,51 +9,28 @@ if ($BITNESS -eq "64") { else { $WIN_ARCH = "Win32" } -if ($BITNESS -eq "64") { - $LIBCURL_WIN_ARCH = "x64" -} -else { - $LIBCURL_WIN_ARCH = "x86" -} # Create build directory; remove if exists $BUILD_DIR = "${WORKING_DIR}\build" -# $BUILD_DIR = "${WORKING_DIR}\build\${CONFIGURATION}${BITNESS}" New-Item -Path $BUILD_DIR -ItemType Directory -Force | Out-Null -$VCPKG_DIR = "${WORKING_DIR}/src/vcpkg" - -.\scripts\build_libcurl-vcpkg.ps1 $VCPKG_DIR $LIBCURL_WIN_ARCH - -Set-Location $CURRENT_DIR - -# Build AWS SDK CPP -$SDK_SOURCE_DIR = "${WORKING_DIR}\src\aws-sdk-cpp" -$SDK_BUILD_DIR = "${BUILD_DIR}\aws-sdk\build" -$SDK_INSTALL_DIR = "${BUILD_DIR}\aws-sdk\install" - -.\scripts\build_aws-sdk-cpp.ps1 ` - $CONFIGURATION $WIN_ARCH ` - $SDK_SOURCE_DIR $SDK_BUILD_DIR $SDK_INSTALL_DIR $VCPKG_DIR ` - $LIBCURL_WIN_ARCH - Set-Location $CURRENT_DIR # Build driver $DRIVER_SOURCE_DIR = "${WORKING_DIR}\src" $DRIVER_BUILD_DIR = "${BUILD_DIR}\odbc\cmake" +$VCPKG_INSTALLED_DIR = "${DRIVER_SOURCE_DIR}\vcpkg_installed\$env:VCPKG_DEFAULT_TRIPLET" .\scripts\build_driver.ps1 ` $CONFIGURATION $WIN_ARCH ` - $DRIVER_SOURCE_DIR $DRIVER_BUILD_DIR $SDK_INSTALL_DIR + $DRIVER_SOURCE_DIR $DRIVER_BUILD_DIR $VCPKG_INSTALLED_DIR Set-Location $CURRENT_DIR # Move driver dependencies to bin directory for testing -$DRIVER_BIN_DIR = "$DRIVER_BUILD_DIR\..\bin\$CONFIGURATION" +$DRIVER_BIN_DIR = "${BUILD_DIR}\odbc\bin\$CONFIGURATION" New-Item -Path $DRIVER_BIN_DIR -ItemType Directory -Force | Out-Null -Copy-Item $SDK_BUILD_DIR\bin\$CONFIGURATION\* $DRIVER_BIN_DIR -Copy-Item $DRIVER_BUILD_DIR\bin\$CONFIGURATION\* $DRIVER_BIN_DIR +Copy-Item $VCPKG_INSTALLED_DIR\bin\* $DRIVER_BIN_DIR if ($BITNESS -eq "32") { # Strip bitness from 32bit VLD DLL dir name $BITNESS = $null diff --git a/sql-odbc/src/CMakeLists.txt b/sql-odbc/src/CMakeLists.txt index 7e940ca63e..40a7aeff15 100644 --- a/sql-odbc/src/CMakeLists.txt +++ b/sql-odbc/src/CMakeLists.txt @@ -74,21 +74,17 @@ set(PERFORMANCE_TESTS "${CMAKE_CURRENT_SOURCE_DIR}/PerformanceTests") set(UT_HELPER "${UNIT_TESTS}/UTHelper") set(IT_HELPER "${INTEGRATION_TESTS}/ITODBCHelper") set(RABBIT_SRC ${LIBRARY_DIRECTORY}/rabbit/include) -set(RAPIDJSON_SRC ${LIBRARY_DIRECTORY}/rapidjson/include) set(VLD_SRC ${LIBRARY_DIRECTORY}/VisualLeakDetector/include) - +if(WIN32) + set(RAPIDJSON_SRC ${LIBRARY_DIRECTORY}/rapidjson/include) +endif () # Without this symbols will be exporting to Unix but not Windows set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) -# Set path for AWS SDK -set(aws-cpp-sdk-base "${CMAKE_CURRENT_SOURCE_DIR}/aws-sdk-cpp") -set(aws-cpp-sdk-core_DIR "${PROJECT_ROOT}/sdk-build${BITNESS}/AWSSDK/lib/cmake/aws-cpp-sdk-core") -set(aws-c-event-stream_DIR "${PROJECT_ROOT}/sdk-build${BITNESS}/AWSSDK/lib/aws-c-event-stream/cmake") -set(aws-c-common_DIR "${PROJECT_ROOT}/sdk-build${BITNESS}/AWSSDK/lib/aws-c-common/cmake") -set(aws-checksums_DIR "${PROJECT_ROOT}/sdk-build${BITNESS}/AWSSDK/lib/aws-checksums/cmake") - -if (WIN32) - find_package(AWSSDK REQUIRED core) +find_package(aws-cpp-sdk-core CONFIG REQUIRED) +if(APPLE) + find_package(ZLIB REQUIRED) + find_package(RapidJSON CONFIG REQUIRED) endif() # General compiler definitions @@ -134,18 +130,10 @@ endif() if(BUILD_WITH_TESTS) # GTest import - include(gtest/googletest.cmake) - fetch_googletest( - ${PROJECT_SOURCE_DIR}/gtest - ${PROJECT_BINARY_DIR}/googletest - ) enable_testing() endif() # Projects to build -if (APPLE) - add_subdirectory(${aws-cpp-sdk-base}) -endif() add_subdirectory(${OPENSEARCHODBC_SRC}) add_subdirectory(${OPENSEARCHENLIST_SRC}) add_subdirectory(${INSTALL_SRC}) diff --git a/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/CMakeLists.txt b/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/CMakeLists.txt index 760ae5d732..adf520e073 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/CMakeLists.txt +++ b/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/CMakeLists.txt @@ -12,6 +12,9 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(itodbc_aws_auth ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies -target_link_libraries(itodbc_aws_auth sqlodbc itodbc_helper ut_helper gtest_main aws-cpp-sdk-core) +target_link_libraries(itodbc_aws_auth sqlodbc itodbc_helper ut_helper GTest::gtest_main aws-cpp-sdk-core) target_compile_definitions(itodbc_aws_auth PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/IntegrationTests/ITODBCCatalog/CMakeLists.txt b/sql-odbc/src/IntegrationTests/ITODBCCatalog/CMakeLists.txt index 657f32bf6c..f27abdbcfd 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCCatalog/CMakeLists.txt +++ b/sql-odbc/src/IntegrationTests/ITODBCCatalog/CMakeLists.txt @@ -10,7 +10,10 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(itodbc_catalog ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies target_code_coverage(itodbc_catalog PUBLIC AUTO ALL) -target_link_libraries(itodbc_catalog sqlodbc itodbc_helper ut_helper gtest_main) +target_link_libraries(itodbc_catalog sqlodbc itodbc_helper ut_helper GTest::gtest_main) target_compile_definitions(itodbc_catalog PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp b/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp index c1f12c94f6..68c672a388 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp @@ -3,6 +3,7 @@ #include "pch.h" #include "unit_test_helper.h" #include "it_odbc_helper.h" +#include // clang-format on // General test constants and structures diff --git a/sql-odbc/src/IntegrationTests/ITODBCConnection/CMakeLists.txt b/sql-odbc/src/IntegrationTests/ITODBCConnection/CMakeLists.txt index d336a9b304..81a028b266 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCConnection/CMakeLists.txt +++ b/sql-odbc/src/IntegrationTests/ITODBCConnection/CMakeLists.txt @@ -10,7 +10,10 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(itodbc_connection ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies target_code_coverage(itodbc_connection PUBLIC AUTO ALL) -target_link_libraries(itodbc_connection sqlodbc itodbc_helper ut_helper gtest_main) +target_link_libraries(itodbc_connection sqlodbc itodbc_helper ut_helper GTest::gtest_main) target_compile_definitions(itodbc_connection PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/IntegrationTests/ITODBCDescriptors/CMakeLists.txt b/sql-odbc/src/IntegrationTests/ITODBCDescriptors/CMakeLists.txt index 37e6d116df..8e83be637b 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCDescriptors/CMakeLists.txt +++ b/sql-odbc/src/IntegrationTests/ITODBCDescriptors/CMakeLists.txt @@ -10,7 +10,10 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(itodbc_descriptors ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies target_code_coverage(itodbc_descriptors PUBLIC AUTO ALL) -target_link_libraries(itodbc_descriptors sqlodbc itodbc_helper ut_helper gtest_main) +target_link_libraries(itodbc_descriptors sqlodbc itodbc_helper ut_helper GTest::gtest_main) target_compile_definitions(itodbc_descriptors PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/IntegrationTests/ITODBCExecution/CMakeLists.txt b/sql-odbc/src/IntegrationTests/ITODBCExecution/CMakeLists.txt index 4fa5d5e187..0f3eeec15f 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCExecution/CMakeLists.txt +++ b/sql-odbc/src/IntegrationTests/ITODBCExecution/CMakeLists.txt @@ -10,6 +10,9 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(itodbc_execution ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies -target_link_libraries(itodbc_execution sqlodbc itodbc_helper ut_helper gtest_main) +target_link_libraries(itodbc_execution sqlodbc itodbc_helper ut_helper GTest::gtest_main) target_compile_definitions(itodbc_execution PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/IntegrationTests/ITODBCHelper/CMakeLists.txt b/sql-odbc/src/IntegrationTests/ITODBCHelper/CMakeLists.txt index 56f0bc2cd8..61c97e5df9 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCHelper/CMakeLists.txt +++ b/sql-odbc/src/IntegrationTests/ITODBCHelper/CMakeLists.txt @@ -12,6 +12,9 @@ include_directories( # Generate dll (SHARED) add_library(itodbc_helper SHARED ${SOURCE_FILES} ${HEADER_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies -target_link_libraries(itodbc_helper sqlodbc ut_helper gtest_main) +target_link_libraries(itodbc_helper sqlodbc ut_helper GTest::gtest_main) target_compile_definitions(itodbc_helper PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/IntegrationTests/ITODBCInfo/CMakeLists.txt b/sql-odbc/src/IntegrationTests/ITODBCInfo/CMakeLists.txt index 9b9698650f..833df41cb2 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCInfo/CMakeLists.txt +++ b/sql-odbc/src/IntegrationTests/ITODBCInfo/CMakeLists.txt @@ -10,7 +10,10 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(itodbc_info ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies target_code_coverage(itodbc_info PUBLIC AUTO ALL) -target_link_libraries(itodbc_info sqlodbc itodbc_helper ut_helper gtest_main) +target_link_libraries(itodbc_info sqlodbc itodbc_helper ut_helper GTest::gtest_main) target_compile_definitions(itodbc_info PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/IntegrationTests/ITODBCPagination/CMakeLists.txt b/sql-odbc/src/IntegrationTests/ITODBCPagination/CMakeLists.txt index 7adfd4d13f..ce452d5131 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCPagination/CMakeLists.txt +++ b/sql-odbc/src/IntegrationTests/ITODBCPagination/CMakeLists.txt @@ -10,7 +10,10 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(itodbc_pagination ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies target_code_coverage(itodbc_pagination PUBLIC AUTO ALL) -target_link_libraries(itodbc_pagination sqlodbc itodbc_helper ut_helper gtest_main) +target_link_libraries(itodbc_pagination sqlodbc itodbc_helper ut_helper GTest::gtest_main) target_compile_definitions(itodbc_pagination PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/IntegrationTests/ITODBCResults/CMakeLists.txt b/sql-odbc/src/IntegrationTests/ITODBCResults/CMakeLists.txt index 1107fbf4f9..9ea86199b4 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCResults/CMakeLists.txt +++ b/sql-odbc/src/IntegrationTests/ITODBCResults/CMakeLists.txt @@ -10,7 +10,10 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(itodbc_results ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies target_code_coverage(itodbc_results PUBLIC AUTO ALL) -target_link_libraries(itodbc_results sqlodbc itodbc_helper ut_helper gtest_main) +target_link_libraries(itodbc_results sqlodbc itodbc_helper ut_helper GTest::gtest_main) target_compile_definitions(itodbc_results PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/IntegrationTests/ITODBCTableauQueries/CMakeLists.txt b/sql-odbc/src/IntegrationTests/ITODBCTableauQueries/CMakeLists.txt index 74f8c6d509..e8c13d1770 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCTableauQueries/CMakeLists.txt +++ b/sql-odbc/src/IntegrationTests/ITODBCTableauQueries/CMakeLists.txt @@ -10,7 +10,10 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(itodbc_tableau_queries ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies target_code_coverage(itodbc_tableau_queries PUBLIC AUTO ALL) -target_link_libraries(itodbc_tableau_queries sqlodbc itodbc_helper ut_helper gtest_main) +target_link_libraries(itodbc_tableau_queries sqlodbc itodbc_helper ut_helper GTest::gtest_main) target_compile_definitions(itodbc_tableau_queries PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/PerformanceTests/PTODBCInfo/CMakeLists.txt b/sql-odbc/src/PerformanceTests/PTODBCInfo/CMakeLists.txt index 71550382ac..319dae7984 100644 --- a/sql-odbc/src/PerformanceTests/PTODBCInfo/CMakeLists.txt +++ b/sql-odbc/src/PerformanceTests/PTODBCInfo/CMakeLists.txt @@ -12,6 +12,9 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(performance_info ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies -target_link_libraries(performance_info sqlodbc itodbc_helper ut_helper gtest_main) +target_link_libraries(performance_info sqlodbc itodbc_helper ut_helper GTest::gtest_main) target_compile_definitions(performance_info PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/PerformanceTests/PTODBCResults/CMakeLists.txt b/sql-odbc/src/PerformanceTests/PTODBCResults/CMakeLists.txt index e04f6b736e..589e4eac72 100644 --- a/sql-odbc/src/PerformanceTests/PTODBCResults/CMakeLists.txt +++ b/sql-odbc/src/PerformanceTests/PTODBCResults/CMakeLists.txt @@ -10,6 +10,9 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(performance_results ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies -target_link_libraries(performance_results sqlodbc itodbc_helper ut_helper gtest_main) +target_link_libraries(performance_results sqlodbc itodbc_helper ut_helper GTest::gtest_main) target_compile_definitions(performance_results PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/PerformanceTests/PTODBCResults/performance_odbc_results.cpp b/sql-odbc/src/PerformanceTests/PTODBCResults/performance_odbc_results.cpp index ed116d0d11..95184f8907 100644 --- a/sql-odbc/src/PerformanceTests/PTODBCResults/performance_odbc_results.cpp +++ b/sql-odbc/src/PerformanceTests/PTODBCResults/performance_odbc_results.cpp @@ -3,6 +3,7 @@ #include "unit_test_helper.h" #include "it_odbc_helper.h" #include "chrono" +#include #include #include // clang-format on @@ -149,7 +150,6 @@ TEST_F(TestPerformance, Time_BindColumn_FetchSingleRow) { } TEST_F(TestPerformance, Time_BindColumn_Fetch5Rows) { - SQLROWSETSIZE row_count = 0; SQLSMALLINT total_columns = 0; SQLROWSETSIZE rows_fetched = 0; SQLUSMALLINT row_status[ROWSET_SIZE_5]; @@ -176,7 +176,6 @@ TEST_F(TestPerformance, Time_BindColumn_Fetch5Rows) { while (SQLExtendedFetch(m_hstmt, SQL_FETCH_NEXT, 0, &rows_fetched, row_status) == SQL_SUCCESS) { - row_count += rows_fetched; if (rows_fetched < ROWSET_SIZE_5) break; } @@ -190,7 +189,6 @@ TEST_F(TestPerformance, Time_BindColumn_Fetch5Rows) { } TEST_F(TestPerformance, Time_BindColumn_Fetch50Rows) { - SQLROWSETSIZE row_count = 0; SQLSMALLINT total_columns = 0; SQLROWSETSIZE rows_fetched = 0; SQLUSMALLINT row_status[ROWSET_SIZE_50]; @@ -217,7 +215,6 @@ TEST_F(TestPerformance, Time_BindColumn_Fetch50Rows) { while (SQLExtendedFetch(m_hstmt, SQL_FETCH_NEXT, 0, &rows_fetched, row_status) == SQL_SUCCESS) { - row_count += rows_fetched; if (rows_fetched < ROWSET_SIZE_50) break; } diff --git a/sql-odbc/src/UnitTests/UTAwsSdkCpp/CMakeLists.txt b/sql-odbc/src/UnitTests/UTAwsSdkCpp/CMakeLists.txt index 97d7df09fb..05f665aabf 100644 --- a/sql-odbc/src/UnitTests/UTAwsSdkCpp/CMakeLists.txt +++ b/sql-odbc/src/UnitTests/UTAwsSdkCpp/CMakeLists.txt @@ -9,6 +9,9 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(ut_aws_sdk_cpp ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies -target_link_libraries(ut_aws_sdk_cpp ut_helper gtest_main aws-cpp-sdk-core ${VLD}) +target_link_libraries(ut_aws_sdk_cpp ut_helper GTest::gtest_main aws-cpp-sdk-core ${VLD}) target_compile_definitions(ut_aws_sdk_cpp PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/UnitTests/UTConn/CMakeLists.txt b/sql-odbc/src/UnitTests/UTConn/CMakeLists.txt index 5d985af2cc..0e90d8f4d6 100644 --- a/sql-odbc/src/UnitTests/UTConn/CMakeLists.txt +++ b/sql-odbc/src/UnitTests/UTConn/CMakeLists.txt @@ -12,6 +12,9 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(ut_conn ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies -target_link_libraries(ut_conn sqlodbc ut_helper gtest_main) +target_link_libraries(ut_conn sqlodbc ut_helper GTest::gtest_main) target_compile_definitions(ut_conn PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/UnitTests/UTCriticalSection/CMakeLists.txt b/sql-odbc/src/UnitTests/UTCriticalSection/CMakeLists.txt index 43526f0ec1..e806ef9f4b 100644 --- a/sql-odbc/src/UnitTests/UTCriticalSection/CMakeLists.txt +++ b/sql-odbc/src/UnitTests/UTCriticalSection/CMakeLists.txt @@ -11,6 +11,9 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(ut_critical_section ${SOURCE_FILES}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies -target_link_libraries(ut_critical_section sqlodbc ut_helper gtest_main) +target_link_libraries(ut_critical_section sqlodbc ut_helper GTest::gtest_main) target_compile_definitions(ut_critical_section PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/UnitTests/UTHelper/CMakeLists.txt b/sql-odbc/src/UnitTests/UTHelper/CMakeLists.txt index f9764d31cb..1bfad42485 100644 --- a/sql-odbc/src/UnitTests/UTHelper/CMakeLists.txt +++ b/sql-odbc/src/UnitTests/UTHelper/CMakeLists.txt @@ -22,6 +22,9 @@ find_library( VLD target_link_libraries(ut_helper ${VLD}) endif() +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + # Library dependencies -target_link_libraries(ut_helper sqlodbc gtest_main) +target_link_libraries(ut_helper sqlodbc GTest::gtest_main) target_compile_definitions(ut_helper PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/UnitTests/UTRabbit/CMakeLists.txt b/sql-odbc/src/UnitTests/UTRabbit/CMakeLists.txt index a5fec96f5e..b5f638fe01 100644 --- a/sql-odbc/src/UnitTests/UTRabbit/CMakeLists.txt +++ b/sql-odbc/src/UnitTests/UTRabbit/CMakeLists.txt @@ -10,5 +10,8 @@ include_directories( ${UT_HELPER} # Generate executable add_executable(ut_rabbit ${SOURCE_FILES}) -target_link_libraries(ut_rabbit ut_helper gtest_main ${VLD}) +# Find packages from vcpkg +find_package(GTest CONFIG REQUIRED) + +target_link_libraries(ut_rabbit ut_helper GTest::gtest_main ${VLD}) target_compile_definitions(ut_rabbit PUBLIC _UNICODE UNICODE) diff --git a/sql-odbc/src/gtest/googletest-download.cmake b/sql-odbc/src/gtest/googletest-download.cmake deleted file mode 100644 index 0ec4d55866..0000000000 --- a/sql-odbc/src/gtest/googletest-download.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# code copied from https://crascit.com/2015/07/25/cmake-gtest/ -cmake_minimum_required(VERSION 3.5 FATAL_ERROR) - -project(googletest-download NONE) - -include(ExternalProject) - -ExternalProject_Add( - googletest - SOURCE_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-src" - BINARY_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-build" - GIT_REPOSITORY - https://github.com/google/googletest.git - GIT_TAG - release-1.10.0 - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - ) diff --git a/sql-odbc/src/gtest/googletest.cmake b/sql-odbc/src/gtest/googletest.cmake deleted file mode 100644 index 5ca7090877..0000000000 --- a/sql-odbc/src/gtest/googletest.cmake +++ /dev/null @@ -1,32 +0,0 @@ -# the following code to fetch googletest -# is inspired by and adapted after https://crascit.com/2015/07/25/cmake-gtest/ -# download and unpack googletest at configure time - -macro(fetch_googletest _download_module_path _download_root) - set(GOOGLETEST_DOWNLOAD_ROOT ${_download_root}) - configure_file( - ${_download_module_path}/googletest-download.cmake - ${_download_root}/CMakeLists.txt - @ONLY - ) - unset(GOOGLETEST_DOWNLOAD_ROOT) - - execute_process( - COMMAND - "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . - WORKING_DIRECTORY - ${_download_root} - ) - execute_process( - COMMAND - "${CMAKE_COMMAND}" --build . - WORKING_DIRECTORY - ${_download_root} - ) - - # adds the targers: gtest, gtest_main, gmock, gmock_main - add_subdirectory( - ${_download_root}/googletest-src - ${_download_root}/googletest-build - ) -endmacro() diff --git a/sql-odbc/src/installer/CMakeLists.txt b/sql-odbc/src/installer/CMakeLists.txt index 726b8f6e6d..d172b91ac0 100644 --- a/sql-odbc/src/installer/CMakeLists.txt +++ b/sql-odbc/src/installer/CMakeLists.txt @@ -90,21 +90,4 @@ install(FILES "${PROJECT_ROOT}/THIRD-PARTY" DESTINATION doc COMPONENT "Docs") # Install resource files install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/Resources/opensearch_sql_odbc.tdc" DESTINATION resources COMPONENT "Resources") -# Install AWS dependencies -if(WIN32) - set(AWS_SDK_BIN_DIR "${PROJECT_ROOT}/build/aws-sdk/install/bin") - install(DIRECTORY ${AWS_SDK_BIN_DIR} DESTINATION . COMPONENT "Driver") -endif() - -if(WIN32) - if(CMAKE_BUILD_TYPE STREQUAL "Debug") - # We actually never build the installer for Debug - install(FILES "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug/libcurl-d.dll" DESTINATION bin COMPONENT "Driver") - install(FILES "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug/zlibd1.dll" DESTINATION bin COMPONENT "Driver") - else() # release - install(FILES "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Release/libcurl.dll" DESTINATION bin COMPONENT "Driver") - install(FILES "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Release/zlib1.dll" DESTINATION bin COMPONENT "Driver") - endif() -endif() - include(CPack) diff --git a/sql-odbc/src/sqlodbc/info.c b/sql-odbc/src/sqlodbc/info.c index 6925f490ef..c40f783a55 100644 --- a/sql-odbc/src/sqlodbc/info.c +++ b/sql-odbc/src/sqlodbc/info.c @@ -33,7 +33,6 @@ RETCODE SQL_API OPENSEARCHAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, SQLSMALLINT *pcbInfoValue) { CSTR func = "OPENSEARCHAPI_GetInfo"; ConnectionClass *conn = (ConnectionClass *)hdbc; - ConnInfo *ci; const char *p = NULL; char tmp[MAX_INFO_STRING]; SQLULEN len = 0, value = 0; @@ -47,8 +46,6 @@ RETCODE SQL_API OPENSEARCHAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, return SQL_INVALID_HANDLE; } - ci = &(conn->connInfo); - switch (fInfoType) { case SQL_ACCESSIBLE_PROCEDURES: /* ODBC 1.0 */ p = "N"; diff --git a/sql-odbc/src/sqlodbc/odbcapiw.c b/sql-odbc/src/sqlodbc/odbcapiw.c index 6b22948f90..7577e0577c 100644 --- a/sql-odbc/src/sqlodbc/odbcapiw.c +++ b/sql-odbc/src/sqlodbc/odbcapiw.c @@ -19,17 +19,13 @@ RETCODE SQL_API SQLColumnsW(HSTMT StatementHandle, SQLWCHAR *CatalogName, char *ctName, *scName, *tbName, *clName; SQLLEN nmlen1, nmlen2, nmlen3, nmlen4; StatementClass *stmt = (StatementClass *)StatementHandle; - ConnectionClass *conn; BOOL lower_id; UWORD flag = PODBC_SEARCH_PUBLIC_SCHEMA; - ConnInfo *ci; MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; - conn = SC_get_conn(stmt); - ci = &(conn->connInfo); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(CatalogName, NameLength1, &nmlen1, lower_id); scName = ucs2_to_utf8(SchemaName, NameLength2, &nmlen2, lower_id); @@ -426,14 +422,12 @@ RETCODE SQL_API SQLSpecialColumnsW( char *ctName, *scName, *tbName; SQLLEN nmlen1, nmlen2, nmlen3; StatementClass *stmt = (StatementClass *)StatementHandle; - ConnectionClass *conn; BOOL lower_id; MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(CatalogName, NameLength1, &nmlen1, lower_id); scName = ucs2_to_utf8(SchemaName, NameLength2, &nmlen2, lower_id); @@ -467,14 +461,12 @@ RETCODE SQL_API SQLStatisticsW(HSTMT StatementHandle, SQLWCHAR *CatalogName, char *ctName, *scName, *tbName; SQLLEN nmlen1, nmlen2, nmlen3; StatementClass *stmt = (StatementClass *)StatementHandle; - ConnectionClass *conn; BOOL lower_id; MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(CatalogName, NameLength1, &nmlen1, lower_id); scName = ucs2_to_utf8(SchemaName, NameLength2, &nmlen2, lower_id); @@ -508,7 +500,6 @@ RETCODE SQL_API SQLTablesW(HSTMT StatementHandle, SQLWCHAR *CatalogName, char *ctName, *scName, *tbName, *tbType; SQLLEN nmlen1, nmlen2, nmlen3, nmlen4; StatementClass *stmt = (StatementClass *)StatementHandle; - ConnectionClass *conn; BOOL lower_id; UWORD flag = 0; @@ -516,7 +507,6 @@ RETCODE SQL_API SQLTablesW(HSTMT StatementHandle, SQLWCHAR *CatalogName, if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(CatalogName, NameLength1, &nmlen1, lower_id); scName = ucs2_to_utf8(SchemaName, NameLength2, &nmlen2, lower_id); @@ -554,7 +544,6 @@ RETCODE SQL_API SQLColumnPrivilegesW( char *ctName, *scName, *tbName, *clName; SQLLEN nmlen1, nmlen2, nmlen3, nmlen4; StatementClass *stmt = (StatementClass *)hstmt; - ConnectionClass *conn; BOOL lower_id; UWORD flag = 0; @@ -562,7 +551,6 @@ RETCODE SQL_API SQLColumnPrivilegesW( if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id); @@ -603,14 +591,12 @@ RETCODE SQL_API SQLForeignKeysW( char *ctName, *scName, *tbName, *fkctName, *fkscName, *fktbName; SQLLEN nmlen1, nmlen2, nmlen3, nmlen4, nmlen5, nmlen6; StatementClass *stmt = (StatementClass *)hstmt; - ConnectionClass *conn; BOOL lower_id; MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szPkCatalogName, cbPkCatalogName, &nmlen1, lower_id); scName = ucs2_to_utf8(szPkSchemaName, cbPkSchemaName, &nmlen2, lower_id); @@ -705,14 +691,12 @@ RETCODE SQL_API SQLPrimaryKeysW(HSTMT hstmt, SQLWCHAR *szCatalogName, char *ctName, *scName, *tbName; SQLLEN nmlen1, nmlen2, nmlen3; StatementClass *stmt = (StatementClass *)hstmt; - ConnectionClass *conn; BOOL lower_id; MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id); @@ -744,12 +728,10 @@ RETCODE SQL_API SQLProcedureColumnsW( char *ctName, *scName, *prName, *clName; SQLLEN nmlen1, nmlen2, nmlen3, nmlen4; StatementClass *stmt = (StatementClass *)hstmt; - ConnectionClass *conn; BOOL lower_id; UWORD flag = 0; MYLOG(OPENSEARCH_TRACE, "entering\n"); - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id); @@ -787,7 +769,6 @@ RETCODE SQL_API SQLProceduresW(HSTMT hstmt, SQLWCHAR *szCatalogName, char *ctName, *scName, *prName; SQLLEN nmlen1, nmlen2, nmlen3; StatementClass *stmt = (StatementClass *)hstmt; - ConnectionClass *conn; BOOL lower_id; UWORD flag = 0; @@ -795,7 +776,6 @@ RETCODE SQL_API SQLProceduresW(HSTMT hstmt, SQLWCHAR *szCatalogName, if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id); @@ -831,7 +811,6 @@ RETCODE SQL_API SQLTablePrivilegesW(HSTMT hstmt, SQLWCHAR *szCatalogName, char *ctName, *scName, *tbName; SQLLEN nmlen1, nmlen2, nmlen3; StatementClass *stmt = (StatementClass *)hstmt; - ConnectionClass *conn; BOOL lower_id; UWORD flag = 0; @@ -839,7 +818,6 @@ RETCODE SQL_API SQLTablePrivilegesW(HSTMT hstmt, SQLWCHAR *szCatalogName, if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id); diff --git a/sql-odbc/src/sqlodbc/opensearch_communication.cpp b/sql-odbc/src/sqlodbc/opensearch_communication.cpp index f521f0687f..9fa1421970 100644 --- a/sql-odbc/src/sqlodbc/opensearch_communication.cpp +++ b/sql-odbc/src/sqlodbc/opensearch_communication.cpp @@ -396,7 +396,7 @@ OpenSearchCommunication::IssueRequest( // Set header type if (!content_type.empty()) - request->SetHeaderValue(Aws::Http::CONTENT_TYPE_HEADER, ctype); + request->SetHeaderValue(Aws::Http::CONTENT_TYPE_HEADER, Aws::String(ctype.c_str(), ctype.size())); // Set body if (!query.empty() || !cursor.empty()) { @@ -412,7 +412,7 @@ OpenSearchCommunication::IssueRequest( Aws::MakeShared< Aws::StringStream >("RabbitStream"); *aws_ss << std::string(body.str()); request->AddContentBody(aws_ss); - request->SetContentLength(std::to_string(body.str().size())); + request->SetContentLength(Aws::Utils::StringUtils::to_string(body.str().size())); } // Handle authentication @@ -422,7 +422,7 @@ OpenSearchCommunication::IssueRequest( Aws::Utils::Array< unsigned char > userpw_arr( reinterpret_cast< const unsigned char* >(userpw_str.c_str()), userpw_str.length()); - std::string hashed_userpw = + Aws::String hashed_userpw = Aws::Utils::HashingUtils::Base64Encode(userpw_arr); request->SetAuthorization("Basic " + hashed_userpw); } else if (m_rt_opts.auth.auth_type == AUTHTYPE_IAM) { diff --git a/sql-odbc/src/sqlodbc/options.c b/sql-odbc/src/sqlodbc/options.c index 243b9385ae..fd100c0ea7 100644 --- a/sql-odbc/src/sqlodbc/options.c +++ b/sql-odbc/src/sqlodbc/options.c @@ -13,13 +13,8 @@ static RETCODE set_statement_option(ConnectionClass *conn, StatementClass *stmt, SQLUSMALLINT fOption, SQLULEN vParam) { CSTR func = "set_statement_option"; char changed = FALSE; - ConnInfo *ci = NULL; SQLULEN setval; - if (conn) - ci = &(conn->connInfo); - else - ci = &(SC_get_conn(stmt)->connInfo); switch (fOption) { case SQL_ASYNC_ENABLE: /* ignored */ break; diff --git a/sql-odbc/src/sqlodbc/results.c b/sql-odbc/src/sqlodbc/results.c index 7420062382..18f1cd1a72 100644 --- a/sql-odbc/src/sqlodbc/results.c +++ b/sql-odbc/src/sqlodbc/results.c @@ -111,7 +111,6 @@ RETCODE SQL_API OPENSEARCHAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, SQLLEN column_size = 0; int unknown_sizes; SQLINTEGER decimal_digits = 0; - ConnInfo *ci; FIELD_INFO *fi; char buf[255]; int len = 0; @@ -125,7 +124,6 @@ RETCODE SQL_API OPENSEARCHAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, } conn = SC_get_conn(stmt); - ci = &(conn->connInfo); unknown_sizes = DEFAULT_UNKNOWNSIZES; SC_clear_error(stmt); @@ -321,7 +319,6 @@ RETCODE SQL_API OPENSEARCHAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, OID field_type = 0; Int2 col_idx; ConnectionClass *conn; - ConnInfo *ci; int column_size, unknown_sizes; int cols = 0; RETCODE result; @@ -349,7 +346,6 @@ RETCODE SQL_API OPENSEARCHAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, *pcbDesc = 0; irdflds = SC_get_IRDF(stmt); conn = SC_get_conn(stmt); - ci = &(conn->connInfo); /* * Dont check for bookmark column. This is the responsibility of the @@ -415,8 +411,6 @@ RETCODE SQL_API OPENSEARCHAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, if (FI_is_applicable(fi)) field_type = getEffectiveOid(conn, fi); else { - BOOL build_fi = FALSE; - fi = NULL; switch (fDescType) { case SQL_COLUMN_OWNER_NAME: @@ -429,7 +423,6 @@ RETCODE SQL_API OPENSEARCHAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, case SQL_DESC_BASE_COLUMN_NAME: case SQL_COLUMN_UPDATABLE: case 1212: /* SQL_CA_SS_COLUMN_KEY ? */ - build_fi = TRUE; break; } diff --git a/sql-odbc/src/sqlodbc/unicode_support.h b/sql-odbc/src/sqlodbc/unicode_support.h index 2a481b0c06..e2b2a63521 100644 --- a/sql-odbc/src/sqlodbc/unicode_support.h +++ b/sql-odbc/src/sqlodbc/unicode_support.h @@ -20,7 +20,6 @@ SQLLEN bindcol_hybrid_exec(SQLWCHAR *utf16, const char *ldt, size_t n, SQLLEN bindcol_localize_estimate(const char *utf8dt, BOOL lf_conv, char **wcsbuf); SQLLEN bindcol_localize_exec(char *ldt, size_t n, BOOL lf_conv, char **wcsbuf); -SQLLEN bindpara_msg_to_utf8(const char *ldt, char **wcsbuf, SQLLEN used); SQLLEN bindpara_wchar_to_msg(const SQLWCHAR *utf16, char **wcsbuf, SQLLEN used); SQLLEN locale_to_sqlwchar(SQLWCHAR *utf16, const char *ldt, size_t n, diff --git a/sql-odbc/src/sqlodbc/win_unicode.c b/sql-odbc/src/sqlodbc/win_unicode.c index 5bc03b64fd..706e86e53c 100644 --- a/sql-odbc/src/sqlodbc/win_unicode.c +++ b/sql-odbc/src/sqlodbc/win_unicode.c @@ -841,63 +841,6 @@ static SQLLEN c16tombs(char *c8dt, const char16_t *c16dt, size_t n) { } #endif /* __CHAR16_UTF_16__ */ -// -// SQLBindParameter SQL_C_CHAR to UTF-8 case -// the current locale => UTF-8 -// -SQLLEN bindpara_msg_to_utf8(const char *ldt, char **wcsbuf, SQLLEN used) { - SQLLEN l = (-2); - char *utf8 = NULL, *ldt_nts, *alloc_nts = NULL, ntsbuf[128]; - int count; - - if (SQL_NTS == used) { - count = (int)strlen(ldt); - ldt_nts = (char *)ldt; - } else if (used < 0) { - return -1; - } else { - count = (int)used; - if (used < (SQLLEN)sizeof(ntsbuf)) - ldt_nts = ntsbuf; - else { - if (NULL == (alloc_nts = malloc(used + 1))) - return l; - ldt_nts = alloc_nts; - } - memcpy(ldt_nts, ldt, used); - ldt_nts[used] = '\0'; - } - - get_convtype(); - MYLOG(OPENSEARCH_DEBUG, " \n"); -#if defined(__WCS_ISO10646__) - if (use_wcs) { - wchar_t *wcsdt = (wchar_t *)malloc((count + 1) * sizeof(wchar_t)); - - if ((l = msgtowstr(ldt_nts, (wchar_t *)wcsdt, count + 1)) >= 0) - utf8 = wcs_to_utf8(wcsdt, -1, &l, FALSE); - free(wcsdt); - } -#endif /* __WCS_ISO10646__ */ -#ifdef __CHAR16_UTF_16__ - if (use_c16) { - SQLWCHAR *utf16 = (SQLWCHAR *)malloc((count + 1) * sizeof(SQLWCHAR)); - - if ((l = mbstoc16_lf((char16_t *)utf16, ldt_nts, count + 1, FALSE)) - >= 0) - utf8 = ucs2_to_utf8(utf16, -1, &l, FALSE); - free(utf16); - } -#endif /* __CHAR16_UTF_16__ */ - if (l < 0 && NULL != utf8) - free(utf8); - else - *wcsbuf = (char *)utf8; - - if (NULL != alloc_nts) - free(alloc_nts); - return l; -} // // SQLBindParameter hybrid case diff --git a/sql-odbc/src/vcpkg.json b/sql-odbc/src/vcpkg.json new file mode 100644 index 0000000000..a5903fbb85 --- /dev/null +++ b/sql-odbc/src/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "sql-odbc", + "version-string": "1.1.0.1", + "dependencies": ["aws-sdk-cpp", "rapidjson", "zlib", "gtest", "curl"], + "builtin-baseline": "6ca56aeb457f033d344a7106cb3f9f1abf8f4e98", + "overrides": [ + { "name": "aws-sdk-cpp", "version": "1.8.83#2" }, + { "name": "rapidjson", "version": "2022-06-28#1" }, + { "name": "zlib", "version": "1.2.12#1" }, + { "name": "gtest", "version": "1.11.0" } + ] +}