From 762209ba292b4cbfff5e49c340fae1ab23236704 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 13:54:44 -0700 Subject: [PATCH 01/58] [1] Fixing linux compiler errors. --- tools/ODBCcli/CMakeLists.txt | 2 +- tools/ODBCcli/client.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/ODBCcli/CMakeLists.txt b/tools/ODBCcli/CMakeLists.txt index af4a2c35d..3f31f15b4 100644 --- a/tools/ODBCcli/CMakeLists.txt +++ b/tools/ODBCcli/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.16) project(ODBCcli) set(CMAKE_CXX_STANDARD 17) diff --git a/tools/ODBCcli/client.cpp b/tools/ODBCcli/client.cpp index d8e76db9f..420c2651c 100644 --- a/tools/ODBCcli/client.cpp +++ b/tools/ODBCcli/client.cpp @@ -1,5 +1,7 @@ #include "client.h" +#include #include +#include "sqlext.h" Client::Client(const char *connection_string) : henv(SQL_NULL_HENV), hdbc(SQL_NULL_HDBC), From 1323ae5f84102118c0cdba0a52af7ff3d48160b9 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 14:03:10 -0700 Subject: [PATCH 02/58] [1] Enabling DSN tests From 1b92687595601ffbf1ed769fac2e1326d44532e1 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 14:30:39 -0700 Subject: [PATCH 03/58] [1] Adding some prints to dlg_specific.c --- src/odfesqlodbc/dlg_specific.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/odfesqlodbc/dlg_specific.c b/src/odfesqlodbc/dlg_specific.c index b039ee813..eb17e0425 100644 --- a/src/odfesqlodbc/dlg_specific.c +++ b/src/odfesqlodbc/dlg_specific.c @@ -365,12 +365,15 @@ void getDSNinfo(ConnInfo *ci, const char *configDrvrname) { while (*(DSN + strlen(DSN) - 1) == ' ') *(DSN + strlen(DSN) - 1) = '\0'; + printf("DSN: %s\n", DSN); if (!drivername[0] && DSN[0]) getDriverNameFromDSN(DSN, (char *)drivername, sizeof(ci->drivername)); MYLOG(LOG_DEBUG, "drivername=%s\n", drivername); if (!drivername[0]) drivername = INVALID_DRIVER; + printf("Driver name1: %s\n", drivername); getDriversDefaults(drivername, &(ci->drivers)); + printf("Driver name2: %s\n", drivername); if (DSN[0] == '\0') return; From 29f09f4a3df69a4ba19ab6744bcb32f3086462a3 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 14:36:24 -0700 Subject: [PATCH 04/58] [1] Minor fix for dsn. --- src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini b/src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini index ee9ce99e2..c52d63f1d 100644 --- a/src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini +++ b/src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini @@ -1,6 +1,6 @@ [ODBC Drivers] timestream = Installed -[timestream] +[timestream-iam] Driver = /usr/lib/odfe-sql-odbc/bin/libodfesqlodbc.so Setup = /usr/lib/odfe-sql-odbc/bin/libodfesqlodbc.so From 4856ed198b859fa446da2aae64547c4c0ed504b1 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 14:50:24 -0700 Subject: [PATCH 05/58] [1] Trying a different dsn fix. --- src/IntegrationTests/ITODBCConnection/odbc-linux.ini | 8 ++++---- src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/IntegrationTests/ITODBCConnection/odbc-linux.ini b/src/IntegrationTests/ITODBCConnection/odbc-linux.ini index 136490829..62bd44ea9 100644 --- a/src/IntegrationTests/ITODBCConnection/odbc-linux.ini +++ b/src/IntegrationTests/ITODBCConnection/odbc-linux.ini @@ -1,16 +1,16 @@ [ODBC Data Sources] -timestream-iam = timestream -timestream-aws-profile = timestream +timestream-iam = timestreamodbc +timestream-aws-profile = timestreamodbc [timestream-iam] -Driver = /usr/lib/odfe-sql-odbc/bin/libodfesqlodbc.so +Driver = timestreamodbc Region = us-east-1 LogOutput = /home/runner/work/timestream-odbc/timestream-odbc/odbc-logs/ LogLevel = 7 Auth = IAM [timestream-aws-profile] -Driver = /usr/lib/odfe-sql-odbc/bin/libodfesqlodbc.so +Driver = timestreamodbc Region = us-east-1 LogOutput = /home/runner/work/timestream-odbc/timestream-odbc/odbc-logs/ LogLevel = 7 diff --git a/src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini b/src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini index c52d63f1d..e6552bde0 100644 --- a/src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini +++ b/src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini @@ -1,6 +1,6 @@ [ODBC Drivers] -timestream = Installed +timestreamodbc = Installed -[timestream-iam] +[timestreamodbc] Driver = /usr/lib/odfe-sql-odbc/bin/libodfesqlodbc.so -Setup = /usr/lib/odfe-sql-odbc/bin/libodfesqlodbc.so +Setup = /usr/lib/odfe-sql-odbc/bin/libodfesqlodbc.so \ No newline at end of file From 38769133174fc280cdd55525ad97bcd212e74b43 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 15:07:57 -0700 Subject: [PATCH 06/58] [1] Adding some debug printouts --- .github/workflows/linux-build.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 8cddd33cc..81c3f31cc 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -39,17 +39,29 @@ jobs: - name: prepare-dsn run: | # TODO: This is broken, needs to be fixed + echo "ls /home/runner" + ls /home/runner + echo "cat /home/runner/odbc.ini" + cat /home/runner/odbc.ini + echo "cat /home/runner/odbcinst.ini" + cat /home/runner/odbcinst.ini sudo mv ./src/IntegrationTests/ITODBCConnection/odbc-linux.ini /home/runner/odbc.ini sudo mv ./src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini /home/runner/odbcinst.ini - mkdir ${{ github.workspace }}/odbc-logs + mkdir /home/runner/work/timestream-odbc/timestream-odbc/odbc-logs export ODBCSYSINI=/home/runner export ODBCINSTINI=odbcinst.ini export ODBCINI=/home/runner/odbc.ini + echo "printenv ODBCSYSINI ODBCINSTINI ODBCINI" printenv ODBCSYSINI ODBCINSTINI ODBCINI + echo "odbcinst -q -d" odbcinst -q -d + echo "odbcinst -q -s" odbcinst -q -s + echo "odbcinst -j" odbcinst -j + echo "cat /home/runner/odbc.ini" cat /home/runner/odbc.ini + echo "cat /home/runner/odbcinst.ini" cat /home/runner/odbcinst.ini - name: configure-and-build-driver run: | From accba22ee996f407b7291bd204acfc766899a7d8 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 15:12:37 -0700 Subject: [PATCH 07/58] [1] Fixing build script. --- .github/workflows/linux-build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 81c3f31cc..eea6708cc 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -41,10 +41,6 @@ jobs: # TODO: This is broken, needs to be fixed echo "ls /home/runner" ls /home/runner - echo "cat /home/runner/odbc.ini" - cat /home/runner/odbc.ini - echo "cat /home/runner/odbcinst.ini" - cat /home/runner/odbcinst.ini sudo mv ./src/IntegrationTests/ITODBCConnection/odbc-linux.ini /home/runner/odbc.ini sudo mv ./src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini /home/runner/odbcinst.ini mkdir /home/runner/work/timestream-odbc/timestream-odbc/odbc-logs From 1544f1067fc09f7bb5c4141852a089250f137a9b Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 15:29:45 -0700 Subject: [PATCH 08/58] [1] DSN Debugging --- .github/workflows/linux-build.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index eea6708cc..801c4050e 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -39,25 +39,31 @@ jobs: - name: prepare-dsn run: | # TODO: This is broken, needs to be fixed - echo "ls /home/runner" + echo "!!!!!!!!!ls /home/runner" ls /home/runner + echo "!!!!!!!!!ls /home/runners" + ls /home/runners + echo "!!!!!!!!!ls /etc/odbc" + ls /etc/odbc + echo "!!!!!!!!!ls ~/.odbc" + ls ~/.odbc sudo mv ./src/IntegrationTests/ITODBCConnection/odbc-linux.ini /home/runner/odbc.ini sudo mv ./src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini /home/runner/odbcinst.ini mkdir /home/runner/work/timestream-odbc/timestream-odbc/odbc-logs export ODBCSYSINI=/home/runner export ODBCINSTINI=odbcinst.ini export ODBCINI=/home/runner/odbc.ini - echo "printenv ODBCSYSINI ODBCINSTINI ODBCINI" + echo "!!!!!!!!!printenv ODBCSYSINI ODBCINSTINI ODBCINI" printenv ODBCSYSINI ODBCINSTINI ODBCINI - echo "odbcinst -q -d" + echo "!!!!!!!!!odbcinst -q -d" odbcinst -q -d - echo "odbcinst -q -s" + echo "!!!!!!!!!odbcinst -q -s" odbcinst -q -s - echo "odbcinst -j" + echo "!!!!!!!!!odbcinst -j" odbcinst -j - echo "cat /home/runner/odbc.ini" + echo "!!!!!!!!!cat /home/runner/odbc.ini" cat /home/runner/odbc.ini - echo "cat /home/runner/odbcinst.ini" + echo "!!!!!!!!!cat /home/runner/odbcinst.ini" cat /home/runner/odbcinst.ini - name: configure-and-build-driver run: | From 9008088ce41d44e14cb78847b1d163dd3b5ebbdf Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 15:31:51 -0700 Subject: [PATCH 09/58] [1] ls fix. --- .github/workflows/linux-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 801c4050e..adcb57cad 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -41,8 +41,8 @@ jobs: # TODO: This is broken, needs to be fixed echo "!!!!!!!!!ls /home/runner" ls /home/runner - echo "!!!!!!!!!ls /home/runners" - ls /home/runners + echo "!!!!!!!!!ls /home/runner/runners" + ls /home/runner/runners echo "!!!!!!!!!ls /etc/odbc" ls /etc/odbc echo "!!!!!!!!!ls ~/.odbc" From 1a12fb4e90720aa4a0dabca5f1d6797d18058ce8 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 15:34:36 -0700 Subject: [PATCH 10/58] [1] More command fixes. --- .github/workflows/linux-build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index adcb57cad..69a9e7e20 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -43,10 +43,10 @@ jobs: ls /home/runner echo "!!!!!!!!!ls /home/runner/runners" ls /home/runner/runners - echo "!!!!!!!!!ls /etc/odbc" - ls /etc/odbc - echo "!!!!!!!!!ls ~/.odbc" - ls ~/.odbc + echo "!!!!!!!!!ls /etc/" + ls /etc/ + echo "!!!!!!!!!ls -a ~/" + ls -a ~/ sudo mv ./src/IntegrationTests/ITODBCConnection/odbc-linux.ini /home/runner/odbc.ini sudo mv ./src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini /home/runner/odbcinst.ini mkdir /home/runner/work/timestream-odbc/timestream-odbc/odbc-logs From b29d78f52c3b73541d8a23cb7e26b56b1f87d9a5 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 15:41:01 -0700 Subject: [PATCH 11/58] [1] Trying etc based build. --- .github/workflows/linux-build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 69a9e7e20..c161d765b 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -47,12 +47,12 @@ jobs: ls /etc/ echo "!!!!!!!!!ls -a ~/" ls -a ~/ - sudo mv ./src/IntegrationTests/ITODBCConnection/odbc-linux.ini /home/runner/odbc.ini - sudo mv ./src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini /home/runner/odbcinst.ini + sudo mv ./src/IntegrationTests/ITODBCConnection/odbc-linux.ini /etc/odbc.ini + sudo mv ./src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini /etc/odbcinst.ini mkdir /home/runner/work/timestream-odbc/timestream-odbc/odbc-logs - export ODBCSYSINI=/home/runner + export ODBCSYSINI=/etc/ export ODBCINSTINI=odbcinst.ini - export ODBCINI=/home/runner/odbc.ini + export ODBCINI=/etc/odbc.ini echo "!!!!!!!!!printenv ODBCSYSINI ODBCINSTINI ODBCINI" printenv ODBCSYSINI ODBCINSTINI ODBCINI echo "!!!!!!!!!odbcinst -q -d" @@ -61,9 +61,9 @@ jobs: odbcinst -q -s echo "!!!!!!!!!odbcinst -j" odbcinst -j - echo "!!!!!!!!!cat /home/runner/odbc.ini" + echo "!!!!!!!!!cat /etc/odbc.ini" cat /home/runner/odbc.ini - echo "!!!!!!!!!cat /home/runner/odbcinst.ini" + echo "!!!!!!!!!cat /etc/odbcinst.ini" cat /home/runner/odbcinst.ini - name: configure-and-build-driver run: | From 3fac6594aa709089d0def51b8deb8598b23a1d62 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 15:44:20 -0700 Subject: [PATCH 12/58] [1] Fixing cat print. --- .github/workflows/linux-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index c161d765b..aa04dc21e 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -62,9 +62,9 @@ jobs: echo "!!!!!!!!!odbcinst -j" odbcinst -j echo "!!!!!!!!!cat /etc/odbc.ini" - cat /home/runner/odbc.ini + cat /etc/odbc.ini echo "!!!!!!!!!cat /etc/odbcinst.ini" - cat /home/runner/odbcinst.ini + cat /etc/odbcinst.ini - name: configure-and-build-driver run: | ./build_linux_release64_rpm.sh From a8b5eac7b8162b4471ba8cce6cc0e57098651c01 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 18:35:16 -0700 Subject: [PATCH 13/58] [1] Minor updqtes yml to tryt to debug. --- .github/workflows/linux-build.yml | 38 +++++++++++++++++++++---------- src/odfesqlodbc/odbcapi.c | 1 - 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index aa04dc21e..bf4a04d69 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -119,20 +119,30 @@ jobs: - name: build-installer-rpm if: always() run: | + mkdir rpm-installer + ./build_linux_release64_rpm.sh cd cmake-build64 cmake ../src - make + make -j4 cpack . + cp -v ./*.rpm rpm-installer + ls cd .. + echo "cd .." + ls - name: build-installer-deb if: always() run: | + mkdir deb-installer ./build_linux_release64_deb.sh cd cmake-build64 cmake ../src - make + make -j4 cpack . - cd .. + cp ./*.deb deb-installer + ls + echo "cd .." + ls - name: create-output if: success() run: | @@ -142,8 +152,6 @@ jobs: mkdir deb-installer cp ./build/odbc/lib/*.so build-output/ cp ./build/odbc/lib/*.a build-output/ - cp ./cmake-build64/*.rpm rpm-installer/ - cp ./cmake-build64/*.deb deb-installer/ - name: upload-build if: success() uses: actions/upload-artifact@v2 @@ -251,31 +259,37 @@ jobs: - name: build-installer-rpm if: always() run: | + mkdir rpm-installer + ./build_linux_release32_rpm.sh cd cmake-build32 cmake ../src - make + make -j4 cpack . + cp -v ./*.rpm rpm-installer + ls cd .. + echo "cd .." + ls - name: build-installer-deb if: always() run: | + mkdir deb-installer ./build_linux_release32_deb.sh cd cmake-build32 cmake ../src - make + make -j4 cpack . - cd .. + cp ./*.deb deb-installer + ls + echo "cd .." + ls - name: create-output if: success() run: | mkdir build-output mkdir test-output - mkdir rpm-installer - mkdir deb-installer cp ./build/odbc/lib/*.so build-output/ cp ./build/odbc/lib/*.a build-output/ - cp ./cmake-build32/*.rpm rpm-installer/ - cp ./cmake-build32/*.deb deb-installer/ - name: upload-build if: success() uses: actions/upload-artifact@v2 diff --git a/src/odfesqlodbc/odbcapi.c b/src/odfesqlodbc/odbcapi.c index 1d076ba98..7ab958cd3 100644 --- a/src/odfesqlodbc/odbcapi.c +++ b/src/odfesqlodbc/odbcapi.c @@ -189,7 +189,6 @@ RETCODE SQL_API SQLDriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *szConnStrIn, MYLOG(LOG_TRACE, "entering\n"); ENTER_CONN_CS(conn); CC_clear_error(conn); - printf("ESAPI_DriverConnect\n"); ret = ESAPI_DriverConnect(hdbc, hwnd, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut, fDriverCompletion); From 1432028b38b235c8e5c8c17bc74f66de0c6bd2ed Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 18:36:42 -0700 Subject: [PATCH 14/58] [1] Removing mkdir --- .github/workflows/linux-build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index bf4a04d69..0b7facb5f 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -148,8 +148,6 @@ jobs: run: | mkdir build-output mkdir test-output - mkdir rpm-installer - mkdir deb-installer cp ./build/odbc/lib/*.so build-output/ cp ./build/odbc/lib/*.a build-output/ - name: upload-build From e2a658650e6e5b336a82382c9cb024bfee6dfeab Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 18:38:05 -0700 Subject: [PATCH 15/58] [1] Fixing 32-bit dsn. --- .github/workflows/linux-build.yml | 38 ++++--------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 0b7facb5f..d3e499ac8 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -38,33 +38,12 @@ jobs: sudo apt install libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev linux-headers-$(uname -r) gcc gcc-multilib g++ g++-multilib cmake linux-headers-$(uname -r) build-essential valgrind - name: prepare-dsn run: | - # TODO: This is broken, needs to be fixed - echo "!!!!!!!!!ls /home/runner" - ls /home/runner - echo "!!!!!!!!!ls /home/runner/runners" - ls /home/runner/runners - echo "!!!!!!!!!ls /etc/" - ls /etc/ - echo "!!!!!!!!!ls -a ~/" - ls -a ~/ sudo mv ./src/IntegrationTests/ITODBCConnection/odbc-linux.ini /etc/odbc.ini sudo mv ./src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini /etc/odbcinst.ini mkdir /home/runner/work/timestream-odbc/timestream-odbc/odbc-logs export ODBCSYSINI=/etc/ export ODBCINSTINI=odbcinst.ini export ODBCINI=/etc/odbc.ini - echo "!!!!!!!!!printenv ODBCSYSINI ODBCINSTINI ODBCINI" - printenv ODBCSYSINI ODBCINSTINI ODBCINI - echo "!!!!!!!!!odbcinst -q -d" - odbcinst -q -d - echo "!!!!!!!!!odbcinst -q -s" - odbcinst -q -s - echo "!!!!!!!!!odbcinst -j" - odbcinst -j - echo "!!!!!!!!!cat /etc/odbc.ini" - cat /etc/odbc.ini - echo "!!!!!!!!!cat /etc/odbcinst.ini" - cat /etc/odbcinst.ini - name: configure-and-build-driver run: | ./build_linux_release64_rpm.sh @@ -190,19 +169,12 @@ jobs: sudo apt install unixodbc-dev:i386 odbcinst1debian2:i386 libodbc1:i386 libcurl4-openssl-dev:i386 libssl-dev:i386 uuid-dev:i386 cpp:i386 cpp-9:i386 gcc:i386 g++:i386 zlib1g-dev:i386 linux-headers-$(uname -r) gcc-multilib:i386 g++-multilib:i386 cmake g++-9:i386 gcc-9:i386 gcc-9-multilib:i386 g++-9-multilib:i386 binutils:i386 make:i386 - name: prepare-dsn run: | - # TODO: This is broken, needs to be - sudo mv ./src/IntegrationTests/ITODBCConnection/odbc-linux.ini /home/runner/odbc.ini - sudo mv ./src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini /home/runner/odbcinst.ini - mkdir ${{ github.workspace }}/odbc-logs - export ODBCSYSINI=/home/runner + sudo mv ./src/IntegrationTests/ITODBCConnection/odbc-linux.ini /etc/odbc.ini + sudo mv ./src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini /etc/odbcinst.ini + mkdir /home/runner/work/timestream-odbc/timestream-odbc/odbc-logs + export ODBCSYSINI=/etc/ export ODBCINSTINI=odbcinst.ini - export ODBCINI=/home/runner/odbc.ini - printenv ODBCSYSINI ODBCINSTINI ODBCINI - odbcinst -q -d - odbcinst -q -s - odbcinst -j - cat /home/runner/odbc.ini - cat /home/runner/odbcinst.ini + export ODBCINI=/etc/odbc.ini - name: configure-aws-credentials uses: aws-actions/configure-aws-credentials@v1 with: From 3e77fa58cbc7630301a8f9f8aac2ae8102d8c6cd Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 18:49:28 -0700 Subject: [PATCH 16/58] [1] Fixing build script and trying to adjust misc.h --- .github/workflows/linux-build.yml | 53 ++++++++++++++++++------------- .github/workflows/mac-build.yml | 3 -- src/odfesqlodbc/misc.h | 50 ++++------------------------- 3 files changed, 37 insertions(+), 69 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index d3e499ac8..e2acc15cb 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -33,10 +33,12 @@ jobs: name: cppcheck-results path: cppcheck-results.log - name: get-dependencies + if: success() run: | sudo apt update sudo apt install libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev linux-headers-$(uname -r) gcc gcc-multilib g++ g++-multilib cmake linux-headers-$(uname -r) build-essential valgrind - name: prepare-dsn + if: success() run: | sudo mv ./src/IntegrationTests/ITODBCConnection/odbc-linux.ini /etc/odbc.ini sudo mv ./src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini /etc/odbcinst.ini @@ -48,40 +50,42 @@ jobs: run: | ./build_linux_release64_rpm.sh - name: configure-aws-credentials + if: success() uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: run-connection-unit-test + if: success() run: | ./build/odbc/bin/ut_conn - name: run-integration-connection-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_connection - name: run-integration-execution-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_execution - name: run-integration-results-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_results - name: run-integration-descriptors-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_descriptors - name: run-integration-catalog-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_catalog - name: run-integration-info-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_info - name: run-integration-pagination-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_pagination - name: prepare-test-results @@ -96,11 +100,11 @@ jobs: path: | ${{ github.workspace }}/odbc-logs/ - name: build-installer-rpm - if: always() + if: success() run: | - mkdir rpm-installer ./build_linux_release64_rpm.sh cd cmake-build64 + mkdir rpm-installer cmake ../src make -j4 cpack . @@ -110,11 +114,11 @@ jobs: echo "cd .." ls - name: build-installer-deb - if: always() + if: success() run: | - mkdir deb-installer ./build_linux_release64_deb.sh cd cmake-build64 + mkdir deb-installer cmake ../src make -j4 cpack . @@ -162,12 +166,14 @@ jobs: name: cppcheck-results path: cppcheck-results.log - name: get-dependencies + if: success() run: | # Need to install i386 versions sudo dpkg --add-architecture i386 sudo apt update sudo apt install unixodbc-dev:i386 odbcinst1debian2:i386 libodbc1:i386 libcurl4-openssl-dev:i386 libssl-dev:i386 uuid-dev:i386 cpp:i386 cpp-9:i386 gcc:i386 g++:i386 zlib1g-dev:i386 linux-headers-$(uname -r) gcc-multilib:i386 g++-multilib:i386 cmake g++-9:i386 gcc-9:i386 gcc-9-multilib:i386 g++-9-multilib:i386 binutils:i386 make:i386 - name: prepare-dsn + if: success() run: | sudo mv ./src/IntegrationTests/ITODBCConnection/odbc-linux.ini /etc/odbc.ini sudo mv ./src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini /etc/odbcinst.ini @@ -176,43 +182,46 @@ jobs: export ODBCINSTINI=odbcinst.ini export ODBCINI=/etc/odbc.ini - name: configure-aws-credentials + if: success() uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: configure-and-build-driver + if: success() run: | ./build_linux_release32_rpm.sh - name: run-connection-unit-test + if: success() run: | ./build/odbc/bin/ut_conn - name: run-integration-connection-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_connection - name: run-integration-execution-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_execution - name: run-integration-results-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_results - name: run-integration-descriptors-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_descriptors - name: run-integration-catalog-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_catalog - name: run-integration-info-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_info - name: run-integration-pagination-tests - if: always() + if: success() run: | ./build/odbc/bin/itodbc_pagination - name: prepare-test-results @@ -227,11 +236,11 @@ jobs: path: | ${{ github.workspace }}/odbc-logs/ - name: build-installer-rpm - if: always() + if: success() run: | - mkdir rpm-installer ./build_linux_release32_rpm.sh cd cmake-build32 + mkdir rpm-installer cmake ../src make -j4 cpack . @@ -241,11 +250,11 @@ jobs: echo "cd .." ls - name: build-installer-deb - if: always() + if: success() run: | - mkdir deb-installer ./build_linux_release32_deb.sh cd cmake-build32 + mkdir deb-installer cmake ../src make -j4 cpack . diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index 19bf732d0..037a86014 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -106,9 +106,6 @@ jobs: cp ./build/odbc/lib/*.dylib build-output/ cp ./build/odbc/lib/*.a build-output/ cp ./cmake-build64/*.pkg installer/ - # cp $(ls -d ./build/odbc/bin/* | grep -v "\.") build-output - # cp ./bin64/*.html test-output - # cp ./bin64/*.log test-output - name: upload-build if: success() uses: actions/upload-artifact@v2 diff --git a/src/odfesqlodbc/misc.h b/src/odfesqlodbc/misc.h index d1a0e8e40..2f0a63f3d 100644 --- a/src/odfesqlodbc/misc.h +++ b/src/odfesqlodbc/misc.h @@ -52,57 +52,19 @@ ssize_t my_strcpy(char *dst, ssize_t dst_len, const char *src, ssize_t src_len); * */ -/* - * With GCC, the macro CHECK_NOT_CHAR_P() causes a compilation error - * when the target is pointer not a fixed array. - */ - -#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 -#define FUNCTION_BEGIN_MACRO ({ -#define FUNCTION_END_MACRO \ - ; \ - }) -#define CHECK_NOT_CHAR_P(t) \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \ - if (0) { \ - typeof(t) dummy_for_check = {}; \ - } \ - _Pragma("GCC diagnostic pop") -#else -#define FUNCTION_BEGIN_MACRO -#define FUNCTION_END_MACRO -#define CHECK_NOT_CHAR_P(t) -#endif - /* macro to safely strcpy() to fixed arrays. */ -#define STRCPY_FIXED(to, from) \ - FUNCTION_BEGIN_MACRO \ - CHECK_NOT_CHAR_P(to) \ - strncpy_null((to), (from), sizeof(to)) FUNCTION_END_MACRO +#define STRCPY_FIXED(to, from) strncpy_null((to), (from), sizeof(to)) /* macro to safely strcat() to fixed arrays. */ -#define STRCAT_FIXED(to, from) \ - FUNCTION_BEGIN_MACRO \ - CHECK_NOT_CHAR_P(to) \ - strlcat((to), (from), sizeof(to)) FUNCTION_END_MACRO +#define STRCAT_FIXED(to, from) strlcat((to), (from), sizeof(to)) /* macro to safely sprintf() to fixed arrays. */ -#define SPRINTF_FIXED(to, ...) \ - FUNCTION_BEGIN_MACRO \ - CHECK_NOT_CHAR_P(to) \ - snprintf((to), sizeof(to), __VA_ARGS__) FUNCTION_END_MACRO +#define SPRINTF_FIXED(to, ...) snprintf((to), sizeof(to), __VA_ARGS__) /* macro to safely sprintf() & cat to fixed arrays. */ -#define SPRINTFCAT_FIXED(to, ...) \ - FUNCTION_BEGIN_MACRO \ - CHECK_NOT_CHAR_P(to) \ - snprintfcat((to), sizeof(to), __VA_ARGS__) FUNCTION_END_MACRO - -#define ITOA_FIXED(to, from) \ - FUNCTION_BEGIN_MACRO \ - CHECK_NOT_CHAR_P(to) \ - snprintf((to), sizeof(to), "%d", from) FUNCTION_END_MACRO +#define SPRINTFCAT_FIXED(to, ...) snprintfcat((to), sizeof(to), __VA_ARGS__) + +#define ITOA_FIXED(to, from) snprintf((to), sizeof(to), "%d", from) #ifdef __cplusplus } From 2f691d72b5bbe111d9967a50600ef8fda8334190 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 19:06:09 -0700 Subject: [PATCH 17/58] [1] Fixed a bunch of warnings. [2] adjusted output of installer. --- .github/workflows/linux-build.yml | 30 ++++--------- .../ITODBCAwsAuth/test_odbc_aws_auth.cpp | 6 +-- .../ITODBCCatalog/test_odbc_catalog.cpp | 5 +++ src/odfesqlodbc/api30.c | 15 ++++++- src/odfesqlodbc/bind.h | 12 ++--- src/odfesqlodbc/convert.c | 44 ------------------- src/odfesqlodbc/dlg_specific.c | 33 -------------- src/odfesqlodbc/odbcapiw.c | 20 --------- src/odfesqlodbc/results.c | 9 +++- 9 files changed, 43 insertions(+), 131 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index e2acc15cb..bf76687a5 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -102,30 +102,23 @@ jobs: - name: build-installer-rpm if: success() run: | + mkdir rpm-installer ./build_linux_release64_rpm.sh cd cmake-build64 - mkdir rpm-installer cmake ../src make -j4 cpack . - cp -v ./*.rpm rpm-installer - ls - cd .. - echo "cd .." - ls + cp -v ./*.rpm ../rpm-installer - name: build-installer-deb if: success() run: | + mkdir deb-installer ./build_linux_release64_deb.sh cd cmake-build64 - mkdir deb-installer cmake ../src make -j4 cpack . - cp ./*.deb deb-installer - ls - echo "cd .." - ls + cp -v ./*.deb ../deb-installer - name: create-output if: success() run: | @@ -238,30 +231,23 @@ jobs: - name: build-installer-rpm if: success() run: | + mkdir rpm-installer ./build_linux_release32_rpm.sh cd cmake-build32 - mkdir rpm-installer cmake ../src make -j4 cpack . - cp -v ./*.rpm rpm-installer - ls - cd .. - echo "cd .." - ls + cp -v ./*.rpm ../rpm-installer - name: build-installer-deb if: success() run: | + mkdir deb-installer ./build_linux_release32_deb.sh cd cmake-build32 - mkdir deb-installer cmake ../src make -j4 cpack . - cp ./*.deb deb-installer - ls - echo "cd .." - ls + cp -v ./*.deb ../deb-installer - name: create-output if: success() run: | diff --git a/src/IntegrationTests/ITODBCAwsAuth/test_odbc_aws_auth.cpp b/src/IntegrationTests/ITODBCAwsAuth/test_odbc_aws_auth.cpp index 5f6055022..7600da230 100644 --- a/src/IntegrationTests/ITODBCAwsAuth/test_odbc_aws_auth.cpp +++ b/src/IntegrationTests/ITODBCAwsAuth/test_odbc_aws_auth.cpp @@ -25,19 +25,19 @@ test_string aws_auth_conn_string = test_string(CREATE_STRING("Host=https://")) + test_string(CREATE_STRING("search-bit-quill-cx3hpfoxvasohujxkllmgjwqde.us-west-2.")) + test_string(CREATE_STRING("es.amazonaws.com;")) + - test_string(CREATE_STRING("Auth=IAM;Region=us-west-2;LogLevel=1")); + test_string(CREATE_STRING("Auth=IAM;Region=us-west-2;LogLevel=3")); test_string aws_auth_conn_string_invalid_region = test_string(CREATE_STRING("Driver={Elasticsearch};DataBase=database_name;")) + test_string(CREATE_STRING("Host=https://")) + test_string(CREATE_STRING("search-bit-quill-cx3hpfoxvasohujxkllmgjwqde.us-west-2.")) + test_string(CREATE_STRING("es.amazonaws.com;")) + - test_string(CREATE_STRING("Auth=IAM;Region=us-west-3;LogLevel=1")); + test_string(CREATE_STRING("Auth=IAM;Region=us-west-3;LogLevel=3")); test_string aws_auth_conn_string_invalid_authtype = test_string(CREATE_STRING("Driver={Elasticsearch};DataBase=database_name;")) + test_string(CREATE_STRING("Host=https://")) + test_string(CREATE_STRING("search-bit-quill-cx3hpfoxvasohujxkllmgjwqde.us-west-2.")) + test_string(CREATE_STRING("es.amazonaws.com;")) + - test_string(CREATE_STRING("Auth=AWS;Region=us-west-2;LogLevel=1")); + test_string(CREATE_STRING("Auth=AWS;Region=us-west-2;LogLevel=3")); class TestAwsAuthConnection : public testing::Test { public: diff --git a/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp b/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp index 9f1486af2..7c46d5d28 100644 --- a/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp +++ b/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp @@ -108,6 +108,8 @@ class TestSQLGetTypeInfo : public Fixture {}; // SQLHSTMT m_hstmt = SQL_NULL_HSTMT; //}; +#ifdef __linux +#pragma GCC diagnostic ignored "-Wcomment" //#define TEST_SQL_KEYS(test_name, test_function, ...) \ // TEST_F(TestSQLCatalogKeys, test_name) { \ // EXPECT_TRUE(SQL_SUCCEEDED(test_function(m_hstmt, __VA_ARGS__))); \ @@ -118,6 +120,9 @@ class TestSQLGetTypeInfo : public Fixture {}; // EXPECT_EQ(ret, SQL_NO_DATA); \ // EXPECT_EQ(result_count, static_cast< size_t >(0)); \ // } +#ifdef __linux__ +#pragma GCC diagnostic pop +#endif // __linux__ /** * SQLTables Tests diff --git a/src/odfesqlodbc/api30.c b/src/odfesqlodbc/api30.c index 76364821c..e5abc6546 100644 --- a/src/odfesqlodbc/api30.c +++ b/src/odfesqlodbc/api30.c @@ -775,6 +775,10 @@ static RETCODE SQL_API IPDSetField(DescriptorClass *desc, SQLSMALLINT RecNumber, IPDFields *ipdopts = &(desc->ipdf); SQLSMALLINT para_idx; +#ifdef __linux__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough=" +#endif // __linux__ switch (FieldIdentifier) { case SQL_DESC_ARRAY_STATUS_PTR: ipdopts->param_status_ptr = (SQLUSMALLINT *)Value; @@ -800,6 +804,9 @@ static RETCODE SQL_API IPDSetField(DescriptorClass *desc, SQLSMALLINT RecNumber, parameter_ibindings_set(ipdopts, RecNumber, TRUE); break; } +#ifdef __linux__ +#pragma GCC diagnostic pop +#endif // __linux__ if (RecNumber <= 0 || RecNumber > ipdopts->allocated) { MYLOG(LOG_ALL, "RecN=%d allocated=%d\n", RecNumber, ipdopts->allocated); DC_set_error(desc, DESC_BAD_PARAMETER_NUMBER_ERROR, @@ -1763,7 +1770,6 @@ RETCODE SQL_API ESAPI_SetDescField(SQLHDESC DescriptorHandle, desc, "can't SQLSetDescField for this parameter number"); break; - break; } } DC_log_error(func, "", desc); @@ -1782,6 +1788,10 @@ RETCODE SQL_API ESAPI_SetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, MYLOG(LOG_TRACE, "entering Handle=%p " FORMAT_INTEGER "," FORMAT_ULEN "(%p)\n", StatementHandle, Attribute, (SQLULEN)Value, Value); +#ifdef __linux__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough=" +#endif // __linux__ switch (Attribute) { case SQL_ATTR_ENABLE_AUTO_IPD: /* 15 */ if (SQL_FALSE == Value) @@ -1862,5 +1872,8 @@ RETCODE SQL_API ESAPI_SetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, return ESAPI_SetStmtOption(StatementHandle, (SQLUSMALLINT)Attribute, (SQLULEN)Value); } +#ifdef __linux__ +#pragma GCC diagnostic pop +#endif // __linux__ return ret; } diff --git a/src/odfesqlodbc/bind.h b/src/odfesqlodbc/bind.h index ce111473a..d56f9ed2a 100644 --- a/src/odfesqlodbc/bind.h +++ b/src/odfesqlodbc/bind.h @@ -106,12 +106,12 @@ typedef struct { #define EXEC_PARAM_CAST TRUE #define SIMPLE_PARAM_CAST TRUE -#define CALC_BOOKMARK_ADDR(book, offset, bind_size, index) \ - (book->buffer + offset \ - + (bind_size > 0 \ - ? bind_size \ - : (SQL_C_VARBOOKMARK == book->returntype ? book->buflen \ - : sizeof(UInt4))) \ +#define CALC_BOOKMARK_ADDR(book, offset, bind_size, index) \ + (book->buffer + offset \ + + (bind_size > 0 \ + ? bind_size \ + : (SQL_C_VARBOOKMARK == book->returntype ? book->buflen \ + : ((SQLLEN)sizeof(UInt4)))) \ * index) /* Macros to handle estype of parameters */ diff --git a/src/odfesqlodbc/convert.c b/src/odfesqlodbc/convert.c index be7495087..880b21858 100644 --- a/src/odfesqlodbc/convert.c +++ b/src/odfesqlodbc/convert.c @@ -68,7 +68,6 @@ typedef struct { int fr; } SIMPLE_TIME; -static BOOL convert_money(const char *s, char *sout, size_t soutmax); size_t convert_linefeeds(const char *s, char *dst, size_t max, BOOL convlf, BOOL *changed); static size_t convert_from_esbinary(const char *value, char *rgbValue, @@ -2361,49 +2360,6 @@ static void parse_to_numeric_struct(const char *wv, SQL_NUMERIC_STRUCT *ns, } } -static BOOL convert_money(const char *s, char *sout, size_t soutmax) { - char in, decp = 0; - size_t i = 0, out = 0; - int num_in = -1, period_in = -1, comma_in = -1; - - for (i = 0; s[i]; i++) { - switch (in = s[i]) { - case '.': - if (period_in < 0) - period_in = (int)i; - break; - case ',': - if (comma_in < 0) - comma_in = (int)i; - break; - default: - if ('0' <= in && '9' >= in) - num_in = (int)i; - break; - } - } - if (period_in > comma_in) { - if (period_in >= num_in - 2) - decp = '.'; - } else if (comma_in >= 0 && comma_in >= num_in - 2) - decp = ','; - for (i = 0; s[i] && out + 1 < soutmax; i++) { - switch (in = s[i]) { - case '(': - case '-': - sout[out++] = '-'; - break; - default: - if (in >= '0' && in <= '9') - sout[out++] = in; - else if (in == decp) - sout[out++] = '.'; - } - } - sout[out] = '\0'; - return TRUE; -} - /* Change linefeed to carriage-return/linefeed */ size_t convert_linefeeds(const char *si, char *dst, size_t max, BOOL convlf, BOOL *changed) { diff --git a/src/odfesqlodbc/dlg_specific.c b/src/odfesqlodbc/dlg_specific.c index eb17e0425..0e949752b 100644 --- a/src/odfesqlodbc/dlg_specific.c +++ b/src/odfesqlodbc/dlg_specific.c @@ -23,8 +23,6 @@ #define NULL_IF_NULL(a) ((a) ? ((const char *)(a)) : "(null)") -static esNAME remove_braces(const char *in); - #define OVR_EXTRA_BITS \ (BIT_FORCEABBREVCONNSTR | BIT_FAKE_MSS | BIT_BDE_ENVIRONMENT \ | BIT_CVT_NULL_DATE | BIT_ACCESSIBLE_ONLY | BIT_IGNORE_ROUND_TRIP_TIME \ @@ -552,37 +550,6 @@ void writeDSNinfo(const ConnInfo *ci) { ODBC_INI); } -/* - * Remove braces if the input value is enclosed by braces({}). - */ -static esNAME remove_braces(const char *in) { - esNAME out; - INIT_NAME(out); - if (OPENING_BRACKET == in[0]) { - size_t inlen = strlen(in); - if (CLOSING_BRACKET == in[inlen - 1]) /* enclosed with braces */ - { - int i; - const char *istr, *eptr; - char *ostr; - - if (NULL == (ostr = (char *)malloc(inlen))) - return out; - eptr = in + inlen - 1; - for (istr = in + 1, i = 0; *istr && istr < eptr; i++) { - if (CLOSING_BRACKET == istr[0] && CLOSING_BRACKET == istr[1]) - istr++; - ostr[i] = *(istr++); - } - ostr[i] = '\0'; - SET_NAME_DIRECTLY(out, ostr); - return out; - } - } - STR_TO_NAME(out, in); - return out; -} - void CC_conninfo_release(ConnInfo *conninfo) { NULL_THE_NAME(conninfo->pwd); finalize_globals(&conninfo->drivers); diff --git a/src/odfesqlodbc/odbcapiw.c b/src/odfesqlodbc/odbcapiw.c index 33888d15d..5accb9470 100644 --- a/src/odfesqlodbc/odbcapiw.c +++ b/src/odfesqlodbc/odbcapiw.c @@ -38,14 +38,12 @@ RETCODE SQL_API SQLColumnsW(HSTMT StatementHandle, SQLWCHAR *CatalogName, ConnectionClass *conn; BOOL lower_id; UWORD flag = PODBC_SEARCH_PUBLIC_SCHEMA; - ConnInfo *ci; MYLOG(LOG_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __func__)) return SQL_ERROR; conn = SC_get_conn(stmt); - ci = &(conn->connInfo); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(CatalogName, NameLength1, &nmlen1, lower_id, TRUE); scName = ucs2_to_utf8(SchemaName, NameLength2, &nmlen2, lower_id, TRUE); @@ -448,14 +446,12 @@ RETCODE SQL_API SQLSpecialColumnsW( char *ctName, *scName, *tbName; SQLLEN nmlen1, nmlen2, nmlen3; StatementClass *stmt = (StatementClass *)StatementHandle; - ConnectionClass *conn; BOOL lower_id; MYLOG(LOG_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __func__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(CatalogName, NameLength1, &nmlen1, lower_id, TRUE); scName = ucs2_to_utf8(SchemaName, NameLength2, &nmlen2, lower_id, TRUE); @@ -489,14 +485,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(LOG_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __func__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(CatalogName, NameLength1, &nmlen1, lower_id, TRUE); scName = ucs2_to_utf8(SchemaName, NameLength2, &nmlen2, lower_id, TRUE); @@ -530,7 +524,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; @@ -538,7 +531,6 @@ RETCODE SQL_API SQLTablesW(HSTMT StatementHandle, SQLWCHAR *CatalogName, if (SC_connection_lost_check(stmt, __func__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(CatalogName, NameLength1, &nmlen1, lower_id, TRUE); scName = ucs2_to_utf8(SchemaName, NameLength2, &nmlen2, lower_id, TRUE); @@ -576,7 +568,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; @@ -584,7 +575,6 @@ RETCODE SQL_API SQLColumnPrivilegesW( if (SC_connection_lost_check(stmt, __func__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id, TRUE); @@ -626,14 +616,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(LOG_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __func__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szPkCatalogName, cbPkCatalogName, &nmlen1, lower_id, TRUE); scName = ucs2_to_utf8(szPkSchemaName, cbPkSchemaName, &nmlen2, lower_id, TRUE); @@ -728,14 +716,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(LOG_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __func__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id, TRUE); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id, TRUE); @@ -767,12 +753,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(LOG_TRACE, "entering\n"); - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id, TRUE); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id, TRUE); @@ -810,7 +794,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; @@ -818,7 +801,6 @@ RETCODE SQL_API SQLProceduresW(HSTMT hstmt, SQLWCHAR *szCatalogName, if (SC_connection_lost_check(stmt, __func__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id, TRUE); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id, TRUE); @@ -854,7 +836,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; @@ -862,7 +843,6 @@ RETCODE SQL_API SQLTablePrivilegesW(HSTMT hstmt, SQLWCHAR *szCatalogName, if (SC_connection_lost_check(stmt, __func__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id, TRUE); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id, TRUE); diff --git a/src/odfesqlodbc/results.c b/src/odfesqlodbc/results.c index 007605e6f..d554ba964 100644 --- a/src/odfesqlodbc/results.c +++ b/src/odfesqlodbc/results.c @@ -333,7 +333,6 @@ RETCODE SQL_API API_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; @@ -361,7 +360,6 @@ RETCODE SQL_API API_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 @@ -477,6 +475,10 @@ RETCODE SQL_API API_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, (USE_FI(fi, unknown_sizes) && fi->column_size > 0) ? fi->column_size : estype_column_size(stmt, field_type, col_idx, unknown_sizes); +#ifdef __linux__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough=" +#endif // __linux__ switch (fDescType) { case SQL_COLUMN_AUTO_INCREMENT: /* == SQL_DESC_AUTO_UNIQUE_VALUE */ if (fi && fi->auto_increment) @@ -715,6 +717,9 @@ RETCODE SQL_API API_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, func); return SQL_ERROR; } +#ifdef __linux__ +#pragma GCC diagnostic pop +#endif // __linux__ result = SQL_SUCCESS; From e1ef5fbd53bb7cfb12804b269188bbfbd12012d3 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 19:18:23 -0700 Subject: [PATCH 18/58] [1] Fixed a bunch more warnings and build error. --- .../ITODBCCatalog/test_odbc_catalog.cpp | 3 +- src/odfesqlodbc/dlg_specific.c | 8 ++++ src/odfesqlodbc/odbc_communication.cpp | 2 +- src/odfesqlodbc/odbcapi30w.c | 2 +- src/odfesqlodbc/odbcapiw.c | 2 - src/odfesqlodbc/options.c | 7 +-- src/odfesqlodbc/types.c | 48 ------------------- 7 files changed, 13 insertions(+), 59 deletions(-) diff --git a/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp b/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp index 7c46d5d28..db45708e4 100644 --- a/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp +++ b/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp @@ -108,8 +108,9 @@ class TestSQLGetTypeInfo : public Fixture {}; // SQLHSTMT m_hstmt = SQL_NULL_HSTMT; //}; -#ifdef __linux +#ifdef __linux__ #pragma GCC diagnostic ignored "-Wcomment" +#endif //#define TEST_SQL_KEYS(test_name, test_function, ...) \ // TEST_F(TestSQLCatalogKeys, test_name) { \ // EXPECT_TRUE(SQL_SUCCEEDED(test_function(m_hstmt, __VA_ARGS__))); \ diff --git a/src/odfesqlodbc/dlg_specific.c b/src/odfesqlodbc/dlg_specific.c index 0e949752b..9bfa14d24 100644 --- a/src/odfesqlodbc/dlg_specific.c +++ b/src/odfesqlodbc/dlg_specific.c @@ -377,6 +377,10 @@ void getDSNinfo(ConnInfo *ci, const char *configDrvrname) { return; /* Proceed with getting info for the given DSN. */ +#ifdef __linux +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress" +#endif if (SQLGetPrivateProfileString(DSN, INI_AUTH_MODE, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0) @@ -488,6 +492,10 @@ void getDSNinfo(ConnInfo *ci, const char *configDrvrname) { STRCPY_FIXED(ci->idp_arn, temp); STR_TO_NAME(ci->drivers.drivername, drivername); + +#ifdef __linux +#pragma GCC diagnostic pop +#endif } /* * This function writes any global parameters (that can be manipulated) diff --git a/src/odfesqlodbc/odbc_communication.cpp b/src/odfesqlodbc/odbc_communication.cpp index 229321cba..8a6c40b1a 100644 --- a/src/odfesqlodbc/odbc_communication.cpp +++ b/src/odfesqlodbc/odbc_communication.cpp @@ -91,7 +91,7 @@ namespace { {AUTHTYPE_AAD, aad}, {AUTHTYPE_OKTA, okta}, }; -}; +} bool TSCommunication::Validate(const runtime_options& options) { if (options.auth.region.empty() && options.auth.end_point_override.empty()) { diff --git a/src/odfesqlodbc/odbcapi30w.c b/src/odfesqlodbc/odbcapi30w.c index 70e3e5f84..c6cc04297 100644 --- a/src/odfesqlodbc/odbcapi30w.c +++ b/src/odfesqlodbc/odbcapi30w.c @@ -105,7 +105,7 @@ RETCODE SQL_API SQLSetDescFieldW(SQLHDESC DescriptorHandle, case SQL_DESC_TYPE_NAME: uval = ucs2_to_utf8( Value, - BufferLength > 0 ? BufferLength / WCLEN : BufferLength, + BufferLength > 0 ? BufferLength / ((SQLINTEGER)WCLEN) : BufferLength, &vallen, FALSE, TRUE); val_alloced = TRUE; break; diff --git a/src/odfesqlodbc/odbcapiw.c b/src/odfesqlodbc/odbcapiw.c index 5accb9470..d491a36e1 100644 --- a/src/odfesqlodbc/odbcapiw.c +++ b/src/odfesqlodbc/odbcapiw.c @@ -35,7 +35,6 @@ 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; @@ -43,7 +42,6 @@ RETCODE SQL_API SQLColumnsW(HSTMT StatementHandle, SQLWCHAR *CatalogName, if (SC_connection_lost_check(stmt, __func__)) return SQL_ERROR; - conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(CatalogName, NameLength1, &nmlen1, lower_id, TRUE); scName = ucs2_to_utf8(SchemaName, NameLength2, &nmlen2, lower_id, TRUE); diff --git a/src/odfesqlodbc/options.c b/src/odfesqlodbc/options.c index 9136bab7f..636b8f301 100644 --- a/src/odfesqlodbc/options.c +++ b/src/odfesqlodbc/options.c @@ -29,13 +29,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/src/odfesqlodbc/types.c b/src/odfesqlodbc/types.c index b8e9509c5..6966e69f1 100644 --- a/src/odfesqlodbc/types.c +++ b/src/odfesqlodbc/types.c @@ -144,54 +144,6 @@ static Int4 getCharColumnSizeX(const ConnectionClass *conn, OID type, */ #define UNUSED_HANDLE_UNKNOWN_SIZE_AS (-2) -static SQLSMALLINT getNumericDecimalDigitsX(const ConnectionClass *conn, - OID type, int atttypmod, - int adtsize_or_longest, - int handle_unknown_size_as) { - UNUSED(conn, handle_unknown_size_as); - SQLSMALLINT default_decimal_digits = 6; - - MYLOG(LOG_TRACE, "entering type=%d, atttypmod=%d\n", type, atttypmod); - - if (atttypmod < 0 && adtsize_or_longest < 0) - return default_decimal_digits; - - if (atttypmod > -1) - return (SQLSMALLINT)(atttypmod & 0xffff); - if (adtsize_or_longest <= 0) - return default_decimal_digits; - adtsize_or_longest >>= 16; /* extract the scale part */ - return (SQLSMALLINT)adtsize_or_longest; -} - -static Int4 -getNumericColumnSizeX(const ConnectionClass *conn, OID type, int atttypmod, - int adtsize_or_longest, int handle_unknown_size_as) { - UNUSED(conn); - Int4 default_column_size = 28; - MYLOG(LOG_TRACE, "entering type=%d, typmod=%d\n", type, atttypmod); - - if (atttypmod > -1) - return (atttypmod >> 16) & 0xffff; - switch (handle_unknown_size_as) { - case UNKNOWNS_AS_DONTKNOW: - return SQL_NO_TOTAL; - } - if (adtsize_or_longest <= 0) - return default_column_size; - adtsize_or_longest %= (1 << 16); /* extract the precision part */ - switch (handle_unknown_size_as) { - case UNKNOWNS_AS_MAX: - return adtsize_or_longest > default_column_size - ? adtsize_or_longest - : default_column_size; - default: - if (adtsize_or_longest < 10) - adtsize_or_longest = 10; - } - return adtsize_or_longest; -} - static SQLSMALLINT getTimestampDecimalDigitsX(const ConnectionClass *conn, OID type, int atttypmod) { UNUSED(conn); From 5da6ef7b19ca585e0d7becebd781cfc0ab0605a8 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 19:27:11 -0700 Subject: [PATCH 19/58] [1] More warning fixes and also enable Werror --- src/CMakeLists.txt | 5 +- .../ITODBCCatalog/test_odbc_catalog.cpp | 28 ++-- .../ITODBCInfo/test_odbc_info.cpp | 136 +++++++++--------- .../ITODBCResults/test_odbc_results.cpp | 26 ++-- src/odfesqlodbc/mylog.c | 2 +- 5 files changed, 97 insertions(+), 100 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 821feadbb..11c9512ce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,11 +43,12 @@ endif() # Set BUILD_WITH_TESTS to OFF before building installer package for size optimization. option(BUILD_WITH_TESTS "Enable testing" ON) +# Do not under any circumstance reduce or remove the compiler warning flags. +# These are our (best) friends. if(MSVC) add_compile_options(/W4 /WX) else() - # TODO: add -Werror once all warnings are resolved. - add_compile_options(-Wall -Wextra -pedantic) + add_compile_options(-Wall -Wextra -pedantic -Werror) endif() # Base directories diff --git a/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp b/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp index db45708e4..2117142a9 100644 --- a/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp +++ b/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp @@ -108,22 +108,18 @@ class TestSQLGetTypeInfo : public Fixture {}; // SQLHSTMT m_hstmt = SQL_NULL_HSTMT; //}; -#ifdef __linux__ -#pragma GCC diagnostic ignored "-Wcomment" -#endif -//#define TEST_SQL_KEYS(test_name, test_function, ...) \ -// TEST_F(TestSQLCatalogKeys, test_name) { \ -// EXPECT_TRUE(SQL_SUCCEEDED(test_function(m_hstmt, __VA_ARGS__))); \ -// size_t result_count = 0; \ -// SQLRETURN ret; \ -// while ((ret = SQLFetch(m_hstmt)) == SQL_SUCCESS) \ -// result_count++; \ -// EXPECT_EQ(ret, SQL_NO_DATA); \ -// EXPECT_EQ(result_count, static_cast< size_t >(0)); \ -// } -#ifdef __linux__ -#pragma GCC diagnostic pop -#endif // __linux__ +/* +#define TEST_SQL_KEYS(test_name, test_function, ...) \ + TEST_F(TestSQLCatalogKeys, test_name) { \ + EXPECT_TRUE(SQL_SUCCEEDED(test_function(m_hstmt, __VA_ARGS__))); \ + size_t result_count = 0; \ + SQLRETURN ret; \ + while ((ret = SQLFetch(m_hstmt)) == SQL_SUCCESS) \ + result_count++; \ + EXPECT_EQ(ret, SQL_NO_DATA); \ + EXPECT_EQ(result_count, static_cast< size_t >(0)); \ + } +*/ /** * SQLTables Tests diff --git a/src/IntegrationTests/ITODBCInfo/test_odbc_info.cpp b/src/IntegrationTests/ITODBCInfo/test_odbc_info.cpp index d4e15d23a..3dcaaa8df 100644 --- a/src/IntegrationTests/ITODBCInfo/test_odbc_info.cpp +++ b/src/IntegrationTests/ITODBCInfo/test_odbc_info.cpp @@ -147,116 +147,116 @@ int Ver1GEVer2(test_string ver_1_str, test_string ver_2_str) { ///////////////// #if defined(WIN32) -TEST_SQL_GET_INFO_STRING(SQLDriverName, SQL_DRIVER_NAME, CREATE_STRING("odfesqlodbc.dll")); +TEST_SQL_GET_INFO_STRING(SQLDriverName, SQL_DRIVER_NAME, CREATE_STRING("odfesqlodbc.dll")) #elif defined(__APPLE__) -TEST_SQL_GET_INFO_STRING(SQLDriverName, SQL_DRIVER_NAME, CREATE_STRING("libodfesqlodbc.dylib")); +TEST_SQL_GET_INFO_STRING(SQLDriverName, SQL_DRIVER_NAME, CREATE_STRING("libodfesqlodbc.dylib")) #endif -TEST_SQL_GET_INFO_STRING(SQLDriverODBCVer, SQL_DRIVER_ODBC_VER, CREATE_STRING("03.51")); +TEST_SQL_GET_INFO_STRING(SQLDriverODBCVer, SQL_DRIVER_ODBC_VER, CREATE_STRING("03.51")) test_string version = CREATE_STRING("") TIMESTREAMDRIVERVERSION; -TEST_SQL_GET_INFO_STRING(SQLDriverVer, SQL_DRIVER_VER, version); +TEST_SQL_GET_INFO_STRING(SQLDriverVer, SQL_DRIVER_VER, version) TEST_SQL_GET_INFO_UINT_MASK(SQLGetDataExtensions, SQL_GETDATA_EXTENSIONS, (SQL_GD_ANY_COLUMN | SQL_GD_ANY_ORDER | SQL_GD_BOUND - | SQL_GD_BLOCK)); + | SQL_GD_BLOCK)) TEST_SQL_GET_INFO_STRING(SQLSearchPatternEscape, SQL_SEARCH_PATTERN_ESCAPE, - CREATE_STRING("")); + CREATE_STRING("")) ////////////////////// // Data Source Info // ////////////////////// TEST_SQL_GET_INFO_UINT16(SQLCursorCommitBehavior, SQL_CURSOR_COMMIT_BEHAVIOR, - SQL_CB_CLOSE); -TEST_SQL_GET_INFO_UINT16(SQLTxnCapable, SQL_TXN_CAPABLE, SQL_TC_NONE); + SQL_CB_CLOSE) +TEST_SQL_GET_INFO_UINT16(SQLTxnCapable, SQL_TXN_CAPABLE, SQL_TC_NONE) TEST_SQL_GET_INFO_UINT16(SQLConcatNullBehavior, SQL_CONCAT_NULL_BEHAVIOR, - SQL_CB_NULL); -TEST_SQL_GET_INFO_STRING(SQLSchemaTerm, SQL_SCHEMA_TERM, CREATE_STRING("schema")); -TEST_SQL_GET_INFO_STRING(SQLCatalogTerm, SQL_CATALOG_TERM, CREATE_STRING("database")); + SQL_CB_NULL) +TEST_SQL_GET_INFO_STRING(SQLSchemaTerm, SQL_SCHEMA_TERM, CREATE_STRING("schema")) +TEST_SQL_GET_INFO_STRING(SQLCatalogTerm, SQL_CATALOG_TERM, CREATE_STRING("database")) /////////////// // DBMS Info // /////////////// -TEST_SQL_GET_INFO_STRING(SQLDBMSName, SQL_DBMS_NAME, CREATE_STRING("Amazon Timestream")); -TEST_SQL_GET_INFO_VERSION_GE(SQLDBMSVer, SQL_DBMS_VER, CREATE_STRING("0.2.0")); +TEST_SQL_GET_INFO_STRING(SQLDBMSName, SQL_DBMS_NAME, CREATE_STRING("Amazon Timestream")) +TEST_SQL_GET_INFO_VERSION_GE(SQLDBMSVer, SQL_DBMS_VER, CREATE_STRING("0.2.0")) /////////////////// // Supported SQL // /////////////////// -TEST_SQL_GET_INFO_STRING(SQLColumnAlias, SQL_COLUMN_ALIAS, CREATE_STRING("Y")); +TEST_SQL_GET_INFO_STRING(SQLColumnAlias, SQL_COLUMN_ALIAS, CREATE_STRING("Y")) TEST_SQL_GET_INFO_UINT16(SQLGroupBy, SQL_GROUP_BY, - SQL_GB_GROUP_BY_CONTAINS_SELECT); + SQL_GB_GROUP_BY_CONTAINS_SELECT) TEST_SQL_GET_INFO_STRING(SQLIdentifierQuoteChar, SQL_IDENTIFIER_QUOTE_CHAR, - CREATE_STRING("\"")); + CREATE_STRING("\"")) TEST_SQL_GET_INFO_UINT_MASK(SQLOJCapabilities, SQL_OJ_CAPABILITIES, SQL_OJ_LEFT | SQL_OJ_RIGHT | SQL_OJ_NOT_ORDERED - | SQL_OJ_ALL_COMPARISON_OPS); -TEST_SQL_GET_INFO_UINT_MASK(SQLSchemaUsage, SQL_SCHEMA_USAGE, 0); + | SQL_OJ_ALL_COMPARISON_OPS) +TEST_SQL_GET_INFO_UINT_MASK(SQLSchemaUsage, SQL_SCHEMA_USAGE, 0) TEST_SQL_GET_INFO_UINT16(SQLQuotedIdentifierCase, SQL_QUOTED_IDENTIFIER_CASE, - SQL_IC_SENSITIVE); -TEST_SQL_GET_INFO_STRING(SQLSpecialCharacters, SQL_SPECIAL_CHARACTERS, CREATE_STRING("_")); + SQL_IC_SENSITIVE) +TEST_SQL_GET_INFO_STRING(SQLSpecialCharacters, SQL_SPECIAL_CHARACTERS, CREATE_STRING("_")) TEST_SQL_GET_INFO_UINT_MASK(SQLODBCInterfaceConformance, - SQL_ODBC_INTERFACE_CONFORMANCE, SQL_OIC_CORE); + SQL_ODBC_INTERFACE_CONFORMANCE, SQL_OIC_CORE) TEST_SQL_GET_INFO_UINT_MASK(SQLSQLConformance, SQL_SQL_CONFORMANCE, - SQL_SC_SQL92_ENTRY); -TEST_SQL_GET_INFO_UINT_MASK(SQLCatalogUsage, SQL_CATALOG_USAGE, SQL_CU_DML_STATEMENTS); -TEST_SQL_GET_INFO_UINT16(SQLCatalogLocation, SQL_CATALOG_LOCATION, SQL_CL_START); + SQL_SC_SQL92_ENTRY) +TEST_SQL_GET_INFO_UINT_MASK(SQLCatalogUsage, SQL_CATALOG_USAGE, SQL_CU_DML_STATEMENTS) +TEST_SQL_GET_INFO_UINT16(SQLCatalogLocation, SQL_CATALOG_LOCATION, SQL_CL_START) TEST_SQL_GET_INFO_STRING(SQLCatalogNameSeparator, SQL_CATALOG_NAME_SEPARATOR, - CREATE_STRING(".")); + CREATE_STRING(".")) TEST_SQL_GET_INFO_UINT_MASK(SQLSQL92Predicates, SQL_SQL92_PREDICATES, SQL_SP_BETWEEN | SQL_SP_COMPARISON | SQL_SP_IN - | SQL_SP_ISNULL | SQL_SP_LIKE); + | SQL_SP_ISNULL | SQL_SP_LIKE) TEST_SQL_GET_INFO_UINT_MASK(SQLSQL92RelationalJoinOperators, SQL_SQL92_RELATIONAL_JOIN_OPERATORS, SQL_SRJO_CROSS_JOIN | SQL_SRJO_INNER_JOIN | SQL_SRJO_LEFT_OUTER_JOIN - | SQL_SRJO_RIGHT_OUTER_JOIN); + | SQL_SRJO_RIGHT_OUTER_JOIN) TEST_SQL_GET_INFO_UINT_MASK(SQLSQL92ValueExpressions, SQL_SQL92_VALUE_EXPRESSIONS, - SQL_SVE_CASE | SQL_SVE_CAST); -TEST_SQL_GET_INFO_UINT_MASK(SQLDatetimeLiterals, SQL_DATETIME_LITERALS, 0); + SQL_SVE_CASE | SQL_SVE_CAST) +TEST_SQL_GET_INFO_UINT_MASK(SQLDatetimeLiterals, SQL_DATETIME_LITERALS, 0) TEST_SQL_GET_INFO_STRING(SQLOrderByColumnsInSelect, - SQL_ORDER_BY_COLUMNS_IN_SELECT, CREATE_STRING("Y")); -TEST_SQL_GET_INFO_STRING(SQLCatalogName, SQL_CATALOG_NAME, CREATE_STRING("Y")); + SQL_ORDER_BY_COLUMNS_IN_SELECT, CREATE_STRING("Y")) +TEST_SQL_GET_INFO_STRING(SQLCatalogName, SQL_CATALOG_NAME, CREATE_STRING("Y")) //////////////// // Conversion // //////////////// -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertInteger, SQL_CONVERT_INTEGER, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertSmallint, SQL_CONVERT_SMALLINT, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertTinyint, SQL_CONVERT_TINYINT, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertBit, SQL_CONVERT_BIT, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertVarchar, SQL_CONVERT_VARCHAR, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertBigint, SQL_CONVERT_BIGINT, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertDecimal, SQL_CONVERT_DECIMAL, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertDouble, SQL_CONVERT_DOUBLE, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertFloat, SQL_CONVERT_FLOAT, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertNumeric, SQL_CONVERT_NUMERIC, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertReal, SQL_CONVERT_REAL, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertDate, SQL_CONVERT_DATE, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertTime, SQL_CONVERT_TIME, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertTimestamp, SQL_CONVERT_TIMESTAMP, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertBinary, SQL_CONVERT_BINARY, 0); +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertInteger, SQL_CONVERT_INTEGER, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertSmallint, SQL_CONVERT_SMALLINT, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertTinyint, SQL_CONVERT_TINYINT, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertBit, SQL_CONVERT_BIT, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertVarchar, SQL_CONVERT_VARCHAR, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertBigint, SQL_CONVERT_BIGINT, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertDecimal, SQL_CONVERT_DECIMAL, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertDouble, SQL_CONVERT_DOUBLE, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertFloat, SQL_CONVERT_FLOAT, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertNumeric, SQL_CONVERT_NUMERIC, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertReal, SQL_CONVERT_REAL, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertDate, SQL_CONVERT_DATE, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertTime, SQL_CONVERT_TIME, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertTimestamp, SQL_CONVERT_TIMESTAMP, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertBinary, SQL_CONVERT_BINARY, 0) TEST_SQL_GET_INFO_UINT_MASK(SQLConvertLongvarbinary, SQL_CONVERT_LONGVARBINARY, - 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertVarbinary, SQL_CONVERT_VARBINARY, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertChar, SQL_CONVERT_CHAR, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertLongVarchar, SQL_CONVERT_LONGVARCHAR, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertWChar, SQL_CONVERT_WCHAR, 0); + 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertVarbinary, SQL_CONVERT_VARBINARY, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertChar, SQL_CONVERT_CHAR, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertLongVarchar, SQL_CONVERT_LONGVARCHAR, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertWChar, SQL_CONVERT_WCHAR, 0) TEST_SQL_GET_INFO_UINT_MASK(SQLConvertWLongVarchar, SQL_CONVERT_WLONGVARCHAR, - 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertWVarchar, SQL_CONVERT_WVARCHAR, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertGuid, SQL_CONVERT_GUID, 0); + 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertWVarchar, SQL_CONVERT_WVARCHAR, 0) +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertGuid, SQL_CONVERT_GUID, 0) ////////////////////// // Scalar Functions // ////////////////////// TEST_SQL_GET_INFO_UINT_MASK(SQLConvertFunctions, SQL_CONVERT_FUNCTIONS, - SQL_FN_CVT_CAST); + SQL_FN_CVT_CAST) TEST_SQL_GET_INFO_UINT_MASK(SQLNumericFunctions, SQL_NUMERIC_FUNCTIONS, SQL_FN_NUM_ABS | SQL_FN_NUM_ATAN | SQL_FN_NUM_ATAN2 | SQL_FN_NUM_COS | SQL_FN_NUM_COT @@ -265,38 +265,38 @@ TEST_SQL_GET_INFO_UINT_MASK(SQLNumericFunctions, SQL_NUMERIC_FUNCTIONS, | SQL_FN_NUM_PI | SQL_FN_NUM_POWER | SQL_FN_NUM_RADIANS | SQL_FN_NUM_ROUND | SQL_FN_NUM_SIGN | SQL_FN_NUM_SIN - | SQL_FN_NUM_SQRT | SQL_FN_NUM_TAN); + | SQL_FN_NUM_SQRT | SQL_FN_NUM_TAN) TEST_SQL_GET_INFO_UINT_MASK(SQLStringFunctions, SQL_STRING_FUNCTIONS, SQL_FN_STR_ASCII | SQL_FN_STR_LENGTH | SQL_FN_STR_LTRIM | SQL_FN_STR_REPLACE - | SQL_FN_STR_RTRIM | SQL_FN_STR_SUBSTRING); + | SQL_FN_STR_RTRIM | SQL_FN_STR_SUBSTRING) TEST_SQL_GET_INFO_UINT_MASK(SQLSystemFunctions, SQL_SYSTEM_FUNCTIONS, - SQL_FN_SYS_IFNULL); + SQL_FN_SYS_IFNULL) TEST_SQL_GET_INFO_UINT_MASK(SQLTimedateAddIntervals, SQL_TIMEDATE_ADD_INTERVALS, - 0); + 0) TEST_SQL_GET_INFO_UINT_MASK(SQLTimedateDiffIntervals, - SQL_TIMEDATE_DIFF_INTERVALS, 0); + SQL_TIMEDATE_DIFF_INTERVALS, 0) TEST_SQL_GET_INFO_UINT_MASK(SQLTimedateFunctions, SQL_TIMEDATE_FUNCTIONS, SQL_FN_TD_CURDATE | SQL_FN_TD_DAYOFMONTH | SQL_FN_TD_MONTH | SQL_FN_TD_MONTHNAME - | SQL_FN_TD_NOW | SQL_FN_TD_YEAR); + | SQL_FN_TD_NOW | SQL_FN_TD_YEAR) TEST_SQL_GET_INFO_UINT_MASK(SQLSQL92DatetimeFunctions, - SQL_SQL92_DATETIME_FUNCTIONS, 0); + SQL_SQL92_DATETIME_FUNCTIONS, 0) TEST_SQL_GET_INFO_UINT_MASK(SQLSQL92NumericValueFunctions, - SQL_SQL92_NUMERIC_VALUE_FUNCTIONS, 0); + SQL_SQL92_NUMERIC_VALUE_FUNCTIONS, 0) TEST_SQL_GET_INFO_UINT_MASK(SQLSQL92StringFunctions, SQL_SQL92_STRING_FUNCTIONS, - SQL_SSF_LOWER | SQL_SSF_UPPER); + SQL_SSF_LOWER | SQL_SSF_UPPER) //////////// // Limits // //////////// -TEST_SQL_GET_INFO_UINT16(SQLMaxIdentifierLen, SQL_MAX_IDENTIFIER_LEN, SHRT_MAX); +TEST_SQL_GET_INFO_UINT16(SQLMaxIdentifierLen, SQL_MAX_IDENTIFIER_LEN, SHRT_MAX) TEST_SQL_GET_INFO_UINT16(SQLMaxColumnsInGroupBy, SQL_MAX_COLUMNS_IN_GROUP_BY, - 0); + 0) TEST_SQL_GET_INFO_UINT16(SQLMaxColumnsInOrderBy, SQL_MAX_COLUMNS_IN_ORDER_BY, - 0); -TEST_SQL_GET_INFO_UINT16(SQLMaxColumnsInSelect, SQL_MAX_COLUMNS_IN_SELECT, 0); + 0) +TEST_SQL_GET_INFO_UINT16(SQLMaxColumnsInSelect, SQL_MAX_COLUMNS_IN_SELECT, 0) int main(int argc, char** argv) { #ifdef WIN32 diff --git a/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp b/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp index d5473c56b..8867e9b34 100644 --- a/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp +++ b/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp @@ -1880,9 +1880,9 @@ TEST_F(TestSQLGetData, DATE_TO_SQL_C_TYPE_TIME) { std::vector< std::pair< TIME_STRUCT, SQLTCHAR* > > expected; expected.push_back( - std::make_pair(TIME_STRUCT{0}, SQLSTATE_RESTRICTED_DATA_TYPE_ERROR)); + std::make_pair(TIME_STRUCT{0, 0, 0}, SQLSTATE_RESTRICTED_DATA_TYPE_ERROR)); expected.push_back( - std::make_pair(TIME_STRUCT{0}, SQLSTATE_RESTRICTED_DATA_TYPE_ERROR)); + std::make_pair(TIME_STRUCT{0, 0, 0}, SQLSTATE_RESTRICTED_DATA_TYPE_ERROR)); TestConvertingToTime(m_hstmt, columns, expected); } @@ -1992,9 +1992,9 @@ TEST_F(TestSQLGetData, TIME_TO_SQL_C_TYPE_DATE) { std::vector< std::pair< DATE_STRUCT, SQLTCHAR* > > expected; expected.push_back( - std::make_pair(DATE_STRUCT{0}, SQLSTATE_RESTRICTED_DATA_TYPE_ERROR)); + std::make_pair(DATE_STRUCT{0, 0, 0}, SQLSTATE_RESTRICTED_DATA_TYPE_ERROR)); expected.push_back( - std::make_pair(DATE_STRUCT{0}, SQLSTATE_RESTRICTED_DATA_TYPE_ERROR)); + std::make_pair(DATE_STRUCT{0, 0, 0}, SQLSTATE_RESTRICTED_DATA_TYPE_ERROR)); TestConvertingToDate(m_hstmt, columns, expected); } @@ -2864,15 +2864,15 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_TYPE_DATE) { expected.push_back(std::make_pair(DATE_STRUCT{2021, 11, 20}, nullptr)); expected.push_back(std::make_pair(DATE_STRUCT{2021, 11, 1}, nullptr)); expected.push_back( - std::make_pair(DATE_STRUCT{0}, SQLSTATE_STRING_CONVERSION_ERROR)); + std::make_pair(DATE_STRUCT{0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); expected.push_back( - std::make_pair(DATE_STRUCT{0}, SQLSTATE_STRING_CONVERSION_ERROR)); + std::make_pair(DATE_STRUCT{0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); expected.push_back( - std::make_pair(DATE_STRUCT{0}, SQLSTATE_STRING_CONVERSION_ERROR)); + std::make_pair(DATE_STRUCT{0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); expected.push_back( - std::make_pair(DATE_STRUCT{0}, SQLSTATE_STRING_CONVERSION_ERROR)); + std::make_pair(DATE_STRUCT{0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); expected.push_back( - std::make_pair(DATE_STRUCT{0}, SQLSTATE_STRING_CONVERSION_ERROR)); + std::make_pair(DATE_STRUCT{0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); TestConvertingToDate(m_hstmt, columns, expected); } @@ -2910,13 +2910,13 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_TYPE_TIME) { expected.push_back(std::make_pair(TIME_STRUCT{6, 39, 0}, nullptr)); expected.push_back(std::make_pair(TIME_STRUCT{18, 1, 13}, nullptr)); expected.push_back( - std::make_pair(TIME_STRUCT{0}, SQLSTATE_STRING_CONVERSION_ERROR)); + std::make_pair(TIME_STRUCT{0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); expected.push_back( - std::make_pair(TIME_STRUCT{0}, SQLSTATE_STRING_CONVERSION_ERROR)); + std::make_pair(TIME_STRUCT{0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); expected.push_back( - std::make_pair(TIME_STRUCT{0}, SQLSTATE_STRING_CONVERSION_ERROR)); + std::make_pair(TIME_STRUCT{0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); expected.push_back( - std::make_pair(TIME_STRUCT{0}, SQLSTATE_STRING_CONVERSION_ERROR)); + std::make_pair(TIME_STRUCT{0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); TestConvertingToTime(m_hstmt, columns, expected); } diff --git a/src/odfesqlodbc/mylog.c b/src/odfesqlodbc/mylog.c index 57dd3291c..8ce4b2c00 100644 --- a/src/odfesqlodbc/mylog.c +++ b/src/odfesqlodbc/mylog.c @@ -256,7 +256,7 @@ static DWORD start_time = 0; static FILE *MLOGFP = NULL; static void MLOG_open() { - char filebuf[1024], errbuf[1024]; + char filebuf[1024], errbuf[2048]; BOOL open_error = FALSE; // TODO (#585): Add option to log to stderr stream From bdb222837790a7a90b90006fb6bbf896b62e4919 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 19:29:08 -0700 Subject: [PATCH 20/58] [1] Removing another warning --- src/odfesqlodbc/win_unicode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/odfesqlodbc/win_unicode.c b/src/odfesqlodbc/win_unicode.c index 25f829be2..631663f40 100644 --- a/src/odfesqlodbc/win_unicode.c +++ b/src/odfesqlodbc/win_unicode.c @@ -877,7 +877,6 @@ static SQLLEN c16tombs(char *c8dt, const char16_t *c16dt, size_t n) { 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); From 4f1b7de03a80581a86c5e6c61ea8e9e01932996d Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 19:33:04 -0700 Subject: [PATCH 21/58] [1] Reverting removal and fixing warning with pragma because windows build needs it. --- src/odfesqlodbc/win_unicode.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/odfesqlodbc/win_unicode.c b/src/odfesqlodbc/win_unicode.c index 631663f40..f9ae3c0b0 100644 --- a/src/odfesqlodbc/win_unicode.c +++ b/src/odfesqlodbc/win_unicode.c @@ -874,9 +874,14 @@ static SQLLEN c16tombs(char *c8dt, const char16_t *c16dt, size_t n) { // SQLBindParameter SQL_C_CHAR to UTF-8 case // the current locale => UTF-8 // +#ifdef __linux__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif // __linux__ 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); @@ -926,6 +931,9 @@ SQLLEN bindpara_msg_to_utf8(const char *ldt, char **wcsbuf, SQLLEN used) { free(alloc_nts); return l; } +#ifdef __linux__ +#pragma GCC diagnostic pop +#endif // __linux__ // // SQLBindParameter hybrid case From 41f3f8a14bbba0dfb7b839cbb0885fc7099c8325 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 19:45:19 -0700 Subject: [PATCH 22/58] [1] Fixing cppcheck error and pedantic error --- .../ITODBCResults/test_odbc_results.cpp | 4 ++-- src/odfesqlodbc/win_unicode.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp b/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp index 8867e9b34..198d5ad20 100644 --- a/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp +++ b/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp @@ -2820,9 +2820,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_TYPE_TIMESTAMP) { expected.push_back( std::make_pair(TIMESTAMP_STRUCT{2021, 1, 2, 18, 1, 13, 0}, nullptr)); expected.push_back( - std::make_pair(TIMESTAMP_STRUCT{0}, SQLSTATE_STRING_CONVERSION_ERROR)); + std::make_pair(TIMESTAMP_STRUCT{0, 0, 0, 0, 0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); expected.push_back( - std::make_pair(TIMESTAMP_STRUCT{0}, SQLSTATE_STRING_CONVERSION_ERROR)); + std::make_pair(TIMESTAMP_STRUCT{0 0, 0, 0, 0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); TestConvertingToTimestamp(m_hstmt, columns, expected); } diff --git a/src/odfesqlodbc/win_unicode.c b/src/odfesqlodbc/win_unicode.c index f9ae3c0b0..2abe46094 100644 --- a/src/odfesqlodbc/win_unicode.c +++ b/src/odfesqlodbc/win_unicode.c @@ -164,8 +164,8 @@ char *ucs2_to_utf8(const SQLWCHAR *ucs2str, SQLLEN ilen, SQLLEN *olen, memcpy(utf8str + len, (char *)&byte2code, sizeof(byte2code)); else { - utf8str[len] = ((char *)&byte2code)[1]; - utf8str[len + 1] = ((char *)&byte2code)[0]; + utf8str[len] = (char)((byte2code >> 8) && 0xFF); + utf8str[len + 1] = (char)(byte2code & 0xFF); } len += sizeof(byte2code); } @@ -184,10 +184,10 @@ char *ucs2_to_utf8(const SQLWCHAR *ucs2str, SQLLEN ilen, SQLLEN *olen, memcpy(utf8str + len, (char *)&byte4code, sizeof(byte4code)); else { - utf8str[len] = ((char *)&byte4code)[3]; - utf8str[len + 1] = ((char *)&byte4code)[2]; - utf8str[len + 2] = ((char *)&byte4code)[1]; - utf8str[len + 3] = ((char *)&byte4code)[0]; + utf8str[len] = (char)((byte4code >> 24) && 0xFF); + utf8str[len + 1] = (char)((byte4code >> 16) && 0xFF); + utf8str[len + 2] = (char)((byte4code >> 8) && 0xFF); + utf8str[len + 3] = (char)(byte4code & 0xFF); } len += sizeof(byte4code); } else { From 63bcb56f19616d95c8edc3cf76b7148ad077918a Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 19:47:21 -0700 Subject: [PATCH 23/58] [1] more cppcheck fixes --- src/odfesqlodbc/win_unicode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/odfesqlodbc/win_unicode.c b/src/odfesqlodbc/win_unicode.c index 2abe46094..904febc4a 100644 --- a/src/odfesqlodbc/win_unicode.c +++ b/src/odfesqlodbc/win_unicode.c @@ -197,9 +197,9 @@ char *ucs2_to_utf8(const SQLWCHAR *ucs2str, SQLLEN ilen, SQLLEN *olen, if (little_endian) memcpy(utf8str + len, (char *)&byte4code, 3); else { - utf8str[len] = ((char *)&byte4code)[3]; - utf8str[len + 1] = ((char *)&byte4code)[2]; - utf8str[len + 2] = ((char *)&byte4code)[1]; + utf8str[len] = (char)((byte4code >> 16) && 0xFF); + utf8str[len + 1] = (char)((byte4code >> 8) && 0xFF); + utf8str[len + 2] = (char)((byte4code) && 0xFF); } len += 3; } From dbbc423ace7d3c5e9f981f3184d58a614f0ff29f Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 19:48:21 -0700 Subject: [PATCH 24/58] no message --- src/IntegrationTests/ITODBCResults/test_odbc_results.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp b/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp index 198d5ad20..55fa18f9b 100644 --- a/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp +++ b/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp @@ -2822,7 +2822,7 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_TYPE_TIMESTAMP) { expected.push_back( std::make_pair(TIMESTAMP_STRUCT{0, 0, 0, 0, 0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); expected.push_back( - std::make_pair(TIMESTAMP_STRUCT{0 0, 0, 0, 0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); + std::make_pair(TIMESTAMP_STRUCT{0, 0, 0, 0, 0, 0, 0}, SQLSTATE_STRING_CONVERSION_ERROR)); TestConvertingToTimestamp(m_hstmt, columns, expected); } From 01b9e52e0277dd122f0fe1f717b1071e8b8ea729 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 19:54:05 -0700 Subject: [PATCH 25/58] [1] Removing more unused functions and macros. --- src/installer/CMakeLists.txt | 2 +- src/odfesqlodbc/convert.c | 29 ----------------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/src/installer/CMakeLists.txt b/src/installer/CMakeLists.txt index 5bcbd44d3..68476eb44 100644 --- a/src/installer/CMakeLists.txt +++ b/src/installer/CMakeLists.txt @@ -140,7 +140,7 @@ cpack_add_component(Resources install(TARGETS odfesqlodbc DESTINATION bin COMPONENT "Driver") # TODO: look into DSN Installer failure # if(APPLE) -# install(FILES "${PROJECT_ROOT}/bin64/dsn_installer" DESTINATION bin COMPONENT "Driver") +# install(FILES "${PROJECT_ROOT}/bin/dsn_installer" DESTINATION bin COMPONENT "Driver") # install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/remove-odfe-dsn.sh" DESTINATION bin COMPONENT "Driver") # endif() diff --git a/src/odfesqlodbc/convert.c b/src/odfesqlodbc/convert.c index 880b21858..aa6c8d418 100644 --- a/src/odfesqlodbc/convert.c +++ b/src/odfesqlodbc/convert.c @@ -95,35 +95,6 @@ static SQLLEN es_bin2whex(const char *src, SQLWCHAR *dst, SQLLEN length); *--------- */ -/* - * Macros for BIGINT handling. - */ -#ifdef ODBCINT64 -#ifdef WIN32 -#define ATOI64(val) _strtoi64(val, NULL, 10) -#define ATOI64U(val) _strtoui64(val, NULL, 10) -#elif (SIZEOF_LONG == 8) -#define ATOI64(val) strtol(val, NULL, 10) -#define ATOI64U(val) strtoul(val, NULL, 10) -#else -#if defined(HAVE_STRTOLL) -#define ATOI64(val) strtoll(val, NULL, 10) -#define ATOI64U(val) strtoull(val, NULL, 10) -#else -static ODBCINT64 ATOI64(const char *val) { - ODBCINT64 ll; - sscanf(val, "%lld", &ll); - return ll; -} -static unsigned ODBCINT64 ATOI64U(const char *val) { - unsigned ODBCINT64 ll; - sscanf(val, "%llu", &ll); - return ll; -} -#endif /* HAVE_STRTOLL */ -#endif /* WIN32 */ -#endif /* ODBCINT64 */ - static void parse_to_numeric_struct(const char *wv, SQL_NUMERIC_STRUCT *ns, BOOL *overflow); From fd031808d701e783046cd3afd6d94a2c97647908 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 19:54:28 -0700 Subject: [PATCH 26/58] [1] Removing printouts --- src/odfesqlodbc/dlg_specific.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/odfesqlodbc/dlg_specific.c b/src/odfesqlodbc/dlg_specific.c index 9bfa14d24..eb3a79b31 100644 --- a/src/odfesqlodbc/dlg_specific.c +++ b/src/odfesqlodbc/dlg_specific.c @@ -363,15 +363,12 @@ void getDSNinfo(ConnInfo *ci, const char *configDrvrname) { while (*(DSN + strlen(DSN) - 1) == ' ') *(DSN + strlen(DSN) - 1) = '\0'; - printf("DSN: %s\n", DSN); if (!drivername[0] && DSN[0]) getDriverNameFromDSN(DSN, (char *)drivername, sizeof(ci->drivername)); MYLOG(LOG_DEBUG, "drivername=%s\n", drivername); if (!drivername[0]) drivername = INVALID_DRIVER; - printf("Driver name1: %s\n", drivername); getDriversDefaults(drivername, &(ci->drivers)); - printf("Driver name2: %s\n", drivername); if (DSN[0] == '\0') return; From a559bb0958712fa8a2a51c94c966719e9a4ababc Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 20:02:59 -0700 Subject: [PATCH 27/58] [1] fixing more warnings --- src/odfesqlodbc/bind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/odfesqlodbc/bind.h b/src/odfesqlodbc/bind.h index d56f9ed2a..59047df18 100644 --- a/src/odfesqlodbc/bind.h +++ b/src/odfesqlodbc/bind.h @@ -111,7 +111,7 @@ typedef struct { + (bind_size > 0 \ ? bind_size \ : (SQL_C_VARBOOKMARK == book->returntype ? book->buflen \ - : ((SQLLEN)sizeof(UInt4)))) \ + : ((SQLULEN)sizeof(UInt4)))) \ * index) /* Macros to handle estype of parameters */ From e10b62f90413e92c27ed661a7d6af1ac3b6bcb80 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 20:09:31 -0700 Subject: [PATCH 28/58] [1] Trying to fix warning. --- src/odfesqlodbc/bind.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/odfesqlodbc/bind.h b/src/odfesqlodbc/bind.h index 59047df18..966419126 100644 --- a/src/odfesqlodbc/bind.h +++ b/src/odfesqlodbc/bind.h @@ -109,9 +109,9 @@ typedef struct { #define CALC_BOOKMARK_ADDR(book, offset, bind_size, index) \ (book->buffer + offset \ + (bind_size > 0 \ - ? bind_size \ - : (SQL_C_VARBOOKMARK == book->returntype ? book->buflen \ - : ((SQLULEN)sizeof(UInt4)))) \ + ? (SQLLEN)bind_size \ + : (SQL_C_VARBOOKMARK == book->returntype ? (SQLLEN)book->buflen \ + : ((SQLLEN)sizeof(UInt4)))) \ * index) /* Macros to handle estype of parameters */ From 4b06d6d528a44254b2c5e2542283fef38e657bb7 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 20:19:32 -0700 Subject: [PATCH 29/58] [1] Fixing linker --- tools/ODBCcli/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ODBCcli/CMakeLists.txt b/tools/ODBCcli/CMakeLists.txt index 3f31f15b4..0216fe7f5 100644 --- a/tools/ODBCcli/CMakeLists.txt +++ b/tools/ODBCcli/CMakeLists.txt @@ -17,5 +17,5 @@ if(WIN32) elseif(APPLE) target_link_libraries(ODBCcli iodbc) elseif(UNIX) - target_link_libraries(ODBCcli unixodbc) + target_link_libraries(ODBCcli odbc odbcinst) endif() From 47dce5a5a8bbc01c57345d1ba5b5594f078aed7e Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 20:33:56 -0700 Subject: [PATCH 30/58] [1] Trying to fix installer upload --- .github/workflows/linux-build.yml | 37 ++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index bf76687a5..5eac53aa7 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -102,30 +102,37 @@ jobs: - name: build-installer-rpm if: success() run: | - mkdir rpm-installer ./build_linux_release64_rpm.sh cd cmake-build64 cmake ../src make -j4 cpack . - cp -v ./*.rpm ../rpm-installer + cd .. - name: build-installer-deb if: success() run: | - mkdir deb-installer ./build_linux_release64_deb.sh cd cmake-build64 cmake ../src make -j4 cpack . - cp -v ./*.deb ../deb-installer + cd .. - name: create-output if: success() run: | + pwd + ls + mkdir rpm-installer + mkdir deb-installer mkdir build-output mkdir test-output - cp ./build/odbc/lib/*.so build-output/ - cp ./build/odbc/lib/*.a build-output/ + cp -v ./build/odbc/lib/*.a build-output/ + cp -v ./build/odbc/lib/*.so build-output/ + cp -v cmake-build64/*.rpm rpm-installer/ + cp -v cmake-build64/*.deb deb-installer/ + pwd + ls + ls rpm-installer - name: upload-build if: success() uses: actions/upload-artifact@v2 @@ -231,13 +238,12 @@ jobs: - name: build-installer-rpm if: success() run: | - mkdir rpm-installer ./build_linux_release32_rpm.sh cd cmake-build32 cmake ../src make -j4 cpack . - cp -v ./*.rpm ../rpm-installer + cd .. - name: build-installer-deb if: success() run: | @@ -247,14 +253,23 @@ jobs: cmake ../src make -j4 cpack . - cp -v ./*.deb ../deb-installer + cd.. - name: create-output if: success() run: | + pwd + ls + mkdir rpm-installer + mkdir deb-installer mkdir build-output mkdir test-output - cp ./build/odbc/lib/*.so build-output/ - cp ./build/odbc/lib/*.a build-output/ + cp -v ./build/odbc/lib/*.a build-output/ + cp -v ./build/odbc/lib/*.so build-output/ + cp -v cmake-build32/*.rpm rpm-installer/ + cp -v cmake-build32/*.deb deb-installer/ + pwd + ls + ls rpm-installer - name: upload-build if: success() uses: actions/upload-artifact@v2 From b03e2a1b49741d65d34c4978e3d71702ac57b4ab Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 20:52:43 -0700 Subject: [PATCH 31/58] [1] Fixing build script --- .github/workflows/linux-build.yml | 52 +++++++++++++------------------ tools/ODBCcli/README.md | 4 +++ 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 5eac53aa7..d33e4cb1a 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -99,7 +99,7 @@ jobs: name: integration-test-results-linux64 path: | ${{ github.workspace }}/odbc-logs/ - - name: build-installer-rpm + - name: build-rpm-installer if: success() run: | ./build_linux_release64_rpm.sh @@ -108,7 +108,7 @@ jobs: make -j4 cpack . cd .. - - name: build-installer-deb + - name: build-deb-installer if: success() run: | ./build_linux_release64_deb.sh @@ -120,37 +120,32 @@ jobs: - name: create-output if: success() run: | - pwd - ls mkdir rpm-installer mkdir deb-installer mkdir build-output mkdir test-output cp -v ./build/odbc/lib/*.a build-output/ cp -v ./build/odbc/lib/*.so build-output/ - cp -v cmake-build64/*.rpm rpm-installer/ - cp -v cmake-build64/*.deb deb-installer/ - pwd - ls - ls rpm-installer + cp -v ./cmake-build64/*.rpm rpm-installer/ + cp -v ./cmake-build64/*.deb deb-installer/ - name: upload-build if: success() uses: actions/upload-artifact@v2 with: name: linux64-build path: build-output - - name: upload-linux64-installer-rpm + - name: upload-linux64-rpm-installer if: success() uses: actions/upload-artifact@v2 with: - name: linux64-installer-rpm - path: installer-rpm - - name: upload-linux64-installer-deb + name: linux64-rpm-installer + path: rpm-installer + - name: upload-linux64-deb-installer if: success() uses: actions/upload-artifact@v2 with: - name: linux64-installer-deb - path: installer-deb + name: linux64-deb-installer + path: deb-installer build-linux32: runs-on: ubuntu-latest steps: @@ -235,7 +230,7 @@ jobs: name: integration-test-results-linux32 path: | ${{ github.workspace }}/odbc-logs/ - - name: build-installer-rpm + - name: build-rpm-installer if: success() run: | ./build_linux_release32_rpm.sh @@ -244,7 +239,7 @@ jobs: make -j4 cpack . cd .. - - name: build-installer-deb + - name: build-deb-installer if: success() run: | mkdir deb-installer @@ -253,38 +248,33 @@ jobs: cmake ../src make -j4 cpack . - cd.. + cd .. - name: create-output if: success() run: | - pwd - ls mkdir rpm-installer mkdir deb-installer mkdir build-output mkdir test-output cp -v ./build/odbc/lib/*.a build-output/ cp -v ./build/odbc/lib/*.so build-output/ - cp -v cmake-build32/*.rpm rpm-installer/ - cp -v cmake-build32/*.deb deb-installer/ - pwd - ls - ls rpm-installer + cp -v ./cmake-build32/*.rpm rpm-installer/ + cp -v ./cmake-build32/*.deb deb-installer/ - name: upload-build if: success() uses: actions/upload-artifact@v2 with: name: linux32-build path: build-output - - name: upload-linux32-installer-rpm + - name: upload-linux32-rpm-installer if: success() uses: actions/upload-artifact@v2 with: - name: linux32-installer-rpm - path: installer-rpm - - name: upload-linux32-installer-deb + name: linux32-rpm-installer + path: rpm-installer + - name: upload-linux32-deb-installer if: success() uses: actions/upload-artifact@v2 with: - name: linux32-installer-deb - path: installer-deb + name: linux32-deb-installer + path: deb-installer diff --git a/tools/ODBCcli/README.md b/tools/ODBCcli/README.md index 2451075ed..d2c25f896 100644 --- a/tools/ODBCcli/README.md +++ b/tools/ODBCcli/README.md @@ -40,3 +40,7 @@ In macOS: ``` ./ODBCcli ``` +In Linux: +``` +./ODBCcli +``` From 6688fd3d97f94eb07687b3bc7ce6bdaeb0954742 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 21:05:35 -0700 Subject: [PATCH 32/58] [1] Fixing 32-bit failure and adding test for sample app [2] Updating readme because it was kind of weird --- .github/workflows/linux-build.yml | 10 +++++++++- tools/ODBCcli/README.md | 28 ++++++++++++++++------------ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index d33e4cb1a..86c770141 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -146,6 +146,15 @@ jobs: with: name: linux64-deb-installer path: deb-installer + - name: build-and-test-sample-application + if: success() + run: | + cd tools/ODBCCli + mkdir build + cd build + cmake ../ -DCMAKE_BUILD_TYPE=Release + make -j 4 + ./ODBCcli "DSN=timestream-aws-profile" "* FROM ODBCTest.IoT LIMIT 1" build-linux32: runs-on: ubuntu-latest steps: @@ -242,7 +251,6 @@ jobs: - name: build-deb-installer if: success() run: | - mkdir deb-installer ./build_linux_release32_deb.sh cd cmake-build32 cmake ../src diff --git a/tools/ODBCcli/README.md b/tools/ODBCcli/README.md index d2c25f896..41419022f 100644 --- a/tools/ODBCcli/README.md +++ b/tools/ODBCcli/README.md @@ -2,15 +2,15 @@ A simple odbc client application that lets you pass a dsn and query to run on a Timestream database. -## Prerequisite +## Prerequisites - [CMake](https://cmake.org/) -## Support platform +## Supported platforms - Windows - Tested in Windows 10 only - MacOS - Tested. Need [iODBC](http://www.iodbc.org/dataspace/doc/iodbc/wiki/iodbcWiki/WelcomeVisitors) setup -- unixODBC - Not tested. Need [unixODBC](http://www.unixodbc.org/) setup +- unixODBC - Tested. Need [unixODBC](http://www.unixodbc.org/) setup -## How to compile using make +## Compiling with make ``` $ cd ODBCcli $ mkdir build @@ -18,7 +18,7 @@ $ cd build $ cmake ../ -DCMAKE_BUILD_TYPE=Release $ make ``` -## How to compile using Visual Studio 2019 +## Compiling with Visual Studio 2019 - cmake needs to be run to generate the .vcxproj file ``` 1. Open the command prompt in Administrator mode @@ -31,16 +31,20 @@ $ make 8. Right click on ODBCcli and click Build. 9. odbccli.exe will be created in the Build\Debug directory or Build\Release directory depending on the version built ``` -## How to run it? -In Windows: +## Running the Sample Application - ODBCCli +On Windows: ``` -ODBCcli.exe +ODBCcli.exe ``` -In macOS: +For example: ``` -./ODBCcli +ODBCcli.exe "DSN=timestream-aws-profile" "SELECT * FROM CLIExample.ExampleTable LIMIT 1" ``` -In Linux: +On macOS or Linux: ``` -./ODBCcli +./ODBCcli ``` +For example: +``` +ODBCcli "DSN=timestream-aws-profile" "SELECT * FROM CLIExample.ExampleTable LIMIT 1" +``` \ No newline at end of file From 10e9d55ae83ca6ffdc07426e57bb5bf9f04293bd Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 21:14:21 -0700 Subject: [PATCH 33/58] [1] Retrying cli build but moving so it is fail fast. --- .github/workflows/linux-build.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 86c770141..a5c7e8012 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -46,6 +46,17 @@ jobs: export ODBCSYSINI=/etc/ export ODBCINSTINI=odbcinst.ini export ODBCINI=/etc/odbc.ini + - name: build-and-test-sample-application + if: success() + run: | + pwd + ls -l + cd tools/ODBCCli + mkdir build + cd build + cmake ../ -DCMAKE_BUILD_TYPE=Release + make -j 4 + ./ODBCcli "DSN=timestream-aws-profile" "* FROM ODBCTest.IoT LIMIT 1" - name: configure-and-build-driver run: | ./build_linux_release64_rpm.sh @@ -146,15 +157,6 @@ jobs: with: name: linux64-deb-installer path: deb-installer - - name: build-and-test-sample-application - if: success() - run: | - cd tools/ODBCCli - mkdir build - cd build - cmake ../ -DCMAKE_BUILD_TYPE=Release - make -j 4 - ./ODBCcli "DSN=timestream-aws-profile" "* FROM ODBCTest.IoT LIMIT 1" build-linux32: runs-on: ubuntu-latest steps: From fa49363af95c9adbc24062013ae211057e9388fc Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 21:17:13 -0700 Subject: [PATCH 34/58] [1] cd fix and readme updates. --- .github/workflows/linux-build.yml | 20 +++++++++----------- tools/ODBCcli/README.md | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index a5c7e8012..1d0579d0d 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -46,17 +46,6 @@ jobs: export ODBCSYSINI=/etc/ export ODBCINSTINI=odbcinst.ini export ODBCINI=/etc/odbc.ini - - name: build-and-test-sample-application - if: success() - run: | - pwd - ls -l - cd tools/ODBCCli - mkdir build - cd build - cmake ../ -DCMAKE_BUILD_TYPE=Release - make -j 4 - ./ODBCcli "DSN=timestream-aws-profile" "* FROM ODBCTest.IoT LIMIT 1" - name: configure-and-build-driver run: | ./build_linux_release64_rpm.sh @@ -157,6 +146,15 @@ jobs: with: name: linux64-deb-installer path: deb-installer + - name: build-and-test-sample-application + if: success() + run: | + cd tools/ODBCcli + mkdir build + cd build + cmake ../ -DCMAKE_BUILD_TYPE=Release + make -j 4 + ./ODBCcli "DSN=timestream-aws-profile" "* FROM ODBCTest.IoT LIMIT 1" build-linux32: runs-on: ubuntu-latest steps: diff --git a/tools/ODBCcli/README.md b/tools/ODBCcli/README.md index 41419022f..feac67d43 100644 --- a/tools/ODBCcli/README.md +++ b/tools/ODBCcli/README.md @@ -1,4 +1,4 @@ -# ODBC sample client application - ODBCCli +# ODBC sample client application - ODBCcli A simple odbc client application that lets you pass a dsn and query to run on a Timestream database. @@ -31,7 +31,7 @@ $ make 8. Right click on ODBCcli and click Build. 9. odbccli.exe will be created in the Build\Debug directory or Build\Release directory depending on the version built ``` -## Running the Sample Application - ODBCCli +## Running the Sample Application - ODBCcli On Windows: ``` ODBCcli.exe From 2bac711b3cb7dec38e9ac5e5c2c2a8c36bc722c5 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 21:30:45 -0700 Subject: [PATCH 35/58] [1] Minor cli updates. --- tools/ODBCcli/client.cpp | 16 ++++++++-------- tools/ODBCcli/main.cpp | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/ODBCcli/client.cpp b/tools/ODBCcli/client.cpp index 420c2651c..1516ddc11 100644 --- a/tools/ODBCcli/client.cpp +++ b/tools/ODBCcli/client.cpp @@ -9,17 +9,17 @@ Client::Client(const char *connection_string) : henv(SQL_NULL_HENV), // Allocate the environment handle auto retcode = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv); if (!SQL_SUCCEEDED(retcode)) { - throw std::runtime_error("Failed at SQLAllocHandle SQL_HANDLE_ENV"); + throw std::runtime_error("Failed at SQLAllocHandle SQL_HANDLE_ENV " + std::to_string(retcode) + "."); } // Set the version environment attribute retcode = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER *) SQL_OV_ODBC3, 0); if (!SQL_SUCCEEDED(retcode)) { - throw std::runtime_error("Failed at SQLSetEnvAttr SQL_ATTR_ODBC_VERSION"); + throw std::runtime_error("Failed at SQLSetEnvAttr SQL_ATTR_ODBC_VERSION " + std::to_string(retcode) + "."); } // Allocate the connection handle retcode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc); if (!SQL_SUCCEEDED(retcode)) { - throw std::runtime_error("Failed at SQLAllocHandle SQL_HANDLE_DBC"); + throw std::runtime_error("Failed at SQLAllocHandle SQL_HANDLE_DBC " + std::to_string(retcode) + "."); } // Connect SQLCHAR strConnIn[BUF_LEN] = {0}, strConnOut[BUF_LEN] = {0}; @@ -27,12 +27,12 @@ Client::Client(const char *connection_string) : henv(SQL_NULL_HENV), strcpy((char *) strConnIn, connection_string); retcode = SQLDriverConnect(hdbc, NULL, strConnIn, SQL_NTS, strConnOut, BUF_LEN, &lenConnOut, SQL_DRIVER_COMPLETE); if (!SQL_SUCCEEDED(retcode)) { - throw std::runtime_error("Failed at SQLDriverConnect"); + throw std::runtime_error("Failed at SQLDriverConnect with code " + std::to_string(retcode) + "."); } // Allocate the statement handle retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt); if (!SQL_SUCCEEDED(retcode)) { - throw std::runtime_error("Failed at SQLAllocHandle SQL_HANDLE_STMT"); + throw std::runtime_error("Failed at SQLAllocHandle SQL_HANDLE_STMT " + std::to_string(retcode) + "."); } } @@ -55,7 +55,7 @@ Client::~Client() { void Client::Query(const char *query) { auto retcode = SQLExecDirect(hstmt, (SQLCHAR *) query, (SQLINTEGER) strlen(query)); if (!SQL_SUCCEEDED(retcode)) { - throw std::runtime_error("Failed at SQLExecDirect"); + throw std::runtime_error("Failed at SQLExecDirect " + std::to_string(retcode) + "."); } } @@ -66,7 +66,7 @@ std::optional> Client::FetchOne() { if (cols == 0) { retcode = SQLNumResultCols(hstmt, &cols); if (!SQL_SUCCEEDED(retcode)) { - throw std::runtime_error("Failed at SQLNumResultCols"); + throw std::runtime_error("Failed at SQLNumResultCols " + std::to_string(retcode) + "."); } } std::vector row; @@ -75,7 +75,7 @@ std::optional> Client::FetchOne() { SQLLEN indicator = 0; retcode = SQLGetData(hstmt, i, SQL_C_CHAR, &data, BUF_LEN, &indicator); if (!SQL_SUCCEEDED(retcode)) { - throw std::runtime_error("Failed at SQLGetData"); + throw std::runtime_error("Failed at SQLGetData " + std::to_string(retcode) + "."); } if (indicator != SQL_NULL_DATA) { std::string cell((const char *) data, indicator); diff --git a/tools/ODBCcli/main.cpp b/tools/ODBCcli/main.cpp index 4408032ff..69249c808 100644 --- a/tools/ODBCcli/main.cpp +++ b/tools/ODBCcli/main.cpp @@ -26,6 +26,7 @@ int main(int argc, char *argv[]) { std::cout << "Total rows: " << cnt << std::endl; } catch (const std::exception &e) { std::cout << e.what() << std::endl; + return 1; } return 0; } From 9adb11ec021fc09b13628329846b46ecf6b120a0 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 21:39:08 -0700 Subject: [PATCH 36/58] [1] Added additional debug info --- src/odfesqlodbc/driver_connect.cpp | 8 +++++++- tools/ODBCcli/client.cpp | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/odfesqlodbc/driver_connect.cpp b/src/odfesqlodbc/driver_connect.cpp index 99fd3ee60..c3fc83a8d 100644 --- a/src/odfesqlodbc/driver_connect.cpp +++ b/src/odfesqlodbc/driver_connect.cpp @@ -227,10 +227,13 @@ RETCODE ESAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, // Setup connection string { + printf("Setup conn string\n"); const SQLRETURN return_code = SetupConnString(conn_str_in, conn_str_in_len, ci, conn); - if (return_code != SQL_SUCCESS) + if (return_code != SQL_SUCCESS) { + printf("Setup conn string failed\n"); return return_code; + } } // Initialize version @@ -239,16 +242,19 @@ RETCODE ESAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, int reqs = 0; int retval = 0; do { + printf("GetRequirementsAndConnect\n"); const SQLRETURN return_code = GetRequirementsAndConnect( driver_completion, hwnd, ci, reqs, conn, retval); if (return_code != SQL_SUCCESS) return return_code; // Check for errors + printf("CheckRetVal\n"); const std::string error_msg = CheckRetVal(retval, hwnd, driver_completion, reqs, ci); // If we have an error, log it and exit + printf("Error msg: '%s'\n", error_msg.c_str()); if (error_msg != "") { CC_log_error(func, error_msg.c_str(), conn); return SQL_ERROR; diff --git a/tools/ODBCcli/client.cpp b/tools/ODBCcli/client.cpp index 1516ddc11..8d2da310f 100644 --- a/tools/ODBCcli/client.cpp +++ b/tools/ODBCcli/client.cpp @@ -25,7 +25,7 @@ Client::Client(const char *connection_string) : henv(SQL_NULL_HENV), SQLCHAR strConnIn[BUF_LEN] = {0}, strConnOut[BUF_LEN] = {0}; SQLSMALLINT lenConnOut; strcpy((char *) strConnIn, connection_string); - retcode = SQLDriverConnect(hdbc, NULL, strConnIn, SQL_NTS, strConnOut, BUF_LEN, &lenConnOut, SQL_DRIVER_COMPLETE); + retcode = SQLDriverConnectA(hdbc, NULL, strConnIn, SQL_NTS, strConnOut, BUF_LEN, &lenConnOut, SQL_DRIVER_COMPLETE); if (!SQL_SUCCEEDED(retcode)) { throw std::runtime_error("Failed at SQLDriverConnect with code " + std::to_string(retcode) + "."); } @@ -53,7 +53,7 @@ Client::~Client() { } void Client::Query(const char *query) { - auto retcode = SQLExecDirect(hstmt, (SQLCHAR *) query, (SQLINTEGER) strlen(query)); + auto retcode = SQLExecDirectA(hstmt, (SQLCHAR *) query, (SQLINTEGER) strlen(query)); if (!SQL_SUCCEEDED(retcode)) { throw std::runtime_error("Failed at SQLExecDirect " + std::to_string(retcode) + "."); } From 96393ddace396601cc1f1979e53d3cfb35a4be00 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 21:47:54 -0700 Subject: [PATCH 37/58] [1] Printing errors to see if it will help debug issue with ODBCcli --- src/odfesqlodbc/connection.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/odfesqlodbc/connection.c b/src/odfesqlodbc/connection.c index b76fe6580..d201aafe5 100644 --- a/src/odfesqlodbc/connection.c +++ b/src/odfesqlodbc/connection.c @@ -637,6 +637,7 @@ int CC_get_error(ConnectionClass *self, int *number, char **message) { void CC_log_error(const char *func, const char *desc, const ConnectionClass *self) { #define NULLCHECK(a) (a ? a : "(NULL)") + printf("Error: '%s'", NULLCHECK(self->__error_message)); if (self) { MYLOG(LOG_ERROR, From c66726be18207dce1751f4dffac4a29c7d1f3822 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 21:52:43 -0700 Subject: [PATCH 38/58] [1]\ Minor fixes --- src/odfesqlodbc/connection.c | 10 ++++++++-- src/odfesqlodbc/driver_connect.cpp | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/odfesqlodbc/connection.c b/src/odfesqlodbc/connection.c index d201aafe5..a6d7f558d 100644 --- a/src/odfesqlodbc/connection.c +++ b/src/odfesqlodbc/connection.c @@ -596,14 +596,20 @@ SQLUINTEGER CC_get_isolation(ConnectionClass *self) { void CC_set_error(ConnectionClass *self, int number, const char *message, const char *func) { CONNLOCK_ACQUIRE(self); - if (self->__error_message) + if (self->__error_message) { + printf("Current error: '%s'\n", self->__error_message); free(self->__error_message); + } self->__error_number = number; self->__error_message = message ? strdup(message) : NULL; if (0 != number) CC_set_error_statements(self); if (func && number != 0) - CC_log_error(func, "", self); + CC_log_error(func, "", self); { + if (self->__error_message != NULL) + printf("New error: '%s'\n", self->__error_message); + else + printf("Error null, number %d\n", (int)self->__error_number); CONNLOCK_RELEASE(self); } diff --git a/src/odfesqlodbc/driver_connect.cpp b/src/odfesqlodbc/driver_connect.cpp index c3fc83a8d..57273269b 100644 --- a/src/odfesqlodbc/driver_connect.cpp +++ b/src/odfesqlodbc/driver_connect.cpp @@ -219,6 +219,7 @@ RETCODE ESAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, CSTR func = "ESAPI_DriverConnect"; ConnectionClass *conn = (ConnectionClass *)hdbc; + printf("Conn handle\n"); if (!conn) { CC_log_error(func, "ConnectionClass handle is NULL", NULL); return SQL_INVALID_HANDLE; From 6b0db0681a0d9bf23034f275dde869b0319c80fc Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 21:54:12 -0700 Subject: [PATCH 39/58] [1] Fixing brace --- src/odfesqlodbc/connection.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/odfesqlodbc/connection.c b/src/odfesqlodbc/connection.c index a6d7f558d..3cb3f1bd5 100644 --- a/src/odfesqlodbc/connection.c +++ b/src/odfesqlodbc/connection.c @@ -605,7 +605,8 @@ void CC_set_error(ConnectionClass *self, int number, const char *message, if (0 != number) CC_set_error_statements(self); if (func && number != 0) - CC_log_error(func, "", self); { + CC_log_error(func, "", self); + if (self->__error_message != NULL) printf("New error: '%s'\n", self->__error_message); else From e3a18239f1f841d0051a4d72e2e7eb302ff7574b Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 22:17:46 -0700 Subject: [PATCH 40/58] [1] More updates --- .../ITODBCConnection/odbcinst-linux.ini | 4 ++-- src/installer/CMakeLists.txt | 15 ++++++++++++--- src/odfesqlodbc/connection.c | 9 +-------- src/odfesqlodbc/driver_connect.cpp | 9 +-------- 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini b/src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini index f52ff8bc9..d3238f00d 100644 --- a/src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini +++ b/src/IntegrationTests/ITODBCConnection/odbcinst-linux.ini @@ -2,5 +2,5 @@ timestreamodbc = Installed [timestreamodbc] -Driver = /usr/lib/odfe-sql-odbc/lib/libodfesqlodbc.so -Setup = /usr/lib/odfe-sql-odbc/lib/libodfesqlodbc.so +Driver = /usr/bin/libodfesqlodbc.so +Setup = /usr/bin/libodfesqlodbc.so diff --git a/src/installer/CMakeLists.txt b/src/installer/CMakeLists.txt index 68476eb44..82ebb8d5e 100644 --- a/src/installer/CMakeLists.txt +++ b/src/installer/CMakeLists.txt @@ -22,7 +22,15 @@ set(CMAKE_INSTALL_PREFIX ${INSTALL_ROOT}) set(CPACK_PACKAGE_VERSION "${DRIVER_PACKAGE_VERSION}") if(APPLE) set(CPACK_PACKAGE_FILE_NAME "AmazonTimestreamODBC-${CPACK_PACKAGE_VERSION}") - set(CPACK_PACKAGE_NAME "Amazon Timestream ODBC Driver ${CPACK_PACKAGE_VERSION}") + set(CPACK_PACKAGE_NAME "Amazon Timestream ODBC Driver ${BITNESS}-bit ${CPACK_PACKAGE_VERSION}") +elseif(UNIX) + set(CPACK_PACKAGE_FILE_NAME "AmazonTimestreamODBC${BITNESS}-${CPACK_PACKAGE_VERSION}") + if (INSTALLER_TYPE STREQUAL "DEB") + # Deb installers fail if there's a space in them. + set(CPACK_PACKAGE_NAME "AmazonTimestreamODBCDriver${BITNESS}-bit${CPACK_PACKAGE_VERSION}") + else() + set(CPACK_PACKAGE_NAME "Amazon Timestream ODBC Driver ${BITNESS}-bit ${CPACK_PACKAGE_VERSION}") + endif() else() set(CPACK_PACKAGE_FILE_NAME "AmazonTimestreamODBC${BITNESS}-${CPACK_PACKAGE_VERSION}") set(CPACK_PACKAGE_NAME "Amazon Timestream ODBC Driver ${BITNESS}-bit ${CPACK_PACKAGE_VERSION}") @@ -79,7 +87,8 @@ elseif(APPLE) set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/Resources/README.txt") set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/Resources/Welcome.txt") else() - if(INSTALLER_TYPE STREQUAL "DEB") + if(INSTALLER_TYPE STREQUAL "DEB") + set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) if (BITNESS EQUAL 32) set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i686) else() @@ -94,7 +103,7 @@ else() set(CPACK_PACKAGE_CONTACT "lyndonb@bitquilltech.com") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Lyndon Bauto") - set(CPACK_PACKAGE_DESCRIPTION "Amazon Timestream ODBC Driver - ${BITNESS}-bit") + set(CPACK_PACKAGE_DESCRIPTION "AmazonTimestreamODBCDriver-${BITNESS}-bit") # Add postrm and postinst with dsn stuff to add and remove them. #set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/Debian/postinst") diff --git a/src/odfesqlodbc/connection.c b/src/odfesqlodbc/connection.c index 3cb3f1bd5..d201aafe5 100644 --- a/src/odfesqlodbc/connection.c +++ b/src/odfesqlodbc/connection.c @@ -596,21 +596,14 @@ SQLUINTEGER CC_get_isolation(ConnectionClass *self) { void CC_set_error(ConnectionClass *self, int number, const char *message, const char *func) { CONNLOCK_ACQUIRE(self); - if (self->__error_message) { - printf("Current error: '%s'\n", self->__error_message); + if (self->__error_message) free(self->__error_message); - } self->__error_number = number; self->__error_message = message ? strdup(message) : NULL; if (0 != number) CC_set_error_statements(self); if (func && number != 0) CC_log_error(func, "", self); - - if (self->__error_message != NULL) - printf("New error: '%s'\n", self->__error_message); - else - printf("Error null, number %d\n", (int)self->__error_number); CONNLOCK_RELEASE(self); } diff --git a/src/odfesqlodbc/driver_connect.cpp b/src/odfesqlodbc/driver_connect.cpp index 57273269b..99fd3ee60 100644 --- a/src/odfesqlodbc/driver_connect.cpp +++ b/src/odfesqlodbc/driver_connect.cpp @@ -219,7 +219,6 @@ RETCODE ESAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, CSTR func = "ESAPI_DriverConnect"; ConnectionClass *conn = (ConnectionClass *)hdbc; - printf("Conn handle\n"); if (!conn) { CC_log_error(func, "ConnectionClass handle is NULL", NULL); return SQL_INVALID_HANDLE; @@ -228,13 +227,10 @@ RETCODE ESAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, // Setup connection string { - printf("Setup conn string\n"); const SQLRETURN return_code = SetupConnString(conn_str_in, conn_str_in_len, ci, conn); - if (return_code != SQL_SUCCESS) { - printf("Setup conn string failed\n"); + if (return_code != SQL_SUCCESS) return return_code; - } } // Initialize version @@ -243,19 +239,16 @@ RETCODE ESAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, int reqs = 0; int retval = 0; do { - printf("GetRequirementsAndConnect\n"); const SQLRETURN return_code = GetRequirementsAndConnect( driver_completion, hwnd, ci, reqs, conn, retval); if (return_code != SQL_SUCCESS) return return_code; // Check for errors - printf("CheckRetVal\n"); const std::string error_msg = CheckRetVal(retval, hwnd, driver_completion, reqs, ci); // If we have an error, log it and exit - printf("Error msg: '%s'\n", error_msg.c_str()); if (error_msg != "") { CC_log_error(func, error_msg.c_str(), conn); return SQL_ERROR; From 9a69ecbb0598f150881c6339fdb80a119d5f3090 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 22:21:41 -0700 Subject: [PATCH 41/58] [1] Install deb so sample app can be tested. --- .github/workflows/linux-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 1d0579d0d..76a18ce60 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -110,12 +110,14 @@ jobs: cd .. - name: build-deb-installer if: success() + # TODO: Remove deb install. Temporarily adding so I can test sample application run: | ./build_linux_release64_deb.sh cd cmake-build64 cmake ../src make -j4 cpack . + sudo dpkg -i amazontimestreamodbcdriver64-bit0.3.2_0.3.2_amd64.deb cd .. - name: create-output if: success() From bcf92d4fff2b958e0100bfdf6aa97e69ceb7cc52 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 22:36:07 -0700 Subject: [PATCH 42/58] [1] Fixiong cppcheck --- src/odfesqlodbc/connection.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/odfesqlodbc/connection.c b/src/odfesqlodbc/connection.c index d201aafe5..b76fe6580 100644 --- a/src/odfesqlodbc/connection.c +++ b/src/odfesqlodbc/connection.c @@ -637,7 +637,6 @@ int CC_get_error(ConnectionClass *self, int *number, char **message) { void CC_log_error(const char *func, const char *desc, const ConnectionClass *self) { #define NULLCHECK(a) (a ? a : "(NULL)") - printf("Error: '%s'", NULLCHECK(self->__error_message)); if (self) { MYLOG(LOG_ERROR, From ba2ace8d3150b082d1e433efc5363d3082d904a7 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 23:25:34 -0700 Subject: [PATCH 43/58] [1] Updates to debug issue --- src/installer/CMakeLists.txt | 2 +- src/odfesqlodbc/misc.c | 4 +++- src/odfesqlodbc/mylog.c | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/installer/CMakeLists.txt b/src/installer/CMakeLists.txt index 82ebb8d5e..6e5ca84d4 100644 --- a/src/installer/CMakeLists.txt +++ b/src/installer/CMakeLists.txt @@ -111,9 +111,9 @@ else() set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) elseif(INSTALLER_TYPE STREQUAL "RPM") set(CPACK_GENERATOR RPM) + set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) set(CPACK_RPM_COMPONENT_INSTALL ON) set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") - set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}) set(CPACK_TEMPORARY_PACKAGE_FILE_NAME "${CMAKE_BINARY_DIR}/_CPack_Packages/Linux/RPM/RPMS/${CMAKE_SYSTEM_PROCESSOR}/${CPACK_PACKAGE_FILE_NAME}.rpm") if (BITNESS EQUAL 32) diff --git a/src/odfesqlodbc/misc.c b/src/odfesqlodbc/misc.c index b8d8560d6..9736fb145 100644 --- a/src/odfesqlodbc/misc.c +++ b/src/odfesqlodbc/misc.c @@ -75,8 +75,10 @@ size_t strncpy_null(char *dst, const char *src, ssize_t len) { int i; if (NULL != dst && len > 0) { - for (i = 0; src[i] && i < len - 1; i++) + for (i = 0; src[i] && i < len - 1; i++) { dst[i] = src[i]; + printf("copying\n"); + } dst[i] = '\0'; } else diff --git a/src/odfesqlodbc/mylog.c b/src/odfesqlodbc/mylog.c index 8ce4b2c00..dcdb67a84 100644 --- a/src/odfesqlodbc/mylog.c +++ b/src/odfesqlodbc/mylog.c @@ -143,6 +143,7 @@ const char *GetExeProgramName() { for (i = 0; i < sizeof(flist) / sizeof(flist[0]); i++) { if (readlink(flist[i], path_name, sizeof(path_name)) > 0) { + printf("Found path: '%s'\n". path_name); /* fprintf(stderr, "i=%d pathname=%s\n", i, path_name); */ STRCPY_FIXED(exename, po_basename(path_name)); break; From 5adf202c137c81643bbc9185ff53e87838e34821 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 23:26:36 -0700 Subject: [PATCH 44/58] no message --- src/odfesqlodbc/mylog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/odfesqlodbc/mylog.c b/src/odfesqlodbc/mylog.c index dcdb67a84..cbbc3a04f 100644 --- a/src/odfesqlodbc/mylog.c +++ b/src/odfesqlodbc/mylog.c @@ -143,7 +143,7 @@ const char *GetExeProgramName() { for (i = 0; i < sizeof(flist) / sizeof(flist[0]); i++) { if (readlink(flist[i], path_name, sizeof(path_name)) > 0) { - printf("Found path: '%s'\n". path_name); + printf("Found path: '%s'\n", path_name); /* fprintf(stderr, "i=%d pathname=%s\n", i, path_name); */ STRCPY_FIXED(exename, po_basename(path_name)); break; From d93ce28e10b4e1a0a7baefd95d33cac970850ea1 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 23:30:47 -0700 Subject: [PATCH 45/58] no message --- src/odfesqlodbc/mylog.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/odfesqlodbc/mylog.c b/src/odfesqlodbc/mylog.c index cbbc3a04f..182195d2b 100644 --- a/src/odfesqlodbc/mylog.c +++ b/src/odfesqlodbc/mylog.c @@ -140,15 +140,23 @@ const char *GetExeProgramName() { "/proc/curproc/exe"}; unsigned long i; char path_name[256]; - + bool path_found = false; + printf("Attempting to find exe name.\n"); for (i = 0; i < sizeof(flist) / sizeof(flist[0]); i++) { + printf("Attempting.\n"); if (readlink(flist[i], path_name, sizeof(path_name)) > 0) { printf("Found path: '%s'\n", path_name); /* fprintf(stderr, "i=%d pathname=%s\n", i, path_name); */ STRCPY_FIXED(exename, po_basename(path_name)); + path_found = true; break; } } + + if (!path_found) { + strcpy(exename, "unable-to-determine-exe-name"); + printf("Failed to find executable name\n"); + } #endif /* WIN32 */ for (p = (UCHAR *)exename; '\0' != *p; p++) { if (isalnum(*p)) From 8873ed0f0660e7745890674e1e5a18e853b826fe Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 23:32:07 -0700 Subject: [PATCH 46/58] no message --- src/odfesqlodbc/mylog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/odfesqlodbc/mylog.c b/src/odfesqlodbc/mylog.c index 182195d2b..30a6e6c73 100644 --- a/src/odfesqlodbc/mylog.c +++ b/src/odfesqlodbc/mylog.c @@ -140,7 +140,7 @@ const char *GetExeProgramName() { "/proc/curproc/exe"}; unsigned long i; char path_name[256]; - bool path_found = false; + int path_found = 0; printf("Attempting to find exe name.\n"); for (i = 0; i < sizeof(flist) / sizeof(flist[0]); i++) { printf("Attempting.\n"); @@ -148,12 +148,12 @@ const char *GetExeProgramName() { printf("Found path: '%s'\n", path_name); /* fprintf(stderr, "i=%d pathname=%s\n", i, path_name); */ STRCPY_FIXED(exename, po_basename(path_name)); - path_found = true; + path_found = 1; break; } } - if (!path_found) { + if (path_found == 0) { strcpy(exename, "unable-to-determine-exe-name"); printf("Failed to find executable name\n"); } From f5da27491eef26ff568ebe3ad36ff38077cbfc6d Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 23:35:16 -0700 Subject: [PATCH 47/58] no message --- src/odfesqlodbc/misc.c | 2 +- src/odfesqlodbc/mylog.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/odfesqlodbc/misc.c b/src/odfesqlodbc/misc.c index 9736fb145..5fd897ff7 100644 --- a/src/odfesqlodbc/misc.c +++ b/src/odfesqlodbc/misc.c @@ -77,7 +77,7 @@ size_t strncpy_null(char *dst, const char *src, ssize_t len) { if (NULL != dst && len > 0) { for (i = 0; src[i] && i < len - 1; i++) { dst[i] = src[i]; - printf("copying\n"); + printf("copying i=%d, len=%d\n", i, (int)len); } dst[i] = '\0'; diff --git a/src/odfesqlodbc/mylog.c b/src/odfesqlodbc/mylog.c index 30a6e6c73..c0f24f50a 100644 --- a/src/odfesqlodbc/mylog.c +++ b/src/odfesqlodbc/mylog.c @@ -214,6 +214,7 @@ const char *po_basename(const char *path) { if (p = strrchr(path, DIRSEPARATOR[0]), NULL != p) return p + 1; + printf("output path: %s\n", path) return path; } From 2158bccc79a38eacbef91fd20414eeb82401f4bd Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 23:36:11 -0700 Subject: [PATCH 48/58] no message --- src/odfesqlodbc/mylog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/odfesqlodbc/mylog.c b/src/odfesqlodbc/mylog.c index c0f24f50a..5b81a9336 100644 --- a/src/odfesqlodbc/mylog.c +++ b/src/odfesqlodbc/mylog.c @@ -214,7 +214,7 @@ const char *po_basename(const char *path) { if (p = strrchr(path, DIRSEPARATOR[0]), NULL != p) return p + 1; - printf("output path: %s\n", path) + printf("output path: %s\n", path); return path; } From d0bd5a2426d7cfd9d745e512d7a7e5c160e22a57 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 23:42:45 -0700 Subject: [PATCH 49/58] no message --- src/odfesqlodbc/misc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/odfesqlodbc/misc.c b/src/odfesqlodbc/misc.c index 5fd897ff7..af899655c 100644 --- a/src/odfesqlodbc/misc.c +++ b/src/odfesqlodbc/misc.c @@ -85,6 +85,7 @@ size_t strncpy_null(char *dst, const char *src, ssize_t len) { return 0; if (src[i]) return strlen(src); + printf("Output: '%s'\n"); return i; } From a6e82536d802eb27dc1f5c4f331ba20dc5e86bef Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 23:44:04 -0700 Subject: [PATCH 50/58] no message --- src/odfesqlodbc/misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/odfesqlodbc/misc.c b/src/odfesqlodbc/misc.c index af899655c..5bc60b503 100644 --- a/src/odfesqlodbc/misc.c +++ b/src/odfesqlodbc/misc.c @@ -85,7 +85,8 @@ size_t strncpy_null(char *dst, const char *src, ssize_t len) { return 0; if (src[i]) return strlen(src); - printf("Output: '%s'\n"); + printf("Output: '%s'\n", dst); + printf("Input: '%s'\n", src); return i; } From cead46f21d5e2a96ac9525700cc7f8541e667b00 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 23:48:49 -0700 Subject: [PATCH 51/58] final test --- src/odfesqlodbc/driver_connect.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/odfesqlodbc/driver_connect.cpp b/src/odfesqlodbc/driver_connect.cpp index 99fd3ee60..bb7257e22 100644 --- a/src/odfesqlodbc/driver_connect.cpp +++ b/src/odfesqlodbc/driver_connect.cpp @@ -219,6 +219,7 @@ RETCODE ESAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, CSTR func = "ESAPI_DriverConnect"; ConnectionClass *conn = (ConnectionClass *)hdbc; + printf("Connection string: '%s'\n", (char*)conn_str_in); if (!conn) { CC_log_error(func, "ConnectionClass handle is NULL", NULL); return SQL_INVALID_HANDLE; From 28659b994298613ff73e74ae13e115394517ffe8 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Mon, 5 Jul 2021 23:59:12 -0700 Subject: [PATCH 52/58] [1] Bug fixes. --- src/odfesqlodbc/driver_connect.cpp | 3 +++ tools/ODBCcli/client.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/odfesqlodbc/driver_connect.cpp b/src/odfesqlodbc/driver_connect.cpp index bb7257e22..c1c960d8f 100644 --- a/src/odfesqlodbc/driver_connect.cpp +++ b/src/odfesqlodbc/driver_connect.cpp @@ -86,6 +86,9 @@ static RETCODE GetRequirementsAndConnect(const SQLUSMALLINT driver_completion, return SQL_ERROR; } ret_val = CC_connect(conn); + if (ret_val <= 0) + return SQL_ERROR; + return SQL_SUCCESS; } diff --git a/tools/ODBCcli/client.h b/tools/ODBCcli/client.h index 1781b2b22..9f59fa8ba 100644 --- a/tools/ODBCcli/client.h +++ b/tools/ODBCcli/client.h @@ -3,6 +3,9 @@ #ifdef WIN32 +// Add UNICODE_SUPPORT so driver properly encodes characters. +#define UNICODE_SUPPORT + #include #include #include From 8796be11626c8c05aff75938df5a556b74eb6b1f Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Tue, 6 Jul 2021 00:12:53 -0700 Subject: [PATCH 53/58] [1] Removing printf spam. [2] Fixing other issues --- src/odfesqlodbc/connection.cpp | 2 +- src/odfesqlodbc/driver_connect.cpp | 1 - src/odfesqlodbc/misc.c | 6 +----- src/odfesqlodbc/mylog.c | 11 ----------- tools/ODBCcli/README.md | 2 +- tools/ODBCcli/client.h | 4 ++-- 6 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/odfesqlodbc/connection.cpp b/src/odfesqlodbc/connection.cpp index 1c4e1e5e3..b5399207e 100644 --- a/src/odfesqlodbc/connection.cpp +++ b/src/odfesqlodbc/connection.cpp @@ -111,7 +111,7 @@ char CC_connect(ConnectionClass *self) { if (!SQL_SUCCEEDED( CC_send_client_encoding(self, self->locale_encoding))) { throw std::runtime_error("Cannot set " + std::string(self->locale_encoding) - + " as client encoding"); + + " as client encoding. #define UNICODE_SUPPORT to enable UTF8."); } } diff --git a/src/odfesqlodbc/driver_connect.cpp b/src/odfesqlodbc/driver_connect.cpp index c1c960d8f..99aa838b5 100644 --- a/src/odfesqlodbc/driver_connect.cpp +++ b/src/odfesqlodbc/driver_connect.cpp @@ -222,7 +222,6 @@ RETCODE ESAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, CSTR func = "ESAPI_DriverConnect"; ConnectionClass *conn = (ConnectionClass *)hdbc; - printf("Connection string: '%s'\n", (char*)conn_str_in); if (!conn) { CC_log_error(func, "ConnectionClass handle is NULL", NULL); return SQL_INVALID_HANDLE; diff --git a/src/odfesqlodbc/misc.c b/src/odfesqlodbc/misc.c index 5bc60b503..b8d8560d6 100644 --- a/src/odfesqlodbc/misc.c +++ b/src/odfesqlodbc/misc.c @@ -75,18 +75,14 @@ size_t strncpy_null(char *dst, const char *src, ssize_t len) { int i; if (NULL != dst && len > 0) { - for (i = 0; src[i] && i < len - 1; i++) { + for (i = 0; src[i] && i < len - 1; i++) dst[i] = src[i]; - printf("copying i=%d, len=%d\n", i, (int)len); - } dst[i] = '\0'; } else return 0; if (src[i]) return strlen(src); - printf("Output: '%s'\n", dst); - printf("Input: '%s'\n", src); return i; } diff --git a/src/odfesqlodbc/mylog.c b/src/odfesqlodbc/mylog.c index 5b81a9336..b55226fea 100644 --- a/src/odfesqlodbc/mylog.c +++ b/src/odfesqlodbc/mylog.c @@ -140,23 +140,13 @@ const char *GetExeProgramName() { "/proc/curproc/exe"}; unsigned long i; char path_name[256]; - int path_found = 0; - printf("Attempting to find exe name.\n"); for (i = 0; i < sizeof(flist) / sizeof(flist[0]); i++) { - printf("Attempting.\n"); if (readlink(flist[i], path_name, sizeof(path_name)) > 0) { - printf("Found path: '%s'\n", path_name); /* fprintf(stderr, "i=%d pathname=%s\n", i, path_name); */ STRCPY_FIXED(exename, po_basename(path_name)); - path_found = 1; break; } } - - if (path_found == 0) { - strcpy(exename, "unable-to-determine-exe-name"); - printf("Failed to find executable name\n"); - } #endif /* WIN32 */ for (p = (UCHAR *)exename; '\0' != *p; p++) { if (isalnum(*p)) @@ -214,7 +204,6 @@ const char *po_basename(const char *path) { if (p = strrchr(path, DIRSEPARATOR[0]), NULL != p) return p + 1; - printf("output path: %s\n", path); return path; } diff --git a/tools/ODBCcli/README.md b/tools/ODBCcli/README.md index feac67d43..ca3ccad36 100644 --- a/tools/ODBCcli/README.md +++ b/tools/ODBCcli/README.md @@ -46,5 +46,5 @@ On macOS or Linux: ``` For example: ``` -ODBCcli "DSN=timestream-aws-profile" "SELECT * FROM CLIExample.ExampleTable LIMIT 1" +./ODBCcli "DSN=timestream-aws-profile" "SELECT * FROM CLIExample.ExampleTable LIMIT 1" ``` \ No newline at end of file diff --git a/tools/ODBCcli/client.h b/tools/ODBCcli/client.h index 9f59fa8ba..126ed2a7b 100644 --- a/tools/ODBCcli/client.h +++ b/tools/ODBCcli/client.h @@ -1,11 +1,11 @@ #ifndef ODBCCLI_CLIENT_H #define ODBCCLI_CLIENT_H -#ifdef WIN32 - // Add UNICODE_SUPPORT so driver properly encodes characters. #define UNICODE_SUPPORT +#ifdef WIN32 + #include #include #include From 0e449901ffd34ff1cd5279a74f8135ed2b840c68 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Tue, 6 Jul 2021 00:32:59 -0700 Subject: [PATCH 54/58] [1] Fixed encoding. --- src/odfesqlodbc/connection.cpp | 4 ++-- src/odfesqlodbc/driver_connect.cpp | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/odfesqlodbc/connection.cpp b/src/odfesqlodbc/connection.cpp index b5399207e..5b4642159 100644 --- a/src/odfesqlodbc/connection.cpp +++ b/src/odfesqlodbc/connection.cpp @@ -111,7 +111,7 @@ char CC_connect(ConnectionClass *self) { if (!SQL_SUCCEEDED( CC_send_client_encoding(self, self->locale_encoding))) { throw std::runtime_error("Cannot set " + std::string(self->locale_encoding) - + " as client encoding. #define UNICODE_SUPPORT to enable UTF8."); + + " as client encoding."); } } @@ -149,7 +149,7 @@ void CC_determine_locale_encoding(ConnectionClass *self) { // Get current db encoding and derive the locale encoding // TODO #34 - Investigate locale - CC_set_locale_encoding(self, "SQL_ASCII"); + CC_set_locale_encoding(self, "UTF8"); } int CC_send_client_encoding(ConnectionClass *self, const char *encoding) { diff --git a/src/odfesqlodbc/driver_connect.cpp b/src/odfesqlodbc/driver_connect.cpp index 99aa838b5..30b9c1d72 100644 --- a/src/odfesqlodbc/driver_connect.cpp +++ b/src/odfesqlodbc/driver_connect.cpp @@ -86,8 +86,6 @@ static RETCODE GetRequirementsAndConnect(const SQLUSMALLINT driver_completion, return SQL_ERROR; } ret_val = CC_connect(conn); - if (ret_val <= 0) - return SQL_ERROR; return SQL_SUCCESS; } From 0fdc6111d9793b1fb8e5ee6961a6d51639f666ce Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Tue, 6 Jul 2021 00:47:17 -0700 Subject: [PATCH 55/58] [1] Fixing query --- .github/workflows/linux-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 76a18ce60..888086edb 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -156,7 +156,7 @@ jobs: cd build cmake ../ -DCMAKE_BUILD_TYPE=Release make -j 4 - ./ODBCcli "DSN=timestream-aws-profile" "* FROM ODBCTest.IoT LIMIT 1" + ./ODBCcli "DSN=timestream-aws-profile" "SELECT * FROM ODBCTest.IoT LIMIT 1" build-linux32: runs-on: ubuntu-latest steps: From 52884fc72c9c0f9d03b6d5d4246675705846a9a2 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Tue, 6 Jul 2021 00:55:15 -0700 Subject: [PATCH 56/58] [1] Fixing bitwise manips [2] Removing sample app from build script because it now works properly. --- .github/workflows/linux-build.yml | 3 --- src/odfesqlodbc/win_unicode.c | 14 +++++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 888086edb..48d7c966f 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -110,14 +110,12 @@ jobs: cd .. - name: build-deb-installer if: success() - # TODO: Remove deb install. Temporarily adding so I can test sample application run: | ./build_linux_release64_deb.sh cd cmake-build64 cmake ../src make -j4 cpack . - sudo dpkg -i amazontimestreamodbcdriver64-bit0.3.2_0.3.2_amd64.deb cd .. - name: create-output if: success() @@ -156,7 +154,6 @@ jobs: cd build cmake ../ -DCMAKE_BUILD_TYPE=Release make -j 4 - ./ODBCcli "DSN=timestream-aws-profile" "SELECT * FROM ODBCTest.IoT LIMIT 1" build-linux32: runs-on: ubuntu-latest steps: diff --git a/src/odfesqlodbc/win_unicode.c b/src/odfesqlodbc/win_unicode.c index 904febc4a..b153e6f24 100644 --- a/src/odfesqlodbc/win_unicode.c +++ b/src/odfesqlodbc/win_unicode.c @@ -164,7 +164,7 @@ char *ucs2_to_utf8(const SQLWCHAR *ucs2str, SQLLEN ilen, SQLLEN *olen, memcpy(utf8str + len, (char *)&byte2code, sizeof(byte2code)); else { - utf8str[len] = (char)((byte2code >> 8) && 0xFF); + utf8str[len] = (char)((byte2code >> 8) & 0xFF); utf8str[len + 1] = (char)(byte2code & 0xFF); } len += sizeof(byte2code); @@ -184,9 +184,9 @@ char *ucs2_to_utf8(const SQLWCHAR *ucs2str, SQLLEN ilen, SQLLEN *olen, memcpy(utf8str + len, (char *)&byte4code, sizeof(byte4code)); else { - utf8str[len] = (char)((byte4code >> 24) && 0xFF); - utf8str[len + 1] = (char)((byte4code >> 16) && 0xFF); - utf8str[len + 2] = (char)((byte4code >> 8) && 0xFF); + utf8str[len] = (char)((byte4code >> 24) & 0xFF); + utf8str[len + 1] = (char)((byte4code >> 16) & 0xFF); + utf8str[len + 2] = (char)((byte4code >> 8) & 0xFF); utf8str[len + 3] = (char)(byte4code & 0xFF); } len += sizeof(byte4code); @@ -197,9 +197,9 @@ char *ucs2_to_utf8(const SQLWCHAR *ucs2str, SQLLEN ilen, SQLLEN *olen, if (little_endian) memcpy(utf8str + len, (char *)&byte4code, 3); else { - utf8str[len] = (char)((byte4code >> 16) && 0xFF); - utf8str[len + 1] = (char)((byte4code >> 8) && 0xFF); - utf8str[len + 2] = (char)((byte4code) && 0xFF); + utf8str[len] = (char)((byte4code >> 16) & 0xFF); + utf8str[len + 1] = (char)((byte4code >> 8) & 0xFF); + utf8str[len + 2] = (char)((byte4code) & 0xFF); } len += 3; } From a14e6e6afbea18162ce94983506bc842c472f1cf Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Tue, 6 Jul 2021 01:00:13 -0700 Subject: [PATCH 57/58] [1] Meant to remove this in the last commit.. --- .github/workflows/linux-build.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 48d7c966f..566769fd7 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -146,14 +146,6 @@ jobs: with: name: linux64-deb-installer path: deb-installer - - name: build-and-test-sample-application - if: success() - run: | - cd tools/ODBCcli - mkdir build - cd build - cmake ../ -DCMAKE_BUILD_TYPE=Release - make -j 4 build-linux32: runs-on: ubuntu-latest steps: From 3b33f334a40272e84327822b31f1c87e5c54a5c9 Mon Sep 17 00:00:00 2001 From: Lyndon Bauto Date: Tue, 6 Jul 2021 11:53:14 -0700 Subject: [PATCH 58/58] [1] Minor fixes for CR. --- src/installer/CMakeLists.txt | 2 +- src/odfesqlodbc/driver_connect.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/installer/CMakeLists.txt b/src/installer/CMakeLists.txt index 6e5ca84d4..da9dcb501 100644 --- a/src/installer/CMakeLists.txt +++ b/src/installer/CMakeLists.txt @@ -22,7 +22,7 @@ set(CMAKE_INSTALL_PREFIX ${INSTALL_ROOT}) set(CPACK_PACKAGE_VERSION "${DRIVER_PACKAGE_VERSION}") if(APPLE) set(CPACK_PACKAGE_FILE_NAME "AmazonTimestreamODBC-${CPACK_PACKAGE_VERSION}") - set(CPACK_PACKAGE_NAME "Amazon Timestream ODBC Driver ${BITNESS}-bit ${CPACK_PACKAGE_VERSION}") + set(CPACK_PACKAGE_NAME "Amazon Timestream ODBC Driver ${CPACK_PACKAGE_VERSION}") elseif(UNIX) set(CPACK_PACKAGE_FILE_NAME "AmazonTimestreamODBC${BITNESS}-${CPACK_PACKAGE_VERSION}") if (INSTALLER_TYPE STREQUAL "DEB") diff --git a/src/odfesqlodbc/driver_connect.cpp b/src/odfesqlodbc/driver_connect.cpp index 30b9c1d72..99fd3ee60 100644 --- a/src/odfesqlodbc/driver_connect.cpp +++ b/src/odfesqlodbc/driver_connect.cpp @@ -86,7 +86,6 @@ static RETCODE GetRequirementsAndConnect(const SQLUSMALLINT driver_completion, return SQL_ERROR; } ret_val = CC_connect(conn); - return SQL_SUCCESS; }