From 13c022ac4249110d58332d25803437f32cf01978 Mon Sep 17 00:00:00 2001 From: Chen Dai <46505291+dai-chen@users.noreply.github.com> Date: Fri, 16 Apr 2021 17:11:10 -0700 Subject: [PATCH] OpenSearch migration for ODBC driver (#7) * Rename Elasticsearch * Bump plugin version to 1.15 * Rename es_api30 * Rename es_apifunc * Rename es_communication * Rename es_connection * Fix connection.c * Rename es_driver_connect and es_semaphore * Rename es_helper * Fix test and rename es_info * Rename es_parse_result * Rename es_statement * Rename es_result_queue * Rename es_utility * Rename es_types * Rename es_odbc * Fix mylog * Fix header and rename ESLogLevel * Rename es_result * Rename esNAME, esconn * Rename estype_ functions * Rename eserror * Rename more variables and functions * Rename more variables and functions * Fix error and rename ESAPI_ * Fix error * Fix error * Fix error * More renaming * Fix elasticenlist error * Replace Kibana * Fix links to old repo * Fix plugin name in github action * Change plugin name to OpenSearch * Replace all other ODFE and links * Revert release notes --- .../workflows/sql-odbc-release-workflow.yml | 12 +- .../sql-odbc-rename-and-release-workflow.yml | 14 +- sql-odbc/CONTRIBUTING.md | 2 +- sql-odbc/README.md | 22 +- sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md | 8 +- sql-odbc/docs/dev/Pagination.md | 8 +- ...pensearch_dashboards_sample_data_types.md} | 8 +- .../example_config_files/example_tdc_file.tdc | 2 +- .../{elasticsearch.yml => opensearch.yml} | 0 .../{kibana.yml => opensearch_dashboards.yml} | 6 +- sql-odbc/docs/dev/run_tests.md | 14 +- .../sequence_diagrams/SQLDriverConnect.txt | 6 +- .../dev/sequence_diagrams/SQLExecDirect.txt | 6 +- sql-odbc/docs/dev/sign_installers.md | 8 +- sql-odbc/docs/test/excel_connection.md | 8 +- sql-odbc/docs/test/exporting_csv_files.md | 4 +- .../docs/test/microsoft_query_connection.md | 2 +- sql-odbc/docs/test/query_wizard_connection.md | 4 +- sql-odbc/docs/test/refresh_data.md | 4 +- sql-odbc/docs/user/configuration_options.md | 2 +- sql-odbc/docs/user/mac_configure_dsn.md | 4 +- sql-odbc/docs/user/microsoft_excel_support.md | 10 +- .../docs/user/microsoft_excel_support_mac.md | 8 +- .../docs/user/power_bi_service_support.md | 6 +- sql-odbc/docs/user/power_bi_support.md | 12 +- sql-odbc/docs/user/tableau_support.md | 8 +- ...distro-elasticsearch-odbc.release-notes.md | 2 +- sql-odbc/src/CMakeLists.txt | 8 +- .../ITODBCAwsAuth/test_aws_auth_dsn.reg | 6 +- .../ITODBCAwsAuth/test_odbc.ini | 2 +- .../ITODBCAwsAuth/test_odbc_aws_auth.cpp | 6 +- .../ITODBCAwsAuth/test_odbcinst.ini | 4 +- .../ITODBCCatalog/test_odbc_catalog.cpp | 44 +- .../ITODBCConnection/test_dsn.reg | 6 +- .../ITODBCConnection/test_odbc.ini | 2 +- .../ITODBCConnection/test_odbc_connection.cpp | 44 +- .../ITODBCConnection/test_odbcinst.ini | 9 +- .../test_odbc_descriptors.cpp | 8 +- .../ITODBCExecution/test_odbc_execution.cpp | 14 +- .../ITODBCHelper/it_odbc_helper.h | 2 +- .../ITODBCInfo/test_odbc_info.cpp | 4 +- .../ITODBCPagination/test_odbc_pagination.cpp | 12 +- .../ITODBCResults/test_odbc_results.cpp | 4 +- .../ITODBCTableauQueries/queries_all.txt | 432 +++++------ .../performance_odbc_execution.cpp | 4 +- .../PTODBCInfo/performance_odbc_info.cpp | 12 +- .../performance_odbc_results.cpp | 2 +- .../OdfeSqlOdbcPBIConnector.pq | 6 +- sql-odbc/src/PowerBIConnector/resources.resx | 6 +- .../TableauConnector/odfe_sql_odbc/README.md | 2 +- .../odfe_sql_odbc/manifest.xml | 8 +- .../odfe_sql_odbc_dev/manifest.xml | 10 +- sql-odbc/src/UnitTests/UTConn/test_conn.cpp | 36 +- .../UnitTests/UTConn/test_query_execution.cpp | 47 +- .../test_critical_section.cpp | 2 +- .../src/UnitTests/UTRabbit/test_rabbit.cpp | 4 +- sql-odbc/src/installer/CMakeLists.txt | 10 +- sql-odbc/src/installer/Resources/README.txt | 8 +- sql-odbc/src/installer/Resources/Welcome.txt | 2 +- .../src/installer/Resources/odfe_sql_odbc.tdc | 2 +- sql-odbc/src/odfeenlist/CMakeLists.txt | 2 +- sql-odbc/src/odfeenlist/msdtc_enlist.cpp | 6 +- .../{elasticenlist.h => opensearch_enlist.h} | 14 +- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 24 +- sql-odbc/src/odfesqlodbc/bind.c | 78 +- sql-odbc/src/odfesqlodbc/bind.h | 16 +- sql-odbc/src/odfesqlodbc/catfunc.h | 2 +- sql-odbc/src/odfesqlodbc/columninfo.c | 9 +- sql-odbc/src/odfesqlodbc/columninfo.h | 4 +- sql-odbc/src/odfesqlodbc/connection.c | 106 +-- sql-odbc/src/odfesqlodbc/convert.c | 198 ++--- sql-odbc/src/odfesqlodbc/convert.h | 4 +- sql-odbc/src/odfesqlodbc/descriptor.c | 70 +- sql-odbc/src/odfesqlodbc/descriptor.h | 28 +- sql-odbc/src/odfesqlodbc/dlg_specific.c | 28 +- sql-odbc/src/odfesqlodbc/dlg_specific.h | 10 +- sql-odbc/src/odfesqlodbc/dlg_wingui.c | 24 +- sql-odbc/src/odfesqlodbc/drvconn.c | 26 +- sql-odbc/src/odfesqlodbc/drvconn.h | 6 +- sql-odbc/src/odfesqlodbc/environ.c | 128 +-- sql-odbc/src/odfesqlodbc/environ.h | 4 +- sql-odbc/src/odfesqlodbc/es_helper.h | 55 -- sql-odbc/src/odfesqlodbc/execute.c | 22 +- sql-odbc/src/odfesqlodbc/info.c | 400 +++++----- sql-odbc/src/odfesqlodbc/loadlib.c | 68 +- sql-odbc/src/odfesqlodbc/loadlib.h | 4 +- sql-odbc/src/odfesqlodbc/misc.c | 8 +- sql-odbc/src/odfesqlodbc/misc.h | 2 +- sql-odbc/src/odfesqlodbc/multibyte.c | 28 +- sql-odbc/src/odfesqlodbc/multibyte.h | 6 +- sql-odbc/src/odfesqlodbc/mylog.c | 36 +- sql-odbc/src/odfesqlodbc/mylog.h | 28 +- sql-odbc/src/odfesqlodbc/odbcapi.c | 208 ++--- sql-odbc/src/odfesqlodbc/odbcapi30.c | 96 +-- sql-odbc/src/odfesqlodbc/odbcapi30w.c | 58 +- sql-odbc/src/odfesqlodbc/odbcapiw.c | 118 +-- .../{es_api30.c => opensearch_api30.c} | 126 +-- .../{es_apifunc.h => opensearch_apifunc.h} | 123 +-- ...ation.cpp => opensearch_communication.cpp} | 214 ++--- ...unication.h => opensearch_communication.h} | 29 +- ...nnection.cpp => opensearch_connection.cpp} | 58 +- ...s_connection.h => opensearch_connection.h} | 62 +- ...nect.cpp => opensearch_driver_connect.cpp} | 16 +- ..._connect.h => opensearch_driver_connect.h} | 10 +- .../{es_helper.cpp => opensearch_helper.cpp} | 88 ++- sql-odbc/src/odfesqlodbc/opensearch_helper.h | 55 ++ .../{es_info.cpp => opensearch_info.cpp} | 248 +++--- .../{es_info.h => opensearch_info.h} | 22 +- .../{es_odbc.c => opensearch_odbc.c} | 7 +- .../{es_odbc.h => opensearch_odbc.h} | 60 +- .../{es_odbc.rc => opensearch_odbc.rc} | 16 +- ...result.cpp => opensearch_parse_result.cpp} | 178 +++-- ...rse_result.h => opensearch_parse_result.h} | 23 +- ..._queue.cpp => opensearch_result_queue.cpp} | 14 +- ...sult_queue.h => opensearch_result_queue.h} | 27 +- ...semaphore.cpp => opensearch_semaphore.cpp} | 12 +- ...{es_semaphore.h => opensearch_semaphore.h} | 10 +- ...statement.cpp => opensearch_statement.cpp} | 71 +- ...{es_statement.h => opensearch_statement.h} | 10 +- .../{es_types.c => opensearch_types.c} | 728 +++++++++--------- .../{es_types.h => opensearch_types.h} | 242 +++--- ...{es_utility.cpp => opensearch_utility.cpp} | 28 +- .../{es_utility.h => opensearch_utility.h} | 22 +- sql-odbc/src/odfesqlodbc/options.c | 66 +- sql-odbc/src/odfesqlodbc/parse.c | 22 +- sql-odbc/src/odfesqlodbc/qresult.c | 40 +- sql-odbc/src/odfesqlodbc/qresult.h | 14 +- sql-odbc/src/odfesqlodbc/resource.h | 2 +- sql-odbc/src/odfesqlodbc/results.c | 287 +++---- sql-odbc/src/odfesqlodbc/setup.c | 14 +- sql-odbc/src/odfesqlodbc/statement.c | 209 ++--- sql-odbc/src/odfesqlodbc/statement.h | 14 +- sql-odbc/src/odfesqlodbc/tuple.h | 6 +- sql-odbc/src/odfesqlodbc/unicode_support.h | 2 +- sql-odbc/src/odfesqlodbc/version.h | 18 +- sql-odbc/src/odfesqlodbc/win_unicode.c | 86 +-- 136 files changed, 3133 insertions(+), 3028 deletions(-) rename sql-odbc/docs/dev/datasets/{kibana_sample_data_types.md => opensearch_dashboards_sample_data_types.md} (89%) rename sql-odbc/docs/dev/example_config_files/{elasticsearch.yml => opensearch.yml} (100%) rename sql-odbc/docs/dev/example_config_files/{kibana.yml => opensearch_dashboards.yml} (51%) rename sql-odbc/src/odfeenlist/{elasticenlist.h => opensearch_enlist.h} (80%) delete mode 100644 sql-odbc/src/odfesqlodbc/es_helper.h rename sql-odbc/src/odfesqlodbc/{es_api30.c => opensearch_api30.c} (93%) rename sql-odbc/src/odfesqlodbc/{es_apifunc.h => opensearch_apifunc.h} (70%) rename sql-odbc/src/odfesqlodbc/{es_communication.cpp => opensearch_communication.cpp} (81%) rename sql-odbc/src/odfesqlodbc/{es_communication.h => opensearch_communication.h} (84%) rename sql-odbc/src/odfesqlodbc/{es_connection.cpp => opensearch_connection.cpp} (75%) rename sql-odbc/src/odfesqlodbc/{es_connection.h => opensearch_connection.h} (92%) rename sql-odbc/src/odfesqlodbc/{es_driver_connect.cpp => opensearch_driver_connect.cpp} (95%) rename sql-odbc/src/odfesqlodbc/{es_driver_connect.h => opensearch_driver_connect.h} (79%) rename sql-odbc/src/odfesqlodbc/{es_helper.cpp => opensearch_helper.cpp} (64%) create mode 100644 sql-odbc/src/odfesqlodbc/opensearch_helper.h rename sql-odbc/src/odfesqlodbc/{es_info.cpp => opensearch_info.cpp} (82%) rename sql-odbc/src/odfesqlodbc/{es_info.h => opensearch_info.h} (78%) rename sql-odbc/src/odfesqlodbc/{es_odbc.c => opensearch_odbc.c} (96%) rename sql-odbc/src/odfesqlodbc/{es_odbc.h => opensearch_odbc.h} (93%) rename sql-odbc/src/odfesqlodbc/{es_odbc.rc => opensearch_odbc.rc} (94%) rename sql-odbc/src/odfesqlodbc/{es_parse_result.cpp => opensearch_parse_result.cpp} (67%) rename sql-odbc/src/odfesqlodbc/{es_parse_result.h => opensearch_parse_result.h} (57%) rename sql-odbc/src/odfesqlodbc/{es_result_queue.cpp => opensearch_result_queue.cpp} (78%) rename sql-odbc/src/odfesqlodbc/{es_result_queue.h => opensearch_result_queue.h} (59%) rename sql-odbc/src/odfesqlodbc/{es_semaphore.cpp => opensearch_semaphore.cpp} (88%) rename sql-odbc/src/odfesqlodbc/{es_semaphore.h => opensearch_semaphore.h} (84%) rename sql-odbc/src/odfesqlodbc/{es_statement.cpp => opensearch_statement.cpp} (83%) rename sql-odbc/src/odfesqlodbc/{es_statement.h => opensearch_statement.h} (84%) rename sql-odbc/src/odfesqlodbc/{es_types.c => opensearch_types.c} (65%) rename sql-odbc/src/odfesqlodbc/{es_types.h => opensearch_types.h} (57%) rename sql-odbc/src/odfesqlodbc/{es_utility.cpp => opensearch_utility.cpp} (78%) rename sql-odbc/src/odfesqlodbc/{es_utility.h => opensearch_utility.h} (58%) diff --git a/.github/workflows/sql-odbc-release-workflow.yml b/.github/workflows/sql-odbc-release-workflow.yml index fb0026b46f..160c65b2c0 100644 --- a/.github/workflows/sql-odbc-release-workflow.yml +++ b/.github/workflows/sql-odbc-release-workflow.yml @@ -1,5 +1,5 @@ name: Build and Release SQL-ODBC -# This workflow is triggered on creating tags to master or an opendistro release branch +# This workflow is triggered on creating tags to main or an opensearch release branch on: push: tags: @@ -11,8 +11,8 @@ env: ODBC_BIN_PATH: "./build/odbc/bin" ODBC_BUILD_PATH: "./build/odbc/build" AWS_SDK_INSTALL_PATH: "./build/aws-sdk/install" - PLUGIN_NAME: opendistro-sql-odbc - OD_VERSION: 1.13.0.0 + PLUGIN_NAME: opensearch-sql-odbc + OD_VERSION: 1.15.0.0 jobs: build-mac: @@ -82,7 +82,7 @@ jobs: run: | cd installer - pkg=`ls -1t *.pkg | grep "Open Distro for Elasticsearch SQL ODBC Driver" | head -1` + pkg=`ls -1t *.pkg | grep "OpenSearch SQL ODBC Driver" | head -1` mv "$pkg" "${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-macos-x64.pkg" pkg=`ls -1t *.pkg | grep "${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-macos-x64.pkg" | head -1` @@ -140,7 +140,7 @@ jobs: run: | cd ci-output/installer - msi=`ls -1t *.msi | grep "Open Distro for Elasticsearch SQL ODBC Driver" | head -1` + msi=`ls -1t *.msi | grep "OpenSearch SQL ODBC Driver" | head -1` mv "$msi" "${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-windows-x86.msi" msi=`ls -1t *.msi | grep "${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-windows-x86.msi" | head -1` @@ -198,7 +198,7 @@ jobs: run: | cd ci-output/installer - msi=`ls -1t *.msi | grep "Open Distro for Elasticsearch SQL ODBC Driver" | head -1` + msi=`ls -1t *.msi | grep "OpenSearch SQL ODBC Driver" | head -1` mv "$msi" "${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-windows-x64.msi" msi=`ls -1t *.msi | grep "${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-windows-x64.msi" | head -1` diff --git a/.github/workflows/sql-odbc-rename-and-release-workflow.yml b/.github/workflows/sql-odbc-rename-and-release-workflow.yml index 1ce207491c..23c9d1e82f 100644 --- a/.github/workflows/sql-odbc-rename-and-release-workflow.yml +++ b/.github/workflows/sql-odbc-rename-and-release-workflow.yml @@ -8,7 +8,7 @@ on: - rename* env: - OD_VERSION: 1.13.0.0 + OD_VERSION: 1.15.0.0 jobs: upload-odbc: @@ -27,8 +27,8 @@ jobs: run: | mkdir macos cd macos - aws s3 cp "s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-odbc/mac/Open Distro for Elasticsearch SQL ODBC Driver 64-bit-1.11.0.0-Darwin.pkg" "Open Distro for Elasticsearch SQL ODBC Driver 64-bit-${{ env.OD_VERSION }}-Darwin.pkg" - mac_installer=`ls -1t *.pkg | grep "Open Distro for Elasticsearch SQL ODBC Driver" | head -1` + aws s3 cp "s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-odbc/mac/OpenSearch SQL ODBC Driver 64-bit-1.11.0.0-Darwin.pkg" "OpenSearch SQL ODBC Driver 64-bit-${{ env.OD_VERSION }}-Darwin.pkg" + mac_installer=`ls -1t *.pkg | grep "OpenSearch SQL ODBC Driver" | head -1` echo $mac_installer aws s3 cp "$mac_installer" s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-odbc/mac/ cd .. @@ -37,8 +37,8 @@ jobs: run: | mkdir win32 cd win32 - aws s3 cp "s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-odbc/windows/Open Distro for Elasticsearch SQL ODBC Driver 32-bit-1.11.0.0-Windows.msi" "Open Distro for Elasticsearch SQL ODBC Driver 32-bit-${{ env.OD_VERSION }}-Windows.msi" - windows_installer=`ls -1t *.msi | grep "Open Distro for Elasticsearch SQL ODBC Driver" | head -1` + aws s3 cp "s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-odbc/windows/OpenSearch SQL ODBC Driver 32-bit-1.11.0.0-Windows.msi" "OpenSearch SQL ODBC Driver 32-bit-${{ env.OD_VERSION }}-Windows.msi" + windows_installer=`ls -1t *.msi | grep "OpenSearch SQL ODBC Driver" | head -1` echo $windows_installer aws s3 cp "$windows_installer" s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-odbc/windows/ cd .. @@ -47,8 +47,8 @@ jobs: run: | mkdir win64 cd win64 - aws s3 cp "s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-odbc/windows/Open Distro for Elasticsearch SQL ODBC Driver 64-bit-1.11.0.0-Windows.msi" "Open Distro for Elasticsearch SQL ODBC Driver 64-bit-${{ env.OD_VERSION }}-Windows.msi" - windows_installer=`ls -1t *.msi | grep "Open Distro for Elasticsearch SQL ODBC Driver" | head -1` + aws s3 cp "s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-odbc/windows/OpenSearch SQL ODBC Driver 64-bit-1.11.0.0-Windows.msi" "OpenSearch SQL ODBC Driver 64-bit-${{ env.OD_VERSION }}-Windows.msi" + windows_installer=`ls -1t *.msi | grep "OpenSearch SQL ODBC Driver" | head -1` echo $windows_installer aws s3 cp "$windows_installer" s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-odbc/windows/ diff --git a/sql-odbc/CONTRIBUTING.md b/sql-odbc/CONTRIBUTING.md index 2cc7222a5c..54744f61e5 100644 --- a/sql-odbc/CONTRIBUTING.md +++ b/sql-odbc/CONTRIBUTING.md @@ -56,6 +56,6 @@ If you discover a potential security issue in this project we ask that you notif ## Licensing -See the [LICENSE](https://github.com/opendistro-for-elasticsearch/sql/blob/master/sql-odbc/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. +See the [LICENSE](https://github.com/opensearch-project/sql/blob/main/sql-odbc/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes. diff --git a/sql-odbc/README.md b/sql-odbc/README.md index b5e1944935..8685044905 100644 --- a/sql-odbc/README.md +++ b/sql-odbc/README.md @@ -1,6 +1,6 @@ -# Open Distro for Elasticsearch ODBC Driver +# OpenSearch ODBC Driver -ElasticsearchODBC is a read-only ODBC driver for Windows and Mac for connecting to Open Distro for Elasticsearch SQL support. +OpenSearchODBC is a read-only ODBC driver for Windows and Mac for connecting to OpenSearch SQL support. ## Specifications @@ -25,25 +25,25 @@ You can use the installers generated as part of the most recent release. ### Windows -1. Run the `.msi` installer to install the Open Distro for Elasticsearch SQL ODBC Driver. +1. Run the `.msi` installer to install the OpenSearch SQL ODBC Driver. 2. [Test connection](./docs/user/windows_configure_dsn.md) using ODBC Data Source Administrator. To use the driver with Tableau: 1. Copy the `.tdc` file from `/resources` to `/Documents/My Tableau Repository/Datasources`. -This will customize the connection from Tableau to Open Distro for Elasticsearch, ensuring that the correct forms of queries are used. +This will customize the connection from Tableau to OpenSearch, ensuring that the correct forms of queries are used. ### Mac -iODBC Driver Manager should be installed before installing the Open Distro for Elasticsearch SQL ODBC Driver on Mac. +iODBC Driver Manager should be installed before installing the OpenSearch SQL ODBC Driver on Mac. -1. Run the `.pkg` installer to install the Open Distro for Elasticsearch SQL ODBC Driver. -2. Configure a Driver and DSN entry for the Open Distro for Elasticsearch SQL ODBC Driver, following the instructions [here](./docs/user/mac_configure_dsn.md). +1. Run the `.pkg` installer to install the OpenSearch SQL ODBC Driver. +2. Configure a Driver and DSN entry for the OpenSearch SQL ODBC Driver, following the instructions [here](./docs/user/mac_configure_dsn.md). To use the driver with Tableau: 1. Copy the `.tdc` file from `/resources` to `/Documents/My Tableau Repository/Datasources`. -This will customize the connection from Tableau to Open Distro for Elasticsearch, ensuring that the correct forms of queries are used. +This will customize the connection from Tableau to OpenSearch, ensuring that the correct forms of queries are used. ## Using the Driver @@ -51,7 +51,7 @@ The driver comes in the form of a library file: * Windows: `odfesqlodbc.dll` * Mac: `libodfesqlodbc.dylib` -If using with ODBC compatible BI tools, refer to the tool documentation on configuring a new ODBC driver. In most cases, you will need to make the tool aware of the location of the driver library file and then use it to setup Open Distro for Elasticsearch database connections. +If using with ODBC compatible BI tools, refer to the tool documentation on configuring a new ODBC driver. In most cases, you will need to make the tool aware of the location of the driver library file and then use it to setup OpenSearch database connections. ### Connection Strings and Configuring the Driver @@ -60,7 +60,7 @@ A list of options available for configuring driver behaviour is available [here] To setup a connection, the driver uses an ODBC connection string. Connection strings are semicolon-delimited strings specifying the set of options to use for a connection. Typically, a connection string will either: 1. specify a Data Source Name containing a pre-configured set of options (`DSN=xxx;User=xxx;Password=xxx;`) -2. or configure options explicitly using the string (`Host=xxx;Port=xxx;LogLevel=ES_DEBUG;...`) +2. or configure options explicitly using the string (`Host=xxx;Port=xxx;LogLevel=OPENSEARCH_DEBUG;...`) ## Building from source @@ -82,7 +82,7 @@ From the projects root directory, then build the project using Visual Studio (Wi ## Documentation -Please refer to the [documentation](https://opendistro.github.io/for-elasticsearch-docs/) for detailed information on installing and configuring Open Distro for Elasticsearch. +Please refer to the [documentation](https://opendistro.github.io/for-elasticsearch-docs/) for detailed information on installing and configuring OpenSearch. ## Code of Conduct diff --git a/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md b/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md index 41dbf888ba..9e7d45ecf2 100644 --- a/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md +++ b/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md @@ -51,7 +51,7 @@ build msbuild .\build\odbc\PACKAGE.vcxproj -p:Configuration=Release ``` -`Open Distro for Elasticsearch SQL ODBC Driver--Windows--bit.msi` will be generated in the build directory. +`OpenSearch SQL ODBC Driver--Windows--bit.msi` will be generated in the build directory. ### Testing See [run_tests.md](./run_tests.md) @@ -96,7 +96,7 @@ cd cmake-build64/ cpack . ``` -`Open Distro for Elasticsearch SQL ODBC Driver--Darwin.pkg` will be generated in the build directory. +`OpenSearch SQL ODBC Driver--Darwin.pkg` will be generated in the build directory. ### Testing See [run_tests.md](./run_tests.md) @@ -113,9 +113,9 @@ See [run_tests.md](./run_tests.md) To disable SSL/TLS in the tests, the main CMakeLists.txt file must be edited. This can be found in the project 'src' directory. In the 'General compiler definitions' in the CMakeLists.txt file, USE_SSL is set. Remove this from the add_compile_definitions function to stop SSL/TLS from being used in the tests. -To enable SSL/TLS on Elasticsearch, you must edit the Elasticsearch.yml file, found in the config directory of Elasticsearch. An example Elasticsearch yml file can be found in the dev folder of this project. The certificates specified MUST be in the config directory of the Elasticsearch instance. For more information, please refer to the [Elasticsearch security settings documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html). +To enable SSL/TLS on OpenSearch, you must edit the OpenSearch.yml file, found in the config directory of OpenSearch. An example OpenSearch yml file can be found in the dev folder of this project. The certificates specified MUST be in the config directory of the OpenSearch instance. For more information, please refer to the [OpenSearch security settings documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html). -If you plan to use Kibana, as suggested for this project, you must also edit the Kibana settings. Notice, when specifying a certificate for Kibana, you do not need to place it in the Kibana config directory, but instead must provide the absolute path to it. An example Kibana.yml file can be found in the dev folder of this project. For more information, please refer to the [Kibana settings documentation](https://www.elastic.co/guide/en/kibana/current/settings.html). +If you plan to use OpenSearch Dashboards, as suggested for this project, you must also edit the OpenSearch Dashboards settings. Notice, when specifying a certificate for OpenSearch Dashboards, you do not need to place it in the OpenSearch Dashboards config directory, but instead must provide the absolute path to it. An example opensearch_dashboards.yml file can be found in the dev folder of this project. For more information, please refer to the [OpenSearch Dashboards settings documentation](https://www.elastic.co/guide/en/kibana/current/settings.html). ### Setting up a DSN diff --git a/sql-odbc/docs/dev/Pagination.md b/sql-odbc/docs/dev/Pagination.md index 10a937e39c..4e82d53480 100644 --- a/sql-odbc/docs/dev/Pagination.md +++ b/sql-odbc/docs/dev/Pagination.md @@ -1,9 +1,9 @@ -# Opendistro ODBC Driver Cursor (Pagination) Support Design Documentation +# OpenSearch ODBC Driver Cursor (Pagination) Support Design Documentation ## Overview -Elasticsearch ODBC Driver supports forward-only cursor. This document illustrates how the cursor(pagination) is handled in the driver. +OpenSearch ODBC Driver supports forward-only cursor. This document illustrates how the cursor(pagination) is handled in the driver. -For information on how the pagination is supported on Elasticsearch server, check [Opendistro SQL Cursor (Pagination) Support](https://github.com/opendistro-for-elasticsearch/sql/blob/master/docs/dev/Pagination.md). +For information on how the pagination is supported on OpenSearch server, check [Opendistro SQL Cursor (Pagination) Support](https://github.com/opensearch-project/sql/blob/main/docs/dev/Pagination.md). ## Data Flow

@@ -14,7 +14,7 @@ For information on how the pagination is supported on Elasticsearch server, chec * Step 5 will send a request to close cursor whenever the connection is closed. * ODBC Driver will provide an option to define fetch size as a connection parameter. * If fetch size is zero, query will fallback to non-cursor behavior. - * If fetch size is not given then the number of rows per request will be as per server-defined [default fetch size](https://github.com/opendistro-for-elasticsearch/sql/blob/master/docs/dev/Pagination.md#42-salient-points). + * If fetch size is not given then the number of rows per request will be as per server-defined [default fetch size](https://github.com/opensearch-project/sql/blob/main/docs/dev/Pagination.md#42-salient-points). * ODBC Driver will send the request to close cursor whenever the connection is closed. ## Detailed Design diff --git a/sql-odbc/docs/dev/datasets/kibana_sample_data_types.md b/sql-odbc/docs/dev/datasets/opensearch_dashboards_sample_data_types.md similarity index 89% rename from sql-odbc/docs/dev/datasets/kibana_sample_data_types.md rename to sql-odbc/docs/dev/datasets/opensearch_dashboards_sample_data_types.md index 5f2e0fc185..5ad09b910e 100644 --- a/sql-odbc/docs/dev/datasets/kibana_sample_data_types.md +++ b/sql-odbc/docs/dev/datasets/opensearch_dashboards_sample_data_types.md @@ -1,9 +1,9 @@ -# kibana_sample_data_types +# opensearch_dashboards_sample_data_types ## Mapping ```json -PUT /kibana_sample_data_types +PUT /opensearch_dashboards_sample_data_types { "mappings": { "properties": { @@ -32,7 +32,7 @@ PUT /kibana_sample_data_types ## Data ```json -POST /kibana_sample_data_types/_doc +POST /opensearch_dashboards_sample_data_types/_doc { "type_boolean": true, "type_byte" : -120, @@ -52,7 +52,7 @@ POST /kibana_sample_data_types/_doc ``` ```json -POST /kibana_sample_data_types/_doc +POST /opensearch_dashboards_sample_data_types/_doc { "type_boolean": false, "type_byte" : 100, diff --git a/sql-odbc/docs/dev/example_config_files/example_tdc_file.tdc b/sql-odbc/docs/dev/example_config_files/example_tdc_file.tdc index 629b2b924d..9aca123470 100644 --- a/sql-odbc/docs/dev/example_config_files/example_tdc_file.tdc +++ b/sql-odbc/docs/dev/example_config_files/example_tdc_file.tdc @@ -1,6 +1,6 @@ - + diff --git a/sql-odbc/docs/dev/example_config_files/elasticsearch.yml b/sql-odbc/docs/dev/example_config_files/opensearch.yml similarity index 100% rename from sql-odbc/docs/dev/example_config_files/elasticsearch.yml rename to sql-odbc/docs/dev/example_config_files/opensearch.yml diff --git a/sql-odbc/docs/dev/example_config_files/kibana.yml b/sql-odbc/docs/dev/example_config_files/opensearch_dashboards.yml similarity index 51% rename from sql-odbc/docs/dev/example_config_files/kibana.yml rename to sql-odbc/docs/dev/example_config_files/opensearch_dashboards.yml index db311013ae..48d2c9b677 100644 --- a/sql-odbc/docs/dev/example_config_files/kibana.yml +++ b/sql-odbc/docs/dev/example_config_files/opensearch_dashboards.yml @@ -1,7 +1,7 @@ -# The URLs of the Elasticsearch instances to use for all your queries. -elasticsearch.hosts: ["https://localhost:9200"] +# The URLs of the OpenSearch instances to use for all your queries. +opensearch.hosts: ["https://localhost:9200"] -elasticsearch.ssl.verificationMode: none +opensearch.ssl.verificationMode: none server.ssl.enabled: true server.ssl.certificate: /certificate.pem diff --git a/sql-odbc/docs/dev/run_tests.md b/sql-odbc/docs/dev/run_tests.md index 8f7fb1b87a..3995d8cefb 100644 --- a/sql-odbc/docs/dev/run_tests.md +++ b/sql-odbc/docs/dev/run_tests.md @@ -2,28 +2,28 @@ ## Requirements -* Latest version of [Open Distro for Elasticsearch](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) +* Latest version of [OpenSearch](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) * [Required datasets loaded](#set-up-test-datasets) * [DSN configured](#set-up-dsn) ### Set up test datasets -Loading a dataset requires an [OpenDistro for Elasticsearch](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) service running with [Kibana](https://opendistro.github.io/for-elasticsearch-docs/docs/kibana/). If either of these are missing, please refer to the documentation on how to set them up. +Loading a dataset requires an [OpenSearch](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) service running with [OpenSearch Dashboards](https://opendistro.github.io/for-elasticsearch-docs/docs/kibana/). If either of these are missing, please refer to the documentation on how to set them up. -Note, if you wish to work with SSL/TLS, you need to configure ODFE and Kibana to support it. See the [build instructions](./BUILD_INSTRUCTIONS.md) for more info. +Note, if you wish to work with SSL/TLS, you need to configure ODFE and OpenSearch Dashboards to support it. See the [build instructions](./BUILD_INSTRUCTIONS.md) for more info. -First load the sample datasets provided by kibana. +First load the sample datasets provided by OpenSearch Dashboards. 1. Select home (top left corner) -2. Select 'Load a data set and a Kibana dashboard' +2. Select 'Load a data set and a OpenSearch Dashboards dashboard' 3. Select 'Add data' under 'Sample flight data' 4. Select 'Add data' under 'Sample eCommerce orders' 5. Select 'Add data' under 'Sample web logs' -Then load the following custom data sets using the kibana console. +Then load the following custom data sets using the OpenSearch Dashboards console. Select the wrench on the left control panel. Enter the following commands into the console and hit the play button after each one. -* [kibana_sample_data_types](./datasets/kibana_sample_data_types.md) +* [opensearch_dashboards_sample_data_types](datasets/opensearch_dashboards_sample_data_types.md) ### Set up DSN diff --git a/sql-odbc/docs/dev/sequence_diagrams/SQLDriverConnect.txt b/sql-odbc/docs/dev/sequence_diagrams/SQLDriverConnect.txt index 0d8bc880ec..411cc3d9e8 100644 --- a/sql-odbc/docs/dev/sequence_diagrams/SQLDriverConnect.txt +++ b/sql-odbc/docs/dev/sequence_diagrams/SQLDriverConnect.txt @@ -6,9 +6,9 @@ ESConn->libes (C interface):ESConn object libes (C interface)->ESConn:DB Parameters ESConn->libes (C interface):DB Parameters Validation Result libes (C interface)->ESConn:Connect to DB -database ElasticSearch -ESConn->ElasticSearch:Get -ElasticSearch->ESConn:data +database OpenSearch +ESConn->OpenSearch:Get +OpenSearch->ESConn:data ESConn->libes (C interface):DB Connection Result libes (C interface)->psqlodbc Driver:ESConn object with DB Connection psqlodbc Driver->ODBCTest:SQL Code Result \ No newline at end of file diff --git a/sql-odbc/docs/dev/sequence_diagrams/SQLExecDirect.txt b/sql-odbc/docs/dev/sequence_diagrams/SQLExecDirect.txt index 9917433ac2..1c6a3df3cd 100644 --- a/sql-odbc/docs/dev/sequence_diagrams/SQLExecDirect.txt +++ b/sql-odbc/docs/dev/sequence_diagrams/SQLExecDirect.txt @@ -4,9 +4,9 @@ psqlodbc Driver->libes (C interface):Query libes (C interface)->libes (C interface):Active Connection libes (C interface)->ESConn:Connection, Query ESConn->ESConn:Connection, Query validation -database ElasticSearch -ESConn->ElasticSearch:Post -ElasticSearch->ESConn:Data +database OpenSearch +ESConn->OpenSearch:Post +OpenSearch->ESConn:Data ESConn->libes (C interface):Data libes (C interface)->psqlodbc Driver:Data psqlodbc Driver->ODBCTest:Query Execution Status \ No newline at end of file diff --git a/sql-odbc/docs/dev/sign_installers.md b/sql-odbc/docs/dev/sign_installers.md index 7f02c6fd8b..fc1880ca44 100644 --- a/sql-odbc/docs/dev/sign_installers.md +++ b/sql-odbc/docs/dev/sign_installers.md @@ -20,13 +20,13 @@ Import-Certificate -FilePath .\code_signing.crt -Cert Cert:\CurrentUser\Root - Sign installer using [SignTool](https://docs.microsoft.com/en-us/windows/msix/package/sign-app-package-using-signtool) ``` - signtool sign /sha1 '.\Open Distro for Elasticsearch SQL ODBC Driver--Windows.msi' + signtool sign /sha1 '.\OpenSearch SQL ODBC Driver--Windows.msi' ``` - Alternatively, [Set-AuthenticodeSignature](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-authenticodesignature?view=powershell-7) can be used for adding digital signature. ``` - Set-AuthenticodeSignature '.\Open Distro for Elasticsearch SQL ODBC Driver--Windows.msi' -Certificate (Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert) -TimestampServer "http://timestamp.verisign.com/scripts/timstamp.dll" + Set-AuthenticodeSignature '.\OpenSearch SQL ODBC Driver--Windows.msi' -Certificate (Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert) -TimestampServer "http://timestamp.verisign.com/scripts/timstamp.dll" ``` [Note](https://stackoverflow.com/questions/50956108/codesign-software-still-gives-a-warning-on-windows-10): If you have a standard code signing certificate, some time will be needed for your application to build trust. Microsoft affirms that an Extended Validation (EV) Code Signing Certificate allows to skip this period of trust building. According to Microsoft, extended validation certificates allow the developer to immediately establish reputation with SmartScreen. Otherwise, the users will see a warning like "Windows Defender Smartscreen prevented an unrecognized app from starting. Running this app might put your PC at risk.", with the two buttons: "Run anyway" and "Don't run". @@ -38,12 +38,12 @@ Import-Certificate -FilePath .\code_signing.crt -Cert Cert:\CurrentUser\Root - Sign the installer package using `productsign`. Do not use `Developer ID Application certificate`. ``` -productsign -sign "Developer ID Installer: Your Apple Account Name (**********)" "~/Desktop/Open Distro for Elasticsearch SQL ODBC Driver--Darwin.pkg" "~/Desktop/signed-Open Distro for Elasticsearch SQL ODBC Driver--Darwin.pkg" +productsign -sign "Developer ID Installer: Your Apple Account Name (**********)" "~/Desktop/OpenSearch SQL ODBC Driver--Darwin.pkg" "~/Desktop/signed-OpenSearch SQL ODBC Driver--Darwin.pkg" ``` - Test installer package using [spctl](http://www.manpagez.com/man/8/spctl/) ``` - spctl -a -v --type install "Desktop/Open Distro for Elasticsearch SQL ODBC Driver--Darwin.pkg" + spctl -a -v --type install "Desktop/OpenSearch SQL ODBC Driver--Darwin.pkg" ``` Reference: https://help.apple.com/xcode/mac/current/#/deve51ce7c3d \ No newline at end of file diff --git a/sql-odbc/docs/test/excel_connection.md b/sql-odbc/docs/test/excel_connection.md index 8491085f9e..e73dfa27ec 100644 --- a/sql-odbc/docs/test/excel_connection.md +++ b/sql-odbc/docs/test/excel_connection.md @@ -1,20 +1,20 @@ # Testing Microsoft Excel Connection ## Prerequisites -* [Download and install](../../README.md) Open Distro for Elasticsearch SQL ODBC Driver. -* [Install and configure](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) Open Distro for Elasticsearch. +* [Download and install](../../README.md) OpenSearch SQL ODBC Driver. +* [Install and configure](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) OpenSearch. * Open ODBC Data Source Administrator. Click on **System DSN** > **ODFE SQL ODBC DSN** > **Configure**. * Set all connection options & Click on **Test**. Connection test should return `Connection Successful`. ## Microsoft Excel Connectivity -There are multiple ways to load data from Elasticsearch in Microsoft Excel. +There are multiple ways to load data from OpenSearch in Microsoft Excel. * [ODBC as Data Source](odbc_data_source_connection.md) * [Microsoft Query](microsoft_query_connection.md) * [Query Wizard](query_wizard_connection.md) * [Data Connection Wizard (Legacy)](data_connection_wizard.md) -## Use Microsoft Excel with data loaded from Open distro for Elasticsearch +## Use Microsoft Excel with data loaded from OpenSearch * [Refresh the data](refresh_data.md) * [Exporting CSV files](exporting_csv_files.md) diff --git a/sql-odbc/docs/test/exporting_csv_files.md b/sql-odbc/docs/test/exporting_csv_files.md index 393b3f07d5..9a32378f83 100644 --- a/sql-odbc/docs/test/exporting_csv_files.md +++ b/sql-odbc/docs/test/exporting_csv_files.md @@ -1,8 +1,8 @@ ## Exporting CSV files in Microsoft Excel -* Load data from Open Distro For Elasticsearch by any using any [connection mode](excel_connection.md). +* Load data from OpenSearch by any using any [connection mode](excel_connection.md). -For this example, [ODBC](odbc_data_source_connection.md) connection with SQL statement `SELECT * FROM kibana_sample_data_flights LIMIT 50` in advanced options is used. +For this example, [ODBC](odbc_data_source_connection.md) connection with SQL statement `SELECT * FROM opensearch_dashboards_sample_data_flights LIMIT 50` in advanced options is used. diff --git a/sql-odbc/docs/test/microsoft_query_connection.md b/sql-odbc/docs/test/microsoft_query_connection.md index c7b7c54b00..10acf07543 100644 --- a/sql-odbc/docs/test/microsoft_query_connection.md +++ b/sql-odbc/docs/test/microsoft_query_connection.md @@ -20,7 +20,7 @@ -* You can select different options to define query here. Ensure the query is supported by the [OpenDistro for Elasticsearch SQL plugin](https://github.com/opendistro-for-elasticsearch/sql). After defining query, click on **Return Data** to retrieve the result set. +* You can select different options to define query here. Ensure the query is supported by the [OpenSearch SQL plugin](https://github.com/opensearch-project/sql). After defining query, click on **Return Data** to retrieve the result set. * Select worksheet and click on **OK**. diff --git a/sql-odbc/docs/test/query_wizard_connection.md b/sql-odbc/docs/test/query_wizard_connection.md index 3e22e82d01..823fef7bd1 100644 --- a/sql-odbc/docs/test/query_wizard_connection.md +++ b/sql-odbc/docs/test/query_wizard_connection.md @@ -15,11 +15,11 @@ -* Specify conditions to apply filter if needed. Ensure selected operations are supported by Elasticsearch. Click on **Next**. +* Specify conditions to apply filter if needed. Ensure selected operations are supported by OpenSearch. Click on **Next**. -* Specify sorting options if required. Ensure selected operations are supported by the [OpenDistro for Elasticsearch SQL plugin](https://github.com/opendistro-for-elasticsearch/sql). Click on **Next**. +* Specify sorting options if required. Ensure selected operations are supported by the [OpenSearch SQL plugin](https://github.com/opensearch-project/sql). Click on **Next**. diff --git a/sql-odbc/docs/test/refresh_data.md b/sql-odbc/docs/test/refresh_data.md index 3ddc1b4e41..3f6be89bf8 100644 --- a/sql-odbc/docs/test/refresh_data.md +++ b/sql-odbc/docs/test/refresh_data.md @@ -1,6 +1,6 @@ ## Refresh the loaded data -* Load data from Open Distro For Elasticsearch by any using any [connection mode](excel_connection.md). +* Load data from OpenSearch by any using any [connection mode](excel_connection.md). For this example, [ODBC](odbc_data_source_connection.md) connection is used with the table `sample_data_for_excel` which has 3 datarows as shown in picture. @@ -8,7 +8,7 @@ For this example, [ODBC](odbc_data_source_connection.md) connection is used with -* Add a datarow in the table `sample_data_for_excel` using kibana. +* Add a datarow in the table `sample_data_for_excel` using OpenSearch Dashboards. diff --git a/sql-odbc/docs/user/configuration_options.md b/sql-odbc/docs/user/configuration_options.md index 02c4981aaf..23c1adb591 100644 --- a/sql-odbc/docs/user/configuration_options.md +++ b/sql-odbc/docs/user/configuration_options.md @@ -32,7 +32,7 @@ | Option | Description | Type | Default | |--------|-------------|------|---------------| -| `LogLevel` | Severity level for driver logs. | one of `ES_OFF`, `ES_FATAL`, `ES_ERROR`, `ES_INFO`, `ES_DEBUG`, `ES_TRACE`, `ES_ALL` | `ES_WARNING` | +| `LogLevel` | Severity level for driver logs. | one of `OPENSEARCH_OFF`, `OPENSEARCH_FATAL`, `OPENSEARCH_ERROR`, `OPENSEARCH_INFO`, `OPENSEARCH_DEBUG`, `OPENSEARCH_TRACE`, `OPENSEARCH_ALL` | `OPENSEARCH_WARNING` | | `LogOutput` | Location for storing driver logs. | string | WIN: `C:\`, MAC: `/tmp` | **NOTE:** Administrative privileges are required to change the value of logging options on Windows. \ No newline at end of file diff --git a/sql-odbc/docs/user/mac_configure_dsn.md b/sql-odbc/docs/user/mac_configure_dsn.md index c4dd6b3faa..6c4ce75c49 100644 --- a/sql-odbc/docs/user/mac_configure_dsn.md +++ b/sql-odbc/docs/user/mac_configure_dsn.md @@ -7,7 +7,7 @@ ## Adding a Driver Entry -Note: In order to use the Open Distro for Elasticsearch SQL ODBC driver with the [Tableau Connector](), the **Description of the Driver** field *must* start with `ODFE SQL ODBC`. +Note: In order to use the OpenSearch SQL ODBC driver with the [Tableau Connector](), the **Description of the Driver** field *must* start with `ODFE SQL ODBC`. 1. Go to the **ODBC Drivers** tab. 2. Click **Add a Driver**. @@ -31,7 +31,7 @@ This is not required if you are using the Tableau Connector, but will help with * Choose the Driver you added above. * **Data Source Name (DSN)**: The name of the DSN used to store connection options (ex. `ODFE SQL ODBC DSN`) * **Comment**: Not required - * Add key-value pairs by using the **'+'** button. Below is a picture of the recommended set of options for a default local Open Distro for Elasticsearch installation. + * Add key-value pairs by using the **'+'** button. Below is a picture of the recommended set of options for a default local OpenSearch installation. 3. Click **OK** to save the DSN configuration.

diff --git a/sql-odbc/docs/user/microsoft_excel_support.md b/sql-odbc/docs/user/microsoft_excel_support.md index 158e2d7543..d2ea78166e 100644 --- a/sql-odbc/docs/user/microsoft_excel_support.md +++ b/sql-odbc/docs/user/microsoft_excel_support.md @@ -1,10 +1,10 @@ -# Connecting Open Distro For ElasticSearch to Microsoft Excel on Windows +# Connecting OpenSearch to Microsoft Excel on Windows ## Prerequisites * Microsoft Excel 2016 and higher -* [Open Distro for Elasticsearch](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) -* [Open Distro for Elasticsearch SQL ODBC driver](https://opendistro.github.io/for-elasticsearch-docs/docs/sql/odbc/) +* [OpenSearch](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) +* [OpenSearch SQL ODBC driver](https://opendistro.github.io/for-elasticsearch-docs/docs/sql/odbc/) * A preconfigured [User or System DSN](../../README.md) ## Test Successful Connection @@ -70,7 +70,7 @@ Alternately, **Data** > **Refresh** option can also be used to refresh the data. ## Troubleshooting -* If the table has large number of datarows, increase [the keepalive](https://github.com/opendistro-for-elasticsearch/sql/blob/master/docs/dev/Pagination.md#opendistrosqlcursorkeep_alive) value accordlingly. +* If the table has large number of datarows, increase [the keepalive](https://github.com/opensearch-project/sql/blob/main/docs/dev/Pagination.md#opendistrosqlcursorkeep_alive) value accordlingly. * If the table has nested or object type column, you might get an error as below. @@ -82,7 +82,7 @@ In this case, please use advanced options while connecting to the data source. -Also, make sure query doesn't include the name of nested or object type column name. For example, `SELECT products FROM kibana_sample_data_ecommerce` where product is nested type column might have data loss. +Also, make sure query doesn't include the name of nested or object type column name. For example, `SELECT products FROM opensearch_dashboards_sample_data_ecommerce` where product is nested type column might have data loss. This issue will be resolved when [Object field is missing in SELECT result](https://github.com/opendistro-for-elasticsearch/sql/issues/564) is fixed. diff --git a/sql-odbc/docs/user/microsoft_excel_support_mac.md b/sql-odbc/docs/user/microsoft_excel_support_mac.md index df061429ac..67182e888b 100644 --- a/sql-odbc/docs/user/microsoft_excel_support_mac.md +++ b/sql-odbc/docs/user/microsoft_excel_support_mac.md @@ -1,10 +1,10 @@ -# Connecting Open Distro For ElasticSearch to Micosoft Excel on Mac OS +# Connecting OpenSearch to Micosoft Excel on Mac OS ## Prerequisites * Microsoft Excel 2016 and higher -* [Open Distro for Elasticsearch](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) -* [Open Distro for Elasticsearch SQL ODBC driver](https://opendistro.github.io/for-elasticsearch-docs/docs/sql/odbc/) +* [OpenSearch](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) +* [OpenSearch SQL ODBC driver](https://opendistro.github.io/for-elasticsearch-docs/docs/sql/odbc/) * A preconfigured [User or System DSN](mac_configure_dsn.md) ## Test Successful Connection @@ -84,7 +84,7 @@ Alternately, **Data** > **Refresh** option can also be used to refresh the data. ## Troubleshooting -* If the table has large number of datarows, increase [the keepalive](https://github.com/opendistro-for-elasticsearch/sql/blob/master/docs/dev/Pagination.md#opendistrosqlcursorkeep_alive) value accordlingly. +* If the table has large number of datarows, increase [the keepalive](https://github.com/opensearch-project/sql/blob/main/docs/dev/Pagination.md#opendistrosqlcursorkeep_alive) value accordlingly. * You might need to remove `;` from SQL statement to load data preview. diff --git a/sql-odbc/docs/user/power_bi_service_support.md b/sql-odbc/docs/user/power_bi_service_support.md index 46edbf01bd..1ccb20ccea 100644 --- a/sql-odbc/docs/user/power_bi_service_support.md +++ b/sql-odbc/docs/user/power_bi_service_support.md @@ -1,4 +1,4 @@ -# Connecting Open Distro For ElasticSearch to Microsoft Power BI Service +# Connecting OpenSearch to Microsoft Power BI Service ## Setup * Download and Install [On-premises data gateway](https://docs.microsoft.com/en-us/data-integration/gateway/service-gateway-install) @@ -21,7 +21,7 @@ * Click on **Add data sources to use the gateway**. -* Select Data Source Type as **Open Distro For Elasticsearch**. +* Select Data Source Type as **OpenSearch**. * Enter Data Source Name and Server values. * Select required **Authentication Method**. Select **Anonymous** for auth **NONE**. For **AWS_SIGV4**, select **Key** and set aws access credentials for user **PBIEgwService** at path `C:\Windows\ServiceProfiles\PBIEgwService\.aws\` @@ -38,7 +38,7 @@ For **AWS_SIGV4**, select **Key** and set aws access credentials for user **PBIE ## Publish Report -* Follow [instructions](./power_bi_support.md) to create graph using Open Disto For Elasticsearch Data connector. +* Follow [instructions](./power_bi_support.md) to create graph using OpenSearch Data connector. * Click on **Publish** to publish the report on Power BI service. diff --git a/sql-odbc/docs/user/power_bi_support.md b/sql-odbc/docs/user/power_bi_support.md index e155561518..66c9e647b1 100644 --- a/sql-odbc/docs/user/power_bi_support.md +++ b/sql-odbc/docs/user/power_bi_support.md @@ -1,9 +1,9 @@ -# Connecting Open Distro For ElasticSearch to Microsoft Power BI Desktop +# Connecting OpenSearch to Microsoft Power BI Desktop ## Prerequisites * Microsoft Power BI Desktop -* [Open Distro for Elasticsearch](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) -* [Open Distro for Elasticsearch SQL ODBC driver](https://opendistro.github.io/for-elasticsearch-docs/docs/sql/odbc/) +* [OpenSearch](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) +* [OpenSearch SQL ODBC driver](https://opendistro.github.io/for-elasticsearch-docs/docs/sql/odbc/) * [OdfeSqlOdbcPBIConnector.mez](../../src/PowerBIConnector/bin/Release/) * Optional: [odfesqlodbc_import.pbids](../../src/PowerBIConnector/PBIDSExamples) to help with repeated connections to the same server @@ -26,7 +26,7 @@ -* Click on **Home** > **Get Data** > **More** > **Other**. Select **Open Distro For Elasticsearch (Beta)**. Click on **Connect**. +* Click on **Home** > **Get Data** > **More** > **Other**. Select **OpenSearch (Beta)**. Click on **Connect**. @@ -56,7 +56,7 @@ More info: https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-data-sources#using-pbids-files-to-get-data -Example PBIDS file for Open Distro for Elasticsearch: (available here: [odfesqlodbc_import.pbids](../../src/PowerBIConnector/PBIDSExamples/odfesqlodbc_import.pbids)) +Example PBIDS file for OpenSearch: (available here: [odfesqlodbc_import.pbids](../../src/PowerBIConnector/PBIDSExamples/odfesqlodbc_import.pbids)) ```json { "version": "0.1", @@ -86,7 +86,7 @@ It will take you straight to the **Navigator** window for selecting the tables f ## Troubleshooting -* If you get an following error, please install [Open Distro For Elasticsearch SQL ODBC Driver](https://opendistro.github.io/for-elasticsearch-docs/docs/sql/odbc/). +* If you get an following error, please install [OpenSearch SQL ODBC Driver](https://opendistro.github.io/for-elasticsearch-docs/docs/sql/odbc/). diff --git a/sql-odbc/docs/user/tableau_support.md b/sql-odbc/docs/user/tableau_support.md index 6f4bb4ecef..1c0cea4a65 100644 --- a/sql-odbc/docs/user/tableau_support.md +++ b/sql-odbc/docs/user/tableau_support.md @@ -1,14 +1,14 @@ -# Connecting Open Distro For ElasticSearch to Tableau Desktop via the Tableau Connector +# Connecting OpenSearch to Tableau Desktop via the Tableau Connector ## Overview -Connect an Open Distro For ElasticSearch data source to Tableau Desktop via the Tableau Connector to create a basic graph. +Connect an OpenSearch data source to Tableau Desktop via the Tableau Connector to create a basic graph. ## Prerequisites * Download and Install [Tableau Desktop](https://www.tableau.com/products/desktop/download) 2020 and higher -* Install and Configure [Open Distro for Elasticsearch](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) -* Download and Install [Open Distro for Elasticsearch SQL ODBC driver](../../README.md) +* Install and Configure [OpenSearch](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) +* Download and Install [OpenSearch SQL ODBC driver](../../README.md) * Download Tableau Connector for `SQL by Open Distro for ES` ([odfe_sql_odbc.taco](../../src/TableauConnector/odfe_sql_odbc/odfe_sql_odbc.taco)). Click on **Download** option for downloading `odfe_sql_odbc.taco` file. diff --git a/sql-odbc/opendistro-elasticsearch-odbc.release-notes.md b/sql-odbc/opendistro-elasticsearch-odbc.release-notes.md index 070d15b31c..540b341a18 100644 --- a/sql-odbc/opendistro-elasticsearch-odbc.release-notes.md +++ b/sql-odbc/opendistro-elasticsearch-odbc.release-notes.md @@ -2,7 +2,7 @@ ### Notable Changes -This is the first release of OpenDistro For ELasticsearch ODBC driver. +This is the first release of OpenSearch ODBC driver. OpenDistro ODBC provides a driver for ODBC connectivity for OpenDistro SQL plugin. The driver has been developed from scratch and offers the following features in this initial release: diff --git a/sql-odbc/src/CMakeLists.txt b/sql-odbc/src/CMakeLists.txt index 97f7fde5d2..93ebbc1edf 100644 --- a/sql-odbc/src/CMakeLists.txt +++ b/sql-odbc/src/CMakeLists.txt @@ -78,11 +78,11 @@ set(INSTALL_SRC "${CMAKE_CURRENT_SOURCE_DIR}/installer") set(DSN_INSTALLER_SRC "${CMAKE_CURRENT_SOURCE_DIR}/DSNInstaller") # ODBC Driver version -set(DRIVER_PACKAGE_VERSION "1.13.0.0") -set(DRIVER_PACKAGE_VERSION_COMMA_SEPARATED "1,13,0,0") -add_compile_definitions( ES_ODBC_VERSION="${DRIVER_PACKAGE_VERSION}" +set(DRIVER_PACKAGE_VERSION "1.15.0.0") +set(DRIVER_PACKAGE_VERSION_COMMA_SEPARATED "1,15,0,0") +add_compile_definitions( OPENSEARCH_ODBC_VERSION="${DRIVER_PACKAGE_VERSION}" # Comma separated version is required for odbc administrator's driver file. - ES_ODBC_DRVFILE_VERSION=${DRIVER_PACKAGE_VERSION_COMMA_SEPARATED} ) + OPENSEARCH_ODBC_DRVFILE_VERSION=${DRIVER_PACKAGE_VERSION_COMMA_SEPARATED} ) # Extensions of base directories set(PERFORMANCE_TESTS "${CMAKE_CURRENT_SOURCE_DIR}/PerformanceTests") diff --git a/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_aws_auth_dsn.reg b/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_aws_auth_dsn.reg index 30458e432d..872dec2d3a 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_aws_auth_dsn.reg +++ b/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_aws_auth_dsn.reg @@ -1,14 +1,14 @@ Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers] -"ElasticsearchODBC"="Installed" +"OpenSearchODBC"="Installed" -[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ElasticsearchODBC] +[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\OpenSearchODBC] "Driver"="\\bin64\\Release\\odfesqlodbc.dll" "Setup"="\\bin64\\Release\\odfesqlodbc.dll" [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources] -"test_aws_auth_dsn"="ElasticsearchODBC" +"test_aws_auth_dsn"="OpenSearchODBC" [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\test_aws_auth_dsn] "host"="https://search-sept-cdg-david-test-domain-gouok3seqeupz64smuvfxyddui.eu-west-3.es.amazonaws.com" diff --git a/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_odbc.ini b/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_odbc.ini index c5116456f0..61c2516cb0 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_odbc.ini +++ b/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_odbc.ini @@ -1,5 +1,5 @@ [ODBC Data Sources] -test_aws_auth_dsn = ElasticsearchODBC +test_aws_auth_dsn = OpenSearchODBC [test_aws_auth_dsn] host = https://search-sept-cdg-david-test-domain-gouok3seqeupz64smuvfxyddui.eu-west-3.es.amazonaws.com diff --git a/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_odbc_aws_auth.cpp b/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_odbc_aws_auth.cpp index 999efaca34..35c7dd5ddd 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_odbc_aws_auth.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_odbc_aws_auth.cpp @@ -21,19 +21,19 @@ std::wstring dsn_name = L"test_aws_auth_dsn"; std::wstring aws_auth_conn_string = - L"Driver={Elasticsearch};DataBase=database_name;" + L"Driver={OpenSearch};DataBase=database_name;" L"Host=https://" L"search-bit-quill-cx3hpfoxvasohujxkllmgjwqde.us-west-2." L"es.amazonaws.com;" L"Auth=AWS_SIGV4;Region=us-west-2;LogLevel=1"; std::wstring aws_auth_conn_string_invalid_region = - L"Driver={Elasticsearch};DataBase=database_name;" + L"Driver={OpenSearch};DataBase=database_name;" L"Host=https://" L"search-bit-quill-cx3hpfoxvasohujxkllmgjwqde.us-west-2." L"es.amazonaws.com;" L"Auth=AWS_SIGV4;Region=us-west-3;LogLevel=1"; std::wstring aws_auth_conn_string_invalid_authtype = - L"Driver={Elasticsearch};DataBase=database_name;" + L"Driver={OpenSearch};DataBase=database_name;" L"Host=https://" L"search-bit-quill-cx3hpfoxvasohujxkllmgjwqde.us-west-2." L"es.amazonaws.com;" diff --git a/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_odbcinst.ini b/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_odbcinst.ini index 283dd72937..03aedf8bb1 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_odbcinst.ini +++ b/sql-odbc/src/IntegrationTests/ITODBCAwsAuth/test_odbcinst.ini @@ -1,6 +1,6 @@ [ODBC Drivers] -ElasticsearchODBC = Installed +OpenSearchODBC = Installed -[ElasticsearchODBC] +[OpenSearchODBC] Driver = /lib64/libodfesqlodbc.dylib Setup = /lib64/libodfesqlodbc.dylib \ No newline at end of file diff --git a/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp b/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp index fc928c15fa..c18101d6b5 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp @@ -92,8 +92,8 @@ const std::vector< short > flights_sql_data_type = { SQL_WVARCHAR, SQL_BIT, SQL_REAL, SQL_WVARCHAR, SQL_WVARCHAR, SQL_WVARCHAR, SQL_WVARCHAR, SQL_WVARCHAR, SQL_WVARCHAR, SQL_WVARCHAR}; const std::string flights_catalog_odfe = "odfe-cluster"; -const std::string flights_catalog_elas = "elasticsearch"; -const std::string flights_table_name = "kibana_sample_data_flights"; +const std::string flights_catalog_elas = "opensearch"; +const std::string flights_table_name = "opensearch_dashboards_sample_data_flights"; const std::string flights_decimal_digits = "10"; const std::string flights_num_prec_radix = "2"; @@ -147,20 +147,20 @@ typedef struct table_data { } table_data; const std::vector< table_data > table_data_filtered{ - {"", "", "kibana_sample_data_ecommerce", "BASE TABLE", ""}, - {"", "", "kibana_sample_data_flights", "BASE TABLE", ""}, - {"", "", "kibana_sample_data_types", "BASE TABLE", ""}}; + {"", "", "opensearch_dashboards_sample_data_ecommerce", "BASE TABLE", ""}, + {"", "", "opensearch_dashboards_sample_data_flights", "BASE TABLE", ""}, + {"", "", "opensearch_dashboards_sample_data_types", "BASE TABLE", ""}}; const std::vector< table_data > table_data_single{ - {"", "", "kibana_sample_data_flights", "BASE TABLE", ""}}; + {"", "", "opensearch_dashboards_sample_data_flights", "BASE TABLE", ""}}; const std::vector< table_data > table_data_all{ - {"", "", "kibana_sample_data_ecommerce", "BASE TABLE", ""}, - {"", "", "kibana_sample_data_flights", "BASE TABLE", ""}, - {"", "", "kibana_sample_data_types", "BASE TABLE", ""}, + {"", "", "opensearch_dashboards_sample_data_ecommerce", "BASE TABLE", ""}, + {"", "", "opensearch_dashboards_sample_data_flights", "BASE TABLE", ""}, + {"", "", "opensearch_dashboards_sample_data_types", "BASE TABLE", ""}, }; const std::vector< table_data > excel_table_data_all{ - {"", "", "kibana_sample_data_ecommerce", "TABLE", ""}, - {"", "", "kibana_sample_data_flights", "TABLE", ""}, - {"", "", "kibana_sample_data_types", "TABLE", ""}, + {"", "", "opensearch_dashboards_sample_data_ecommerce", "TABLE", ""}, + {"", "", "opensearch_dashboards_sample_data_flights", "TABLE", ""}, + {"", "", "opensearch_dashboards_sample_data_types", "TABLE", ""}, }; const std::vector< table_data > table_data_types{ {"", "", "", "BASE TABLE", ""}}; @@ -302,10 +302,10 @@ TEST_F(TestSQLTables, WildSchema) { } // Table tests -TEST_SQL_TABLES(ValidTable, NULL, NULL, (SQLTCHAR*)L"kibana_sample_data%", NULL, +TEST_SQL_TABLES(ValidTable, NULL, NULL, (SQLTCHAR*)L"opensearch_dashboards_sample_data%", NULL, table_data_filtered, true, false); TEST_SQL_TABLES(SingleTable, NULL, NULL, - (SQLTCHAR*)L"kibana_sample_data_flights", NULL, + (SQLTCHAR*)L"opensearch_dashboards_sample_data_flights", NULL, table_data_single, false, false); TEST_SQL_TABLES(WildTable, NULL, NULL, (SQLTCHAR*)L"%", NULL, table_data_all, true, false); @@ -328,7 +328,7 @@ TEST_SQL_TABLES(ExcelSQLTables, (SQLTCHAR*)L"%", NULL, NULL, TEST_SQL_COLUMNS(Null, NULL, NULL, NULL, NULL, true, false) // Table tests -TEST_SQL_COLUMNS(ValidTable, NULL, NULL, (SQLTCHAR*)L"kibana_%", NULL, true, +TEST_SQL_COLUMNS(ValidTable, NULL, NULL, (SQLTCHAR*)L"opensearch_dashboards_%", NULL, true, false) TEST_SQL_COLUMNS(InvalidTable, NULL, NULL, (SQLTCHAR*)L"invalid_table", NULL, true, true) @@ -340,9 +340,9 @@ TEST_SQL_COLUMNS(InvalidColumn, NULL, NULL, NULL, (SQLTCHAR*)L"invalid_column", true, true) // Table and column tests -TEST_SQL_COLUMNS(ValidTable_ValidColumn, NULL, NULL, (SQLTCHAR*)L"kibana_%", +TEST_SQL_COLUMNS(ValidTable_ValidColumn, NULL, NULL, (SQLTCHAR*)L"opensearch_dashboards_%", NULL, true, false) -TEST_SQL_COLUMNS(ValidTable_InvalidColumn, NULL, NULL, (SQLTCHAR*)L"kibana_%", +TEST_SQL_COLUMNS(ValidTable_InvalidColumn, NULL, NULL, (SQLTCHAR*)L"opensearch_dashboards_%", (SQLTCHAR*)L"invalid_column", true, true) TEST_SQL_COLUMNS(InvalidTable_ValidColumn, NULL, NULL, (SQLTCHAR*)L"invalid_table", (SQLTCHAR*)L"FlightNum", true, @@ -354,7 +354,7 @@ TEST_SQL_COLUMNS(InvalidTable_InvalidColumn, NULL, NULL, // Data validation TEST_F(TestSQLColumns, FlightsValidation) { EXPECT_EQ(SQL_SUCCESS, SQLColumns(m_hstmt, NULL, SQL_NTS, NULL, SQL_NTS, - (SQLTCHAR*)L"kibana_sample_data_flights", + (SQLTCHAR*)L"opensearch_dashboards_sample_data_flights", SQL_NTS, NULL, SQL_NTS)); std::vector< bind_info > binds; binds.push_back(bind_info(1, SQL_C_CHAR)); @@ -447,18 +447,18 @@ TEST_SQL_KEYS(ForeignKeys_Catalog, SQLForeignKeys, NULL, SQL_NTS, NULL, SQL_NTS, // Table specified TEST_SQL_KEYS(PrimaryKeys_Table, SQLPrimaryKeys, NULL, SQL_NTS, NULL, SQL_NTS, - (SQLTCHAR*)L"kibana_sample_data_flights", SQL_NTS) + (SQLTCHAR*)L"opensearch_dashboards_sample_data_flights", SQL_NTS) TEST_SQL_KEYS(ForeignKeys_Table, SQLForeignKeys, NULL, SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS, - (SQLTCHAR*)L"kibana_sample_data_flights", SQL_NTS) + (SQLTCHAR*)L"opensearch_dashboards_sample_data_flights", SQL_NTS) // Catalog and table specified TEST_SQL_KEYS(PrimaryKeys_CatalogTable, SQLPrimaryKeys, NULL, SQL_NTS, (SQLTCHAR*)L"odfe-cluster", SQL_NTS, - (SQLTCHAR*)L"kibana_sample_data_flights", SQL_NTS) + (SQLTCHAR*)L"opensearch_dashboards_sample_data_flights", SQL_NTS) TEST_SQL_KEYS(ForeignKeys_CatalogTable, SQLForeignKeys, NULL, SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS, (SQLTCHAR*)L"odfe-cluster", - SQL_NTS, (SQLTCHAR*)L"kibana_sample_data_flights", SQL_NTS) + SQL_NTS, (SQLTCHAR*)L"opensearch_dashboards_sample_data_flights", SQL_NTS) // GetTypeInfo expected output struct typedef struct sample_data_getTypeInfo_struct { diff --git a/sql-odbc/src/IntegrationTests/ITODBCConnection/test_dsn.reg b/sql-odbc/src/IntegrationTests/ITODBCConnection/test_dsn.reg index 59b0f91c2b..cfdfffaa7e 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCConnection/test_dsn.reg +++ b/sql-odbc/src/IntegrationTests/ITODBCConnection/test_dsn.reg @@ -1,14 +1,14 @@ Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers] -"ElasticsearchODBC"="Installed" +"OpenSearchODBC"="Installed" -[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ElasticsearchODBC] +[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\OpenSearchODBC] "Driver"="\\bin64\\Release\\odfesqlodbc.dll" "Setup"="\\bin64\\Release\\odfesqlodbc.dll" [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources] -"test_dsn"="ElasticsearchODBC" +"test_dsn"="OpenSearchODBC" [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\test_dsn] "host"="localhost" diff --git a/sql-odbc/src/IntegrationTests/ITODBCConnection/test_odbc.ini b/sql-odbc/src/IntegrationTests/ITODBCConnection/test_odbc.ini index f1b38ef215..b514035af9 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCConnection/test_odbc.ini +++ b/sql-odbc/src/IntegrationTests/ITODBCConnection/test_odbc.ini @@ -1,5 +1,5 @@ [ODBC Data Sources] -test_dsn = ElasticsearchODBC +test_dsn = OpenSearchODBC [test_dsn] host = localhost diff --git a/sql-odbc/src/IntegrationTests/ITODBCConnection/test_odbc_connection.cpp b/sql-odbc/src/IntegrationTests/ITODBCConnection/test_odbc_connection.cpp index 1779835f33..0693a20721 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCConnection/test_odbc_connection.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCConnection/test_odbc_connection.cpp @@ -178,12 +178,12 @@ TEST_F(TestSQLDriverConnect, InvalidDriver) { TEST_F(TestSQLDriverConnect, InvalidHost) { std::wstring invalid_host_conn_string = - use_ssl ? L"Driver={Elasticsearch ODBC};" + use_ssl ? L"Driver={OpenSearch ODBC};" L"host=https://8.8.8.8;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"1;hostnameVerification=0;logLevel=0;logOutput=C:\\;" L"responseTimeout=1;" - : L"Driver={Elasticsearch ODBC};" + : L"Driver={OpenSearch ODBC};" L"host=8.8.8.8;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" @@ -198,12 +198,12 @@ TEST_F(TestSQLDriverConnect, InvalidHost) { TEST_F(TestSQLDriverConnect, InvalidPort) { std::wstring invalid_port_conn_string = - use_ssl ? L"Driver={Elasticsearch ODBC};" + use_ssl ? L"Driver={OpenSearch ODBC};" L"host=https://localhost;port=5432;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"1;hostnameVerification=0;logLevel=0;logOutput=C:\\;" L"responseTimeout=10;" - : L"Driver={Elasticsearch ODBC};" + : L"Driver={OpenSearch ODBC};" L"host=localhost;port=5432;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" @@ -221,12 +221,12 @@ TEST_F(TestSQLDriverConnect, InvalidPort) { // string attribute) TEST_F(TestSQLDriverConnect, UnsupportedKeyword) { std::wstring unsupported_keyword_conn_string = - use_ssl ? L"Driver={Elasticsearch ODBC};" + use_ssl ? L"Driver={OpenSearch ODBC};" L"host=https://localhost;port=5432;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"1;hostnameVerification=0;logLevel=0;logOutput=C:\\;" L"responseTimeout=10;extra=1" - : L"Driver={Elasticsearch ODBC};" + : L"Driver={OpenSearch ODBC};" L"host=localhost;port=5432;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" @@ -241,12 +241,12 @@ TEST_F(TestSQLDriverConnect, UnsupportedKeyword) { TEST_F(TestSQLDriverConnect, ConnStringAbbrevsUID) { std::wstring abbrev_str = - use_ssl ? L"Driver={Elasticsearch ODBC};" + use_ssl ? L"Driver={OpenSearch ODBC};" L"host=https://localhost;port=9200;" L"UID=admin;password=admin;auth=BASIC;useSSL=" L"1;hostnameVerification=0;logLevel=0;logOutput=C:\\;" L"responseTimeout=10;" - : L"Driver={Elasticsearch ODBC};" + : L"Driver={OpenSearch ODBC};" L"host=localhost;port=9200;" L"UID=admin;password=admin;auth=BASIC;useSSL=" L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" @@ -261,12 +261,12 @@ TEST_F(TestSQLDriverConnect, ConnStringAbbrevsUID) { TEST_F(TestSQLDriverConnect, ConnStringAbbrevsPWD) { std::wstring abbrev_str = - use_ssl ? L"Driver={Elasticsearch ODBC};" + use_ssl ? L"Driver={OpenSearch ODBC};" L"host=https://localhost;port=9200;" L"user=admin;PWD=admin;auth=BASIC;useSSL=" L"1;hostnameVerification=0;logLevel=0;logOutput=C:\\;" L"responseTimeout=10;" - : L"Driver={Elasticsearch ODBC};" + : L"Driver={OpenSearch ODBC};" L"host=localhost;port=9200;" L"user=admin;PWD=admin;auth=BASIC;useSSL=" L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" @@ -281,12 +281,12 @@ TEST_F(TestSQLDriverConnect, ConnStringAbbrevsPWD) { TEST_F(TestSQLDriverConnect, ConnStringAbbrevsUIDPWD) { std::wstring abbrev_str = - use_ssl ? L"Driver={Elasticsearch ODBC};" + use_ssl ? L"Driver={OpenSearch ODBC};" L"host=https://localhost;port=9200;" L"UID=admin;PWD=admin;auth=BASIC;useSSL=" L"1;hostnameVerification=0;logLevel=0;logOutput=C:\\;" L"responseTimeout=10;" - : L"Driver={Elasticsearch ODBC};" + : L"Driver={OpenSearch ODBC};" L"host=localhost;port=9200;" L"UID=admin;PWD=admin;auth=BASIC;useSSL=" L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" @@ -301,12 +301,12 @@ TEST_F(TestSQLDriverConnect, ConnStringAbbrevsUIDPWD) { TEST_F(TestSQLDriverConnect, ConnStringAbbrevsServer) { std::wstring abbrev_str = - use_ssl ? L"Driver={Elasticsearch ODBC};" + use_ssl ? L"Driver={OpenSearch ODBC};" L"server=https://localhost;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"1;hostnameVerification=0;logLevel=0;logOutput=C:\\;" L"responseTimeout=10;" - : L"Driver={Elasticsearch ODBC};" + : L"Driver={OpenSearch ODBC};" L"server=localhost;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" @@ -321,12 +321,12 @@ TEST_F(TestSQLDriverConnect, ConnStringAbbrevsServer) { TEST_F(TestSQLDriverConnect, ConnStringAbbrevsServerUIDPWD) { std::wstring abbrev_str = - use_ssl ? L"Driver={Elasticsearch ODBC};" + use_ssl ? L"Driver={OpenSearch ODBC};" L"server=https://localhost;port=9200;" L"UID=admin;PWD=admin;auth=BASIC;useSSL=" L"1;hostnameVerification=0;logLevel=0;logOutput=C:\\;" L"responseTimeout=10;" - : L"Driver={Elasticsearch ODBC};" + : L"Driver={OpenSearch ODBC};" L"server=localhost;port=9200;" L"UID=admin;PWD=admin;auth=BASIC;useSSL=" L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" @@ -341,12 +341,12 @@ TEST_F(TestSQLDriverConnect, ConnStringAbbrevsServerUIDPWD) { TEST_F(TestSQLDriverConnect, Timeout1Second) { std::wstring one_second_timeout = - use_ssl ? L"Driver={Elasticsearch ODBC};" + use_ssl ? L"Driver={OpenSearch ODBC};" L"host=https://8.8.8.8;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"1;hostnameVerification=0;logLevel=0;logOutput=C:\\;" L"responseTimeout=1;" - : L"Driver={Elasticsearch ODBC};" + : L"Driver={OpenSearch ODBC};" L"host=8.8.8.8;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" @@ -377,12 +377,12 @@ TEST_F(TestSQLDriverConnect, Timeout1Second) { TEST_F(TestSQLDriverConnect, Timeout3Second) { std::wstring one_second_timeout = - use_ssl ? L"Driver={Elasticsearch ODBC};" + use_ssl ? L"Driver={OpenSearch ODBC};" L"host=https://8.8.8.8;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"1;hostnameVerification=0;logLevel=0;logOutput=C:\\;" L"responseTimeout=3;" - : L"Driver={Elasticsearch ODBC};" + : L"Driver={OpenSearch ODBC};" L"host=8.8.8.8;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" @@ -413,12 +413,12 @@ TEST_F(TestSQLDriverConnect, Timeout3Second) { TEST_F(TestSQLDriverConnect, Timeout7Second) { std::wstring seven_second_timeout = - use_ssl ? L"Driver={Elasticsearch ODBC};" + use_ssl ? L"Driver={OpenSearch ODBC};" L"host=https://8.8.8.8;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"1;hostnameVerification=0;logLevel=0;logOutput=C:\\;" L"responseTimeout=7;" - : L"Driver={Elasticsearch ODBC};" + : L"Driver={OpenSearch ODBC};" L"host=8.8.8.8;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" diff --git a/sql-odbc/src/IntegrationTests/ITODBCConnection/test_odbcinst.ini b/sql-odbc/src/IntegrationTests/ITODBCConnection/test_odbcinst.ini index 283dd72937..9868d27e06 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCConnection/test_odbcinst.ini +++ b/sql-odbc/src/IntegrationTests/ITODBCConnection/test_odbcinst.ini @@ -1,6 +1,9 @@ [ODBC Drivers] -ElasticsearchODBC = Installed +OpenSearchODBC = Installed -[ElasticsearchODBC] +[OpenSearchODBC] Driver = /lib64/libodfesqlodbc.dylib -Setup = /lib64/libodfesqlodbc.dylib \ No newline at end of file +Setup = /lib64/libodfesqlodbc.dylib + +[OpenSearch Unicode] +logOutput = C:\ diff --git a/sql-odbc/src/IntegrationTests/ITODBCDescriptors/test_odbc_descriptors.cpp b/sql-odbc/src/IntegrationTests/ITODBCDescriptors/test_odbc_descriptors.cpp index 3929558337..69851d265e 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCDescriptors/test_odbc_descriptors.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCDescriptors/test_odbc_descriptors.cpp @@ -20,7 +20,7 @@ #include "it_odbc_helper.h" // clang-format on -const std::wstring data_set = L"kibana_sample_data_flights"; +const std::wstring data_set = L"opensearch_dashboards_sample_data_flights"; const std::wstring single_col = L"Origin"; const std::wstring single_row = L"1"; const uint64_t multi_row_cnt = 25; @@ -184,7 +184,7 @@ TEST_SQL_SET_DESC_FIELD(Test_SQL_DESC_BIND_TYPE, SQL_DESC_BIND_TYPE, SQL_NTS, 0, , SQL_SUCCESS, m_ard_hdesc, 0); TEST_SQL_SET_DESC_FIELD(Test_SQL_DESC_COUNT, SQL_DESC_COUNT, SQL_IS_SMALLINT, 0, - SQLSMALLINT m_value_ptr = 25; + SQLSMALLINT m_value_ptr = 27; , SQL_SUCCESS, m_ard_hdesc, 0); TEST_SQL_SET_DESC_FIELD(Test_SQL_DESC_ROWS_PROCESSED_PTR, @@ -206,7 +206,7 @@ TEST_SQL_SET_DESC_FIELD(TestUndefinedError_SQL_DESC_BASE_COLUMN_NAME, TEST_SQL_SET_DESC_FIELD(TestUndefinedError_SQL_DESC_BASE_TABLE_NAME, SQL_DESC_BASE_TABLE_NAME, SQL_NTS, 1, - SQLCHAR m_value_ptr[255] = "kibana_sample_data_flights"; + SQLCHAR m_value_ptr[255] = "opensearch_dashboards_sample_data_flights"; , SQL_ERROR, m_ird_hdesc, 1); TEST_SQL_SET_DESC_FIELD(TestUndefinedError_SQL_DESC_CASE_SENSITIVE, @@ -329,7 +329,7 @@ TEST_SQL_SET_DESC_FIELD(TestUndefinedError_SQL_DESC_SEARCHABLE, TEST_SQL_SET_DESC_FIELD(TestUndefinedError_SQL_DESC_TABLE_NAME, SQL_DESC_TABLE_NAME, SQL_NTS, 1, - SQLCHAR m_value_ptr[255] = "kibana_sample_data_flights"; + SQLCHAR m_value_ptr[255] = "opensearch_dashboards_sample_data_flights"; , SQL_ERROR, m_ird_hdesc, 1); TEST_SQL_SET_DESC_FIELD(TestUndefinedError_SQL_DESC_TYPE, SQL_DESC_TYPE, diff --git a/sql-odbc/src/IntegrationTests/ITODBCExecution/test_odbc_execution.cpp b/sql-odbc/src/IntegrationTests/ITODBCExecution/test_odbc_execution.cpp index b3d1463337..534ccf53d0 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCExecution/test_odbc_execution.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCExecution/test_odbc_execution.cpp @@ -52,7 +52,7 @@ class TestSQLExecute : public testing::Test { } std::wstring m_query = - L"SELECT Origin FROM kibana_sample_data_flights LIMIT 5"; + L"SELECT Origin FROM opensearch_dashboards_sample_data_flights LIMIT 5"; SQLHENV m_env = SQL_NULL_HENV; SQLHDBC m_conn = SQL_NULL_HDBC; SQLHSTMT m_hstmt = SQL_NULL_HSTMT; @@ -80,14 +80,14 @@ class TestSQLPrepare : public testing::Test { } std::wstring m_query = - L"SELECT Origin FROM kibana_sample_data_flights LIMIT 5"; + L"SELECT Origin FROM opensearch_dashboards_sample_data_flights LIMIT 5"; std::wstring m_1_col = - L"SELECT Origin FROM kibana_sample_data_flights LIMIT 5"; + L"SELECT Origin FROM opensearch_dashboards_sample_data_flights LIMIT 5"; std::wstring m_2_col = - L"SELECT Origin, AvgTicketPrice FROM kibana_sample_data_flights LIMIT " + L"SELECT Origin, AvgTicketPrice FROM opensearch_dashboards_sample_data_flights LIMIT " L"5"; std::wstring m_all_col = - L"SELECT * FROM kibana_sample_data_flights LIMIT 5"; + L"SELECT * FROM opensearch_dashboards_sample_data_flights LIMIT 5"; const SQLSMALLINT m_1_col_cnt = 1; const SQLSMALLINT m_2_col_cnt = 2; const SQLSMALLINT m_all_col_cnt = 25; @@ -118,7 +118,7 @@ class TestSQLExecDirect : public testing::Test { } std::wstring m_query = - L"SELECT Origin FROM kibana_sample_data_flights LIMIT 5"; + L"SELECT Origin FROM opensearch_dashboards_sample_data_flights LIMIT 5"; SQLHENV m_env = SQL_NULL_HENV; SQLHDBC m_conn = SQL_NULL_HDBC; SQLHSTMT m_hstmt = SQL_NULL_HSTMT; @@ -214,7 +214,7 @@ class TestSQLCancel : public testing::Test { const long long m_min_time_diff = 20; std::wstring m_query = - L"SELECT * FROM kibana_sample_data_flights AS f WHERE " + L"SELECT * FROM opensearch_dashboards_sample_data_flights AS f WHERE " L"f.Origin=f.Origin"; SQLHENV m_env = SQL_NULL_HENV; SQLHDBC m_conn = SQL_NULL_HDBC; diff --git a/sql-odbc/src/IntegrationTests/ITODBCHelper/it_odbc_helper.h b/sql-odbc/src/IntegrationTests/ITODBCHelper/it_odbc_helper.h index f9835be378..d05bba92c9 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCHelper/it_odbc_helper.h +++ b/sql-odbc/src/IntegrationTests/ITODBCHelper/it_odbc_helper.h @@ -37,7 +37,7 @@ #define IT_SIZEOF(x) (NULL == (x) ? 0 : (sizeof((x)) / sizeof((x)[0]))) std::vector< std::pair< std::wstring, std::wstring > > conn_str_pair = { - {L"Driver", L"{Elasticsearch ODBC}"}, + {L"Driver", L"{OpenSearch ODBC}"}, {L"host", (use_ssl ? L"https://localhost" : L"localhost")}, {L"port", L"9200"}, {L"user", L"admin"}, diff --git a/sql-odbc/src/IntegrationTests/ITODBCInfo/test_odbc_info.cpp b/sql-odbc/src/IntegrationTests/ITODBCInfo/test_odbc_info.cpp index 0e8808e4d9..21dc7a16a2 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCInfo/test_odbc_info.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCInfo/test_odbc_info.cpp @@ -146,7 +146,7 @@ TEST_SQL_GET_INFO_STRING(SQLDriverODBCVer, SQL_DRIVER_ODBC_VER, L"03.51"); std::wstring version = std::wstring_convert< std::codecvt_utf8_utf16< wchar_t >, wchar_t >{} - .from_bytes(ELASTICSEARCHDRIVERVERSION); + .from_bytes(OPENSEARCHDRIVERVERSION); TEST_SQL_GET_INFO_STRING(SQLDriverVer, SQL_DRIVER_VER, version); TEST_SQL_GET_INFO_UINT16(SQLGetDataExtensions, SQL_GETDATA_EXTENSIONS, @@ -171,7 +171,7 @@ TEST_SQL_GET_INFO_STRING(SQLCatalogTerm, SQL_CATALOG_TERM, L""); // DBMS Info // /////////////// -TEST_SQL_GET_INFO_STRING(SQLDBMSName, SQL_DBMS_NAME, L"Elasticsearch"); +TEST_SQL_GET_INFO_STRING(SQLDBMSName, SQL_DBMS_NAME, L"OpenSearch"); TEST_SQL_GET_INFO_VERSION_GE(SQLDBMSVer, SQL_DBMS_VER, L"7.1.1"); /////////////////// diff --git a/sql-odbc/src/IntegrationTests/ITODBCPagination/test_odbc_pagination.cpp b/sql-odbc/src/IntegrationTests/ITODBCPagination/test_odbc_pagination.cpp index 5acbb02c1e..f701ed9036 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCPagination/test_odbc_pagination.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCPagination/test_odbc_pagination.cpp @@ -81,22 +81,22 @@ class TestPagination : public testing::Test { SQLTCHAR m_out_conn_string[1024]; SQLSMALLINT m_out_conn_string_length; std::wstring m_query = - L"SELECT Origin FROM kibana_sample_data_flights"; + L"SELECT Origin FROM opensearch_dashboards_sample_data_flights"; }; TEST_F(TestPagination, EnablePagination) { // Default fetch size is -1 for driver. // Server default page size for all cursor requests is 1000. - //Total number of rows in kibana_sample_data_flights table + //Total number of rows in opensearch_dashboards_sample_data_flights table int total_rows = 13059; std::wstring fetch_size_15_conn_string = - use_ssl ? L"Driver={Elasticsearch ODBC};" + use_ssl ? L"Driver={OpenSearch ODBC};" L"host=https://localhost;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"1;hostnameVerification=0;logLevel=0;logOutput=C:\\;" L"responseTimeout=10;" - : L"Driver={Elasticsearch ODBC};" + : L"Driver={OpenSearch ODBC};" L"host=localhost;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" @@ -113,12 +113,12 @@ TEST_F(TestPagination, DisablePagination) { // Fetch size 0 implies no pagination int total_rows = 200; std::wstring fetch_size_15_conn_string = - use_ssl ? L"Driver={Elasticsearch ODBC};" + use_ssl ? L"Driver={OpenSearch ODBC};" L"host=https://localhost;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"1;hostnameVerification=0;logLevel=0;logOutput=C:\\;" L"responseTimeout=10;fetchSize=0;" - : L"Driver={Elasticsearch ODBC};" + : L"Driver={OpenSearch ODBC};" L"host=localhost;port=9200;" L"user=admin;password=admin;auth=BASIC;useSSL=" L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" diff --git a/sql-odbc/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp b/sql-odbc/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp index 61aeaf1002..122198ef49 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp @@ -51,8 +51,8 @@ const DescribeColumnData column_data[] = {{L"Origin", SQL_WVARCHAR}, {L"DestRegion", SQL_WVARCHAR}, {L"OriginAirportID", SQL_WVARCHAR}, {L"DestCityName", SQL_WVARCHAR}}; -const std::wstring flight_data_set = L"kibana_sample_data_flights"; -const std::wstring multi_type_data_set = L"kibana_sample_data_types"; +const std::wstring flight_data_set = L"opensearch_dashboards_sample_data_flights"; +const std::wstring multi_type_data_set = L"opensearch_dashboards_sample_data_types"; const std::wstring single_col = L"Origin"; // TODO (#110): Improve sample data result checks const std::wstring m_expected_origin_column_data_1 = diff --git a/sql-odbc/src/IntegrationTests/ITODBCTableauQueries/queries_all.txt b/sql-odbc/src/IntegrationTests/ITODBCTableauQueries/queries_all.txt index 8fb3223732..721bd26d4f 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCTableauQueries/queries_all.txt +++ b/sql-odbc/src/IntegrationTests/ITODBCTableauQueries/queries_all.txt @@ -1,216 +1,216 @@ -SELECT SUBSTRING(`kibana_sample_data_flights`.`OriginWeather`, 1, 1024) AS `OriginWeather` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT SUM(`kibana_sample_data_flights`.`FlightDelayMin`) AS `sum_Offset_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(`kibana_sample_data_flights`.`FlightDelay`) AS `sum_FlightDelay_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(`kibana_sample_data_flights`.`DistanceMiles`) AS `sum_DistanceMiles_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT YEAR(`kibana_sample_data_flights`.`timestamp`) AS `yr_timestamp_ok` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT SUM(ABS(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(ACOS(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252358221825_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(ASIN(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252358545410_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(ATAN(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252358811651_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(ATAN2(`kibana_sample_data_flights`.`dayOfWeek`,`kibana_sample_data_flights`.`FlightDelayMin`)) AS `sum_Calculation_160722252358811651_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(`kibana_sample_data_flights`.`dayOfWeek`) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(COS(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(COT(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(DEGREES(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM((`kibana_sample_data_flights`.`dayOfWeek` DIV `kibana_sample_data_flights`.`FlightDelayMin`)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(EXP(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(`kibana_sample_data_flights`.`dayOfWeek`) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM((((CASE WHEN (ABS((`kibana_sample_data_flights`.`FlightDelayMin`) - (ROUND( ( (`kibana_sample_data_flights`.`FlightDelayMin`) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((`kibana_sample_data_flights`.`dayOfWeek`) - (ROUND( ( (`kibana_sample_data_flights`.`dayOfWeek`) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN 1.5 ELSE 0.0 END) - (CASE WHEN ((`kibana_sample_data_flights`.`dayOfWeek`) - (ROUND( ( (`kibana_sample_data_flights`.`dayOfWeek`) / 3.0 ), 0 ) * 3.0) < 0.0) AND ((CASE WHEN (ABS((`kibana_sample_data_flights`.`FlightDelayMin`) - (ROUND( ( (`kibana_sample_data_flights`.`FlightDelayMin`) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((`kibana_sample_data_flights`.`dayOfWeek`) - (ROUND( ( (`kibana_sample_data_flights`.`dayOfWeek`) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN SQRT(3.0) / 2.0 ELSE 0.0 END) > 0.0) THEN 3.0 ELSE 0.0 END)) + (ROUND( ( (`kibana_sample_data_flights`.`dayOfWeek`) / 3.0 ), 0 ) * 3.0))) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(ROUND( (((CASE WHEN (ABS((`kibana_sample_data_flights`.`FlightDelayMin`) - (ROUND( ( (`kibana_sample_data_flights`.`FlightDelayMin`) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((`kibana_sample_data_flights`.`dayOfWeek`) - (ROUND( ( (`kibana_sample_data_flights`.`dayOfWeek`) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN SQRT(3.0) / 2.0 ELSE 0.0 END) - (CASE WHEN ((`kibana_sample_data_flights`.`FlightDelayMin`) - (ROUND( ( (`kibana_sample_data_flights`.`FlightDelayMin`) / SQRT(3.0) ), 0 ) * SQRT(3.0)) < 0.0) AND ((CASE WHEN (ABS((`kibana_sample_data_flights`.`FlightDelayMin`) - (ROUND( ( (`kibana_sample_data_flights`.`FlightDelayMin`) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((`kibana_sample_data_flights`.`dayOfWeek`) - (ROUND( ( (`kibana_sample_data_flights`.`dayOfWeek`) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN SQRT(3.0) / 2.0 ELSE 0.0 END) > 0.0) THEN SQRT(3.0) ELSE 0.0 END)) + (ROUND( ( (`kibana_sample_data_flights`.`FlightDelayMin`) / SQRT(3.0) ), 0 ) * SQRT(3.0))), 3)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(LOG(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM((LOG(`kibana_sample_data_flights`.`dayOfWeek`)/LOG(10))) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT MAX(`kibana_sample_data_flights`.`dayOfWeek`) AS `usr_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT MIN(`kibana_sample_data_flights`.`dayOfWeek`) AS `usr_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM((CASE WHEN `kibana_sample_data_flights`.`dayOfWeek` >= 0 OR FLOOR(2) = 2 THEN POWER(`kibana_sample_data_flights`.`dayOfWeek`,2) END)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(RADIANS(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(ROUND(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(SIGN(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(SIN(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(SQRT(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(POWER(`kibana_sample_data_flights`.`dayOfWeek`, 2)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(TAN(`kibana_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(`kibana_sample_data_flights`.`dayOfWeek`) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(ASCII(SUBSTRING(`kibana_sample_data_flights`.`OriginWeather`, 1, 1024))) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT `kibana_sample_data_flights`.`Dest` AS `Dest` FROM `kibana_sample_data_flights` WHERE ((`kibana_sample_data_flights`.`Dest` = 'caching_sha2_password') AND (LOCATE('in',LOWER(`kibana_sample_data_flights`.`Dest`)) > 0)) GROUP BY 1 -SELECT SUBSTRING(`kibana_sample_data_flights`.`OriginWeather`, 1, 1024) AS `OriginWeather` FROM `kibana_sample_data_flights` WHERE (RIGHT(RTRIM(LOWER(SUBSTRING(`kibana_sample_data_flights`.`OriginWeather`, 1, 1024))), LENGTH('.')) = '.') GROUP BY 1 -SELECT SUM(IF(ISNULL(1), NULL, LOCATE('Cape',`kibana_sample_data_flights`.`Origin`,GREATEST(1,FLOOR(1))))) AS `sum_Calculation_462181953493630977_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT (CASE WHEN 3 >= 0 THEN LEFT(`kibana_sample_data_flights`.`Origin`,3) ELSE NULL END) AS `Calculation_462181953493630977` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT LENGTH(`kibana_sample_data_flights`.`Origin`) AS `Calculation_462181953493630977` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT LOWER(`kibana_sample_data_flights`.`Origin`) AS `Calculation_462181953493630977` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT LTRIM(`kibana_sample_data_flights`.`Origin`) AS `Calculation_462181953493630977` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT MAX(`kibana_sample_data_flights`.`Origin`) AS `usr_Calculation_462181953493630977_nk` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT IF(ISNULL(0), NULL, SUBSTRING(`kibana_sample_data_flights`.`Origin`,GREATEST(1,FLOOR(0)),FLOOR(5))) AS `Calculation_462181953493630977` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT MIN(`kibana_sample_data_flights`.`Origin`) AS `usr_Calculation_462181953493630977_nk` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT REPLACE(`kibana_sample_data_flights`.`Origin`,'Airport','') AS `Calculation_462181953493630977` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT (CASE WHEN 3 >= 0 THEN RIGHT(`kibana_sample_data_flights`.`Origin`,3) ELSE NULL END) AS `Calculation_462181953493630977` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT RTRIM(`kibana_sample_data_flights`.`Origin`) AS `Calculation_462181953493630977` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT IF(`kibana_sample_data_flights`.`AvgTicketPrice` >= 0, SPACE(FLOOR(`kibana_sample_data_flights`.`AvgTicketPrice`)), NULL) AS `Calculation_462181953493630977` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT TRIM(LEADING '-' FROM TRIM(LEADING SUBSTRING_INDEX(`kibana_sample_data_flights`.`Origin`, '-', (2 - 1)) FROM SUBSTRING_INDEX(`kibana_sample_data_flights`.`Origin`, '-', 2))) AS `Calculation_462181953493630977` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT SUBSTRING(`kibana_sample_data_flights`.`OriginWeather`, 1, 1024) AS `OriginWeather` FROM `kibana_sample_data_flights` WHERE (LEFT(LTRIM(LOWER(SUBSTRING(`kibana_sample_data_flights`.`OriginWeather`, 1, 1024))), LENGTH('$')) = '$') GROUP BY 1 -SELECT TRIM(`kibana_sample_data_flights`.`Origin`) AS `Calculation_462181953493630977` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT UPPER(`kibana_sample_data_flights`.`Origin`) AS `Calculation_462181953493630977` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT ADDDATE( DATE_FORMAT( DATE(`kibana_sample_data_flights`.`password_last_changed`), '%Y-01-01 00:00:00' ), INTERVAL 0 SECOND ) AS `tyr_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT YEAR(DATE(`kibana_sample_data_flights`.`timestamp`)) AS `yr_Calculation_462181953481519104_ok` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT (YEAR(`kibana_sample_data_flights`.`timestamp`) - YEAR(DATE('1990-01-01'))) AS `Calculation_1706301351891775489` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT MONTHNAME(`kibana_sample_data_flights`.`timestamp`) AS `Calculation_1706301351891775489` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT YEAR(TIMESTAMP(STR_TO_DATE('5.April.2004', '%d.%i.%Y'))) AS `yr_Calculation_462181953481519104_ok` FROM `kibana_sample_data_flights` -SELECT YEAR(ADDDATE( CONCAT( DATE_FORMAT( `kibana_sample_data_flights`.`timestamp`, '%Y-' ), (3*(QUARTER(`kibana_sample_data_flights`.`timestamp`)-1)+1), '-01 00:00:00' ), INTERVAL 0 SECOND )) AS `yr_Calculation_1706301351891775489_ok` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT DAYOFMONTH(`kibana_sample_data_flights`.`timestamp`) AS `Calculation_462181953481519104` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT 2019 AS `yr_Calculation_462181953481519104_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT YEAR(ADDTIME(CAST(CAST(`kibana_sample_data_flights`.`timestamp` AS DATE) AS DATETIME), TIME(`kibana_sample_data_flights`.`timestamp`))) AS `yr_Calculation_1706301351891775489_ok` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT YEAR(MAKETIME(`kibana_sample_data_flights`.`dayOfWeek`, `kibana_sample_data_flights`.`dayOfWeek`, `kibana_sample_data_flights`.`dayOfWeek`)) AS `yr_Calculation_1706301351891775489_ok` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT MAX(`kibana_sample_data_flights`.`timestamp`) AS `max_timestamp_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT MIN(`kibana_sample_data_flights`.`timestamp`) AS `min_timestamp_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT MONTH(`kibana_sample_data_flights`.`timestamp`) AS `mn_timestamp_ok` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT YEAR(NOW()) AS `yr_Calculation_462181953481519104_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT YEAR(CURDATE()) AS `yr_Calculation_462181953481519104_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT YEAR(`kibana_sample_data_flights`.`timestamp`) AS `yr_timestamp_ok` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT ((`kibana_sample_data_flights`.`Origin` = 'Frankfurt am Main Airport') AND (`kibana_sample_data_flights`.`Dest` = 'Sydney Kingsford Smith International Airport')) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT (CASE `kibana_sample_data_flights`.`OriginWeather` WHEN 'Sunny' THEN '1' WHEN 'Rain' THEN '0' ELSE 'NA' END) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT (CASE WHEN (`kibana_sample_data_flights`.`FlightDelay` = 0) THEN 'No delay' ELSE CAST(NULL AS CHAR(1)) END) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT (CASE WHEN (`kibana_sample_data_flights`.`FlightDelay` = 0) THEN 'No delay' WHEN (`kibana_sample_data_flights`.`FlightDelay` = 1) THEN 'Delay' ELSE CAST(NULL AS CHAR(1)) END) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT (RIGHT(RTRIM(`kibana_sample_data_flights`.`Origin`), LENGTH('Airport')) = 'Airport') AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT (CASE WHEN (`kibana_sample_data_flights`.`FlightDelay` = 0) THEN 'No delay' ELSE CAST(NULL AS CHAR(1)) END) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT IFNULL(`kibana_sample_data_flights`.`Cancelled`, `kibana_sample_data_flights`.`AvgTicketPrice`) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT (CASE WHEN (`kibana_sample_data_flights`.`AvgTicketPrice` > 500) THEN 'High' WHEN NOT (`kibana_sample_data_flights`.`AvgTicketPrice` > 500) THEN 'Low' ELSE NULL END) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT (NOT ISNULL(DATE_FORMAT(`kibana_sample_data_flights`.`Origin`, '%Y'))) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT ISNULL(`kibana_sample_data_flights`.`FlightNum`) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT MAX(`kibana_sample_data_flights`.`dayOfWeek`) AS `max_max_questions_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT MIN(`kibana_sample_data_flights`.`dayOfWeek`) AS `min_max_questions_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT (NOT ISNULL(DATE_FORMAT(`kibana_sample_data_flights`.`Origin`, '%Y'))) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT ((`kibana_sample_data_flights`.`Origin` = 'Frankfurt am Main Airport') OR (`kibana_sample_data_flights`.`Dest` = 'Sydney Kingsford Smith International Airport')) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT (CASE WHEN (`kibana_sample_data_flights`.`AvgTicketPrice` > 500) THEN 'High' WHEN NOT (`kibana_sample_data_flights`.`AvgTicketPrice` > 500) THEN 'Low' ELSE NULL END) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT (CASE WHEN (`kibana_sample_data_flights`.`AvgTicketPrice` > 500) THEN 'High' WHEN NOT (`kibana_sample_data_flights`.`AvgTicketPrice` > 500) THEN 'Low' ELSE NULL END) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT IFNULL(`kibana_sample_data_flights`.`FlightDelay`, 0) AS `Calculation_462181953506873347` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT MIN(`kibana_sample_data_flights`.`Origin`) AS `TEMP(Calculation_462181953504628738)(2376748618)(0)`, MAX(`kibana_sample_data_flights`.`Origin`) AS `TEMP(Calculation_462181953504628738)(2968235173)(0)` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT AVG(`kibana_sample_data_flights`.`FlightDelayMin`) AS `avg_max_user_connections_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(1) AS `cnt_max_user_connections_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT MAX(`kibana_sample_data_flights`.`max_questions`) AS `max_max_questions_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT MIN(`kibana_sample_data_flights`.`dayOfWeek`) AS `min_max_questions_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM((`kibana_sample_data_flights`.`AvgTicketPrice` * `kibana_sample_data_flights`.`AvgTicketPrice`)) AS `TEMP(Calculation_462181953506873347)(1705728846)(0)`, SUM(`kibana_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(Calculation_462181953506873347)(2465277995)(0)`, COUNT(`kibana_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(Calculation_462181953506873347)(2633997250)(0)` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT COUNT(`kibana_sample_data_flights`.`DistanceMiles`) AS `TEMP(Calculation_462181953506873347)(2070533874)(0)`, SUM(`kibana_sample_data_flights`.`DistanceMiles`) AS `TEMP(Calculation_462181953506873347)(3496560911)(0)`, SUM((`kibana_sample_data_flights`.`DistanceMiles` * `kibana_sample_data_flights`.`DistanceMiles`)) AS `TEMP(Calculation_462181953506873347)(3595387140)(0)` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(`kibana_sample_data_flights`.`dayOfWeek`) AS `usr_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(`kibana_sample_data_flights`.`dayOfWeek`) AS `TEMP(Calculation_462181953506873347)(105357904)(0)`, COUNT(`kibana_sample_data_flights`.`dayOfWeek`) AS `TEMP(Calculation_462181953506873347)(2584840543)(0)`, SUM(((`kibana_sample_data_flights`.`dayOfWeek` + 0.0) * (`kibana_sample_data_flights`.`dayOfWeek` + 0.0))) AS `TEMP(Calculation_462181953506873347)(3340567470)(0)` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT SUM(`kibana_sample_data_flights`.`DistanceKilometers`) AS `TEMP(Calculation_462181953506873347)(1474522238)(0)`, COUNT(`kibana_sample_data_flights`.`DistanceKilometers`) AS `TEMP(Calculation_462181953506873347)(2841334535)(0)`, SUM((`kibana_sample_data_flights`.`DistanceKilometers` * `kibana_sample_data_flights`.`DistanceKilometers`)) AS `TEMP(Calculation_462181953506873347)(461715975)(0)` FROM `kibana_sample_data_flights` GROUP BY 1 -SELECT SUBSTRING(`kibana_sample_data_flights`.`OriginWeather`, 1, 1024) AS `OriginWeather` FROM `kibana_sample_data_flights` WHERE (SUBSTRING(`kibana_sample_data_flights`.`OriginWeather`, 1, 1024) = 'ABC') GROUP BY 1 -SELECT SUM((CASE \tWHEN ISNULL(`kibana_sample_data_flights`.`dayOfWeek`) THEN NULL \tWHEN ISNULL(10) THEN NULL \tELSE GREATEST(`kibana_sample_data_flights`.`dayOfWeek`, 10) END)) AS `sum_Calculation_160722252357632000_ok` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT `kibana_sample_data_flights`.`AvgTicketPrice` AS `AvgTicketPrice`, `kibana_sample_data_flights`.`Cancelled` AS `Cancelled`, `kibana_sample_data_flights`.`Carrier` AS `Carrier`, `kibana_sample_data_flights`.`DestAirportID` AS `DestAirportID`, `kibana_sample_data_flights`.`DestCityName` AS `DestCityName`, `kibana_sample_data_flights`.`DestCountry` AS `DestCountry`, `kibana_sample_data_flights`.`DestLocation` AS `DestLocation`, `kibana_sample_data_flights`.`DestRegion` AS `Dest~~~<<>>~~~e`.`kibana_sample_data_flights` AS `kibana_sample_data_flights` FROM `kibana_sample_data_ecommerce` LEFT JOIN `kibana_sample_data_flights` ON (`kibana_sample_data_ecommerce`.`day_of_week_i` = `kibana_sample_data_flights`.`dayOfWeek`) LIMIT 1000 -SELECT `kibana_sample_data_flights`.`AvgTicketPrice` AS `AvgTicketPrice`, `kibana_sample_data_flights`.`Cancelled` AS `Cancelled`, `kibana_sample_data_flights`.`Carrier` AS `Carrier`, `kibana_sample_data_flights`.`DestAirportID` AS `DestAirportID`, `kibana_sample_data_flights`.`DestCityName` AS `DestCityName`, `kibana_sample_data_flights`.`DestCountry` AS `DestCountry`, `kibana_sample_data_flights`.`DestLocation` AS `DestLocation`, `kibana_sample_data_flights`.`DestRegion` AS `Dest~~~<<>>~~~`.`kibana_sample_data_flights` AS `kibana_sample_data_flights` FROM `kibana_sample_data_ecommerce` RIGHT JOIN `kibana_sample_data_flights` ON (`kibana_sample_data_ecommerce`.`day_of_week_i` = `kibana_sample_data_flights`.`dayOfWeek`) LIMIT 1000 -SELECT `kibana_sample_data_flights`.`OriginCityName` AS `OriginCityName` FROM `kibana_sample_data_flights` GROUP BY 1 ORDER BY `OriginCityName` ASC -SELECT `kibana_sample_data_flights`.`OriginCityName` AS `OriginCityName` FROM `kibana_sample_data_flights` GROUP BY 1 ORDER BY `OriginCityName` ASC -SELECT `kibana_sample_data_flights`.`DestCityName` AS `DestCityName`, SUM(`kibana_sample_data_flights`.`AvgTicketPrice`) AS `$__alias__0` FROM `kibana_sample_data_flights` GROUP BY 1 ORDER BY `$__alias__0` DESC, `DestCityName` ASC LIMIT 10 -SELECT 'DESKTOP-7APIVOE\\\\Rupal' AS `Calculation_1122522251639717888` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT 0 AS `Calculation_1122522251639717888` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT 0 AS `Calculation_1122522251639717888` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000002 -SELECT 1 AS `Calculation_1122522251639717888` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT 'DESKTOP-7APIVOE' AS `Calculation_1122522251639717888` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT 'ABC' AS `Calculation_1122522251639717888` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT MAX(`kibana_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TC_)(3575797393)(0)` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(`kibana_sample_data_flights`.`dayOfWeek`) AS `TEMP(TEMP(TC_)(4001152001)(0))(105357904)(0)`, COUNT(`kibana_sample_data_flights`.`dayOfWeek`) AS `TEMP(TEMP(TC_)(4001152001)(0))(2584840543)(0)` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT MIN(`kibana_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TC_)(2076389572)(0)` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(`kibana_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TEMP(TC_)(4079199159)(0))(2465277995)(0)`, COUNT(`kibana_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TEMP(TC_)(4079199159)(0))(2633997250)(0)` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(`kibana_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TC_)(2465277995)(0)` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT COUNT(`kibana_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TC_)(2633997250)(0)` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT MAX(`kibana_sample_data_flights`.`dayOfWeek`) AS `TEMP(TC_)(718966039)(0)` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT MIN(`kibana_sample_data_flights`.`dayOfWeek`) AS `TEMP(TC_)(2462140059)(0)` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT SUM(`kibana_sample_data_flights`.`dayOfWeek`) AS `TEMP(TC_)(105357904)(0)`, SUM(`kibana_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TC_)(2465277995)(0)` FROM `kibana_sample_data_flights` GROUP BY 1.1000000000000001 -SELECT 1 AS `empty` FROM `kibana_sample_data_flights` -SELECT substring(OriginWeather, 1, 2) AS OriginWeather FROM kibana_sample_data_flights -SELECT SUM(FlightDelayMin) AS sum_FlightDelayMin_ok FROM kibana_sample_data_flights -SELECT SUM(FlightDelay) AS sum_FlightDelay_ok FROM kibana_sample_data_flights -SELECT SUM(DistanceMiles) AS sum_DistanceMiles_ok FROM kibana_sample_data_flights -SELECT year(timestamp) AS yr_timestamp_ok FROM kibana_sample_data_flights -SELECT abs(AvgTicketPrice) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT acos(FlightDelayMin) AS sum_Calculation_160722252358221825_ok FROM kibana_sample_data_flights -SELECT asin(FlightDelayMin) AS sum_Calculation_160722252358545410_ok FROM kibana_sample_data_flights -SELECT atan(FlightDelayMin) AS sum_Calculation_160722252358811651_ok FROM kibana_sample_data_flights -SELECT atan2(FlightDelayMin,dayOfWeek) AS sum_Calculation_160722252358811651_ok FROM kibana_sample_data_flights -SELECT SUM(FlightDelayMin) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT cos(FlightDelayMin) AS sum_Calculation_160722252358221825_ok FROM kibana_sample_data_flights -SELECT cot(AvgTicketPrice) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT degrees(FlightDelayMin) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT FlightDelayMin div AvgTicketPrice AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT exp(FlightDelayMin) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT SUM(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT SUM((((CASE WHEN (ABS((AvgTicketPrice) - (ROUND( ( (AvgTicketPrice) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((FlightDelayMin) - (ROUND( ( (FlightDelayMin) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN 1.5 ELSE 0.0 END) - (CASE WHEN ((FlightDelayMin) - (ROUND( ( (FlightDelayMin) / 3.0 ), 0 ) * 3.0) < 0.0) AND ((CASE WHEN (ABS((AvgTicketPrice) - (ROUND( ( (AvgTicketPrice) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((FlightDelayMin) - (ROUND( ( (FlightDelayMin) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN SQRT(3.0) / 2.0 ELSE 0.0 END) > 0.0) THEN 3.0 ELSE 0.0 END)) + (ROUND( ( (FlightDelayMin) / 3.0 ), 0 ) * 3.0))) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT SUM(ROUND( (((CASE WHEN (ABS((AvgTicketPrice) - (ROUND( ( (AvgTicketPrice) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((FlightDelayMin) - (ROUND( ( (FlightDelayMin) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN SQRT(3.0) / 2.0 ELSE 0.0 END) - (CASE WHEN ((AvgTicketPrice) - (ROUND( ( (AvgTicketPrice) / SQRT(3.0) ), 0 ) * SQRT(3.0)) < 0.0) AND ((CASE WHEN (ABS((AvgTicketPrice) - (ROUND( ( (AvgTicketPrice) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((FlightDelayMin) - (ROUND( ( (FlightDelayMin) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN SQRT(3.0) / 2.0 ELSE 0.0 END) > 0.0) THEN SQRT(3.0) ELSE 0.0 END)) + (ROUND( ( (AvgTicketPrice) / SQRT(3.0) ), 0 ) * SQRT(3.0))), 3)) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT log(FlightDelayMin) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT (log(FlightDelayMin)/log(10)) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT MAX(FlightDelayMin) AS usr_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT MIN(FlightDelayMin) AS usr_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT sum((case when dayOfWeek >= 0 or floor(2) = 2 then power(dayOfWeek,2) end)) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT radians(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT round(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT sign(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT sin(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT sqrt(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT power(dayOfWeek, 2) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT tan(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT SUM(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT ascii(substring(OriginWeather, 1, 5)) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT Dest, locate('air',Dest) FROM kibana_sample_data_flights -SELECT substring(OriginWeather, 1, 1024) AS OriginWeather FROM kibana_sample_data_flights WHERE (right(rtrim(lower(substring(OriginWeather, 1, 5))), length('.')) ='.') -SELECT sum(if(isnull(1), null, locate('Cape',Origin,greatest(1,floor(1))))) AS sum_Calculation_462181953493630977_ok FROM kibana_sample_data_flights -SELECT (case when 3 >= 0 then left(Origin,3) else null end) AS Calculation_462181953493630977 FROM kibana_sample_data_flights -SELECT length(Origin) AS Calculation_462181953493630977 FROM kibana_sample_data_flights -SELECT lower(Origin) AS Calculation_462181953493630977 FROM kibana_sample_data_flights -SELECT ltrim(Origin) AS Calculation_462181953493630977 FROM kibana_sample_data_flights -SELECT max(Origin) AS usr_Calculation_462181953493630977_nk FROM kibana_sample_data_flights -SELECT if(isnull(0), null, substring(Origin,greatest(1,floor(0)),floor(5))) AS Calculation_462181953493630977 FROM kibana_sample_data_flights -SELECT min(Origin) AS usr_Calculation_462181953493630977_nk FROM kibana_sample_data_flights -SELECT replace(Origin,'Airport','') AS Calculation_462181953493630977 FROM kibana_sample_data_flights -SELECT (case when 3 >= 0 then right(Origin,3) else null end) AS Calculation_462181953493630977 FROM kibana_sample_data_flights -SELECT rtrim(Origin) AS Calculation_462181953493630977 FROM kibana_sample_data_flights -SELECT if(AvgTicketPrice >= 0, space(floor(AvgTicketPrice)), null) AS Calculation_462181953493630977 FROM kibana_sample_data_flights -SELECT trim(leading '-' FROM trim(leading substring(Origin, '-', (2 - 1)) FROM substring_index(Origin, '-', 2))) AS Calculation_462181953493630977 FROM kibana_sample_data_flights -SELECT substring(OriginWeather, 1, 5) AS OriginWeather FROM kibana_sample_data_flights where (left(ltrim(lower(substring(OriginWeather, 1, 5))), length('$')) = '$') -SELECT trim(Origin) AS Calculation_462181953493630977 FROM kibana_sample_data_flights -SELECT upper(Origin) AS Calculation_462181953493630977 FROM kibana_sample_data_flights -SELECT adddate( date_format( date(timestamp), '%Y-01-01 00:00:00' ), interval 0 second ) AS tyr_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT year(date(timestamp)) AS yr_Calculation_462181953481519104_ok FROM kibana_sample_data_flights -SELECT year(timestamp(str_to_date('5.April.2004', '%d.%i.%Y'))) AS yr_Calculation_462181953481519104_ok FROM kibana_sample_data_flights -SELECT dayofmonth(timestamp) AS Calculation_462181953481519104 FROM kibana_sample_data_flights -SELECT 2019 AS yr_Calculation_462181953481519104_ok FROM kibana_sample_data_flights -SELECT max(timestamp) AS max_timestamp_ok FROM kibana_sample_data_flights -SELECT min(timestamp) AS max_timestamp_ok FROM kibana_sample_data_flights -SELECT month(timestamp) AS mn_timestamp_ok FROM kibana_sample_data_flights -SELECT year(now()) AS yr_Calculation_462181953481519104_ok FROM kibana_sample_data_flights -SELECT year(curdate()) AS yr_Calculation_462181953481519104_ok FROM kibana_sample_data_flights -SELECT year(timestamp) AS yr_timestamp_ok FROM kibana_sample_data_flights -SELECT ((Origin = 'Frankfurt am Main Airport') and (Dest = 'Sydney Kingsford Smith International Airport')) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT (case OriginWeather when 'Sunny' then '1' when 'Rain' then '0' else 'NA' end) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT (case when (FlightDelay = 0) then 'No delay' else cast(null as char(1)) end) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT (case when (FlightDelay = 0) then 'No delay' when (FlightDelay = 1) then 'Delay' else cast(null as char(1)) end) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT (right(rtrim(Origin), length('Airport')) = 'Airport') AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT (case when (FlightDelay = 0) then 'No delay' else cast(null as char(1)) end) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT ifnull(Cancelled, AvgTicketPrice) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT (case when (AvgTicketPrice > 500) THEN 'High' when not (AvgTicketPrice > 500) then 'Low' else null end) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT (not isnull(date_format(Origin, '%Y'))) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT isnull(FlightNum) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT MAX(AvgTicketPrice) AS max_AvgTicketPrice_ok FROM kibana_sample_data_flights -SELECT MIN(AvgTicketPrice) AS min_AvgTicketPrice_ok FROM kibana_sample_data_flights -SELECT (not isnull(date_format(Origin, '%Y'))) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT ((Origin = 'Frankfurt am Main Airport') or (Dest = 'Sydney Kingsford Smith International Airport')) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT (case when (AvgTicketPrice > 500) THEN 'High' when not (AvgTicketPrice > 500) then 'Low' else null end) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT (case when (AvgTicketPrice > 500) THEN 'High' when not (AvgTicketPrice > 500) then 'Low' else null end) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT ifnull(FlightDelay, 0) AS Calculation_462181953506873347 FROM kibana_sample_data_flights -SELECT min(Origin) AS temp(Calculation_462181953504628738)(2376748618)(0), max(Origin) AS temp(Calculation_462181953504628738)(2968235173)(0) FROM kibana_sample_data_flights -SELECT AVG(dayOfWeek) AS avg_dayOfWeek_ok FROM kibana_sample_data_flights -SELECT SUM(1) AS cnt_dayOfWeek_ok FROM kibana_sample_data_flights -SELECT COUNT(DISTINCT AvgTicketPrice) AS ctd_AvgTicketPrice_ok FROM kibana_sample_data_flights -SELECT MAX(AvgTicketPrice) AS max_AvgTicketPrice_ok FROM kibana_sample_data_flights -SELECT MIN(AvgTicketPrice) AS min_AvgTicketPrice_ok FROM kibana_sample_data_flights -SELECT sum((AvgTicketPrice * AvgTicketPrice)) AS temp(Calculation_462181953506873347)(1705728846)(0), sum(AvgTicketPrice) AS temp(Calculation_462181953506873347)(2465277995)(0), count(AvgTicketPrice) AS temp(Calculation_462181953506873347)(2633997250)(0) FROM kibana_sample_data_flights -SELECT count(DistanceMiles) AS temp(Calculation_462181953506873347)(2070533874)(0), sum(DistanceMiles) AS temp(Calculation_462181953506873347)(3496560911)(0), sum((DistanceMiles * DistanceMiles)) AS temp(Calculation_462181953506873347)(3595387140)(0) FROM kibana_sample_data_flights -SELECT SUM(dayOfWeek) AS usr_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT substring(OriginWeather, 1, 5) AS OriginWeather FROM kibana_sample_data_flights WHERE (substring(OriginWeather, 1, 5) = 'ABC') -SELECT sum((case when isnull(FlightDelayMin) then null when isnull(10) then null else greatest(FlightDelayMin, 10) end)) AS sum_Calculation_160722252357632000_ok FROM kibana_sample_data_flights -SELECT AvgTicketPrice AS AvgTicketPrice, Cancelled AS Cancelled, Carrier AS Carrier, DestAirportID AS DestAirportID, DestCityName AS DestCityName, DestCountry AS DestCountry, DestLocation AS DestLocation FROM kibana_sample_data_ecommerce INNER JOIN kibana_sample_data_flights ON (kibana_sample_data_ecommerce.day_of_week_i = dayOfWeek) LIMIT 1000 -SELECT AvgTicketPrice AS AvgTicketPrice, Cancelled AS Cancelled, Carrier AS Carrier, DestAirportID AS DestAirportID, DestCityName AS DestCityName, DestCountry AS DestCountry, DestLocation AS DestLocation FROM kibana_sample_data_ecommerce LEFT JOIN kibana_sample_data_flights ON (kibana_sample_data_ecommerce.day_of_week_i = dayOfWeek) LIMIT 1000 -SELECT AvgTicketPrice AS AvgTicketPrice, Cancelled AS Cancelled, Carrier AS Carrier, DestAirportID AS DestAirportID, DestCityName AS DestCityName, DestCountry AS DestCountry, DestLocation AS DestLocation FROM kibana_sample_data_ecommerce RIGHT JOIN kibana_sample_data_flights ON (kibana_sample_data_ecommerce.day_of_week_i = dayOfWeek) LIMIT 1000 -SELECT OriginCityName FROM kibana_sample_data_flights ORDER BY OriginCityName ASC -SELECT OriginCityName FROM kibana_sample_data_flights ORDER BY OriginCityName DESC -SELECT DestCityName, SUM(AvgTicketPrice) AS $__alias__0 FROM kibana_sample_data_flights ORDER BY $__alias__0 DESC, DestCityName ASC LIMIT 10 -SELECT AvgTicketPrice AS AvgTicketPrice, Cancelled AS Cancelled, Carrier AS Carrier FROM kibana_sample_data_ecommerce INNER JOIN kibana_sample_data_flights ON (kibana_sample_data_ecommerce.day_of_week_i = dayOfWeek) LIMIT 1000 -SELECT AvgTicketPrice AS AvgTicketPrice, Cancelled AS Cancelled, Carrier AS Carrier FROM kibana_sample_data_ecommerce LEFT JOIN kibana_sample_data_flights ON (kibana_sample_data_ecommerce.day_of_week_i = dayOfWeek) LIMIT 1000 -SELECT AvgTicketPrice AS AvgTicketPrice, Cancelled AS Cancelled, Carrier AS Carrier FROM kibana_sample_data_ecommerce RIGHT JOIN kibana_sample_data_flights ON (kibana_sample_data_ecommerce.day_of_week_i = dayOfWeek) LIMIT 1000 \ No newline at end of file +SELECT SUBSTRING(`opensearch_dashboards_sample_data_flights`.`OriginWeather`, 1, 1024) AS `OriginWeather` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT SUM(`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`) AS `sum_Offset_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(`opensearch_dashboards_sample_data_flights`.`FlightDelay`) AS `sum_FlightDelay_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(`opensearch_dashboards_sample_data_flights`.`DistanceMiles`) AS `sum_DistanceMiles_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT YEAR(`opensearch_dashboards_sample_data_flights`.`timestamp`) AS `yr_timestamp_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT SUM(ABS(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(ACOS(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252358221825_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(ASIN(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252358545410_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(ATAN(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252358811651_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(ATAN2(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`,`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`)) AS `sum_Calculation_160722252358811651_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(COS(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(COT(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(DEGREES(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM((`opensearch_dashboards_sample_data_flights`.`dayOfWeek` DIV `opensearch_dashboards_sample_data_flights`.`FlightDelayMin`)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(EXP(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM((((CASE WHEN (ABS((`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`) - (ROUND( ( (`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) - (ROUND( ( (`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN 1.5 ELSE 0.0 END) - (CASE WHEN ((`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) - (ROUND( ( (`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) / 3.0 ), 0 ) * 3.0) < 0.0) AND ((CASE WHEN (ABS((`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`) - (ROUND( ( (`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) - (ROUND( ( (`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN SQRT(3.0) / 2.0 ELSE 0.0 END) > 0.0) THEN 3.0 ELSE 0.0 END)) + (ROUND( ( (`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) / 3.0 ), 0 ) * 3.0))) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(ROUND( (((CASE WHEN (ABS((`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`) - (ROUND( ( (`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) - (ROUND( ( (`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN SQRT(3.0) / 2.0 ELSE 0.0 END) - (CASE WHEN ((`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`) - (ROUND( ( (`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`) / SQRT(3.0) ), 0 ) * SQRT(3.0)) < 0.0) AND ((CASE WHEN (ABS((`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`) - (ROUND( ( (`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) - (ROUND( ( (`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN SQRT(3.0) / 2.0 ELSE 0.0 END) > 0.0) THEN SQRT(3.0) ELSE 0.0 END)) + (ROUND( ( (`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`) / SQRT(3.0) ), 0 ) * SQRT(3.0))), 3)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(LOG(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM((LOG(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)/LOG(10))) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT MAX(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `usr_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT MIN(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `usr_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM((CASE WHEN `opensearch_dashboards_sample_data_flights`.`dayOfWeek` >= 0 OR FLOOR(2) = 2 THEN POWER(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`,2) END)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(RADIANS(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(ROUND(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(SIGN(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(SIN(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(SQRT(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(POWER(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`, 2)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(TAN(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(ASCII(SUBSTRING(`opensearch_dashboards_sample_data_flights`.`OriginWeather`, 1, 1024))) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT `opensearch_dashboards_sample_data_flights`.`Dest` AS `Dest` FROM `opensearch_dashboards_sample_data_flights` WHERE ((`opensearch_dashboards_sample_data_flights`.`Dest` = 'caching_sha2_password') AND (LOCATE('in',LOWER(`opensearch_dashboards_sample_data_flights`.`Dest`)) > 0)) GROUP BY 1 +SELECT SUBSTRING(`opensearch_dashboards_sample_data_flights`.`OriginWeather`, 1, 1024) AS `OriginWeather` FROM `opensearch_dashboards_sample_data_flights` WHERE (RIGHT(RTRIM(LOWER(SUBSTRING(`opensearch_dashboards_sample_data_flights`.`OriginWeather`, 1, 1024))), LENGTH('.')) = '.') GROUP BY 1 +SELECT SUM(IF(ISNULL(1), NULL, LOCATE('Cape',`opensearch_dashboards_sample_data_flights`.`Origin`,GREATEST(1,FLOOR(1))))) AS `sum_Calculation_462181953493630977_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT (CASE WHEN 3 >= 0 THEN LEFT(`opensearch_dashboards_sample_data_flights`.`Origin`,3) ELSE NULL END) AS `Calculation_462181953493630977` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT LENGTH(`opensearch_dashboards_sample_data_flights`.`Origin`) AS `Calculation_462181953493630977` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT LOWER(`opensearch_dashboards_sample_data_flights`.`Origin`) AS `Calculation_462181953493630977` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT LTRIM(`opensearch_dashboards_sample_data_flights`.`Origin`) AS `Calculation_462181953493630977` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT MAX(`opensearch_dashboards_sample_data_flights`.`Origin`) AS `usr_Calculation_462181953493630977_nk` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT IF(ISNULL(0), NULL, SUBSTRING(`opensearch_dashboards_sample_data_flights`.`Origin`,GREATEST(1,FLOOR(0)),FLOOR(5))) AS `Calculation_462181953493630977` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT MIN(`opensearch_dashboards_sample_data_flights`.`Origin`) AS `usr_Calculation_462181953493630977_nk` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT REPLACE(`opensearch_dashboards_sample_data_flights`.`Origin`,'Airport','') AS `Calculation_462181953493630977` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT (CASE WHEN 3 >= 0 THEN RIGHT(`opensearch_dashboards_sample_data_flights`.`Origin`,3) ELSE NULL END) AS `Calculation_462181953493630977` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT RTRIM(`opensearch_dashboards_sample_data_flights`.`Origin`) AS `Calculation_462181953493630977` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT IF(`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice` >= 0, SPACE(FLOOR(`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice`)), NULL) AS `Calculation_462181953493630977` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT TRIM(LEADING '-' FROM TRIM(LEADING SUBSTRING_INDEX(`opensearch_dashboards_sample_data_flights`.`Origin`, '-', (2 - 1)) FROM SUBSTRING_INDEX(`opensearch_dashboards_sample_data_flights`.`Origin`, '-', 2))) AS `Calculation_462181953493630977` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT SUBSTRING(`opensearch_dashboards_sample_data_flights`.`OriginWeather`, 1, 1024) AS `OriginWeather` FROM `opensearch_dashboards_sample_data_flights` WHERE (LEFT(LTRIM(LOWER(SUBSTRING(`opensearch_dashboards_sample_data_flights`.`OriginWeather`, 1, 1024))), LENGTH('$')) = '$') GROUP BY 1 +SELECT TRIM(`opensearch_dashboards_sample_data_flights`.`Origin`) AS `Calculation_462181953493630977` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT UPPER(`opensearch_dashboards_sample_data_flights`.`Origin`) AS `Calculation_462181953493630977` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT ADDDATE( DATE_FORMAT( DATE(`opensearch_dashboards_sample_data_flights`.`password_last_changed`), '%Y-01-01 00:00:00' ), INTERVAL 0 SECOND ) AS `tyr_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT YEAR(DATE(`opensearch_dashboards_sample_data_flights`.`timestamp`)) AS `yr_Calculation_462181953481519104_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT (YEAR(`opensearch_dashboards_sample_data_flights`.`timestamp`) - YEAR(DATE('1990-01-01'))) AS `Calculation_1706301351891775489` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT MONTHNAME(`opensearch_dashboards_sample_data_flights`.`timestamp`) AS `Calculation_1706301351891775489` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT YEAR(TIMESTAMP(STR_TO_DATE('5.April.2004', '%d.%i.%Y'))) AS `yr_Calculation_462181953481519104_ok` FROM `opensearch_dashboards_sample_data_flights` +SELECT YEAR(ADDDATE( CONCAT( DATE_FORMAT( `opensearch_dashboards_sample_data_flights`.`timestamp`, '%Y-' ), (3*(QUARTER(`opensearch_dashboards_sample_data_flights`.`timestamp`)-1)+1), '-01 00:00:00' ), INTERVAL 0 SECOND )) AS `yr_Calculation_1706301351891775489_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT DAYOFMONTH(`opensearch_dashboards_sample_data_flights`.`timestamp`) AS `Calculation_462181953481519104` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT 2019 AS `yr_Calculation_462181953481519104_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT YEAR(ADDTIME(CAST(CAST(`opensearch_dashboards_sample_data_flights`.`timestamp` AS DATE) AS DATETIME), TIME(`opensearch_dashboards_sample_data_flights`.`timestamp`))) AS `yr_Calculation_1706301351891775489_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT YEAR(MAKETIME(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`, `opensearch_dashboards_sample_data_flights`.`dayOfWeek`, `opensearch_dashboards_sample_data_flights`.`dayOfWeek`)) AS `yr_Calculation_1706301351891775489_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT MAX(`opensearch_dashboards_sample_data_flights`.`timestamp`) AS `max_timestamp_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT MIN(`opensearch_dashboards_sample_data_flights`.`timestamp`) AS `min_timestamp_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT MONTH(`opensearch_dashboards_sample_data_flights`.`timestamp`) AS `mn_timestamp_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT YEAR(NOW()) AS `yr_Calculation_462181953481519104_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT YEAR(CURDATE()) AS `yr_Calculation_462181953481519104_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT YEAR(`opensearch_dashboards_sample_data_flights`.`timestamp`) AS `yr_timestamp_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT ((`opensearch_dashboards_sample_data_flights`.`Origin` = 'Frankfurt am Main Airport') AND (`opensearch_dashboards_sample_data_flights`.`Dest` = 'Sydney Kingsford Smith International Airport')) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT (CASE `opensearch_dashboards_sample_data_flights`.`OriginWeather` WHEN 'Sunny' THEN '1' WHEN 'Rain' THEN '0' ELSE 'NA' END) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT (CASE WHEN (`opensearch_dashboards_sample_data_flights`.`FlightDelay` = 0) THEN 'No delay' ELSE CAST(NULL AS CHAR(1)) END) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT (CASE WHEN (`opensearch_dashboards_sample_data_flights`.`FlightDelay` = 0) THEN 'No delay' WHEN (`opensearch_dashboards_sample_data_flights`.`FlightDelay` = 1) THEN 'Delay' ELSE CAST(NULL AS CHAR(1)) END) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT (RIGHT(RTRIM(`opensearch_dashboards_sample_data_flights`.`Origin`), LENGTH('Airport')) = 'Airport') AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT (CASE WHEN (`opensearch_dashboards_sample_data_flights`.`FlightDelay` = 0) THEN 'No delay' ELSE CAST(NULL AS CHAR(1)) END) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT IFNULL(`opensearch_dashboards_sample_data_flights`.`Cancelled`, `opensearch_dashboards_sample_data_flights`.`AvgTicketPrice`) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT (CASE WHEN (`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice` > 500) THEN 'High' WHEN NOT (`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice` > 500) THEN 'Low' ELSE NULL END) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT (NOT ISNULL(DATE_FORMAT(`opensearch_dashboards_sample_data_flights`.`Origin`, '%Y'))) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT ISNULL(`opensearch_dashboards_sample_data_flights`.`FlightNum`) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT MAX(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `max_max_questions_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT MIN(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `min_max_questions_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT (NOT ISNULL(DATE_FORMAT(`opensearch_dashboards_sample_data_flights`.`Origin`, '%Y'))) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT ((`opensearch_dashboards_sample_data_flights`.`Origin` = 'Frankfurt am Main Airport') OR (`opensearch_dashboards_sample_data_flights`.`Dest` = 'Sydney Kingsford Smith International Airport')) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT (CASE WHEN (`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice` > 500) THEN 'High' WHEN NOT (`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice` > 500) THEN 'Low' ELSE NULL END) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT (CASE WHEN (`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice` > 500) THEN 'High' WHEN NOT (`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice` > 500) THEN 'Low' ELSE NULL END) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT IFNULL(`opensearch_dashboards_sample_data_flights`.`FlightDelay`, 0) AS `Calculation_462181953506873347` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT MIN(`opensearch_dashboards_sample_data_flights`.`Origin`) AS `TEMP(Calculation_462181953504628738)(2376748618)(0)`, MAX(`opensearch_dashboards_sample_data_flights`.`Origin`) AS `TEMP(Calculation_462181953504628738)(2968235173)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT AVG(`opensearch_dashboards_sample_data_flights`.`FlightDelayMin`) AS `avg_max_user_connections_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(1) AS `cnt_max_user_connections_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT MAX(`opensearch_dashboards_sample_data_flights`.`max_questions`) AS `max_max_questions_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT MIN(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `min_max_questions_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM((`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice` * `opensearch_dashboards_sample_data_flights`.`AvgTicketPrice`)) AS `TEMP(Calculation_462181953506873347)(1705728846)(0)`, SUM(`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(Calculation_462181953506873347)(2465277995)(0)`, COUNT(`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(Calculation_462181953506873347)(2633997250)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT COUNT(`opensearch_dashboards_sample_data_flights`.`DistanceMiles`) AS `TEMP(Calculation_462181953506873347)(2070533874)(0)`, SUM(`opensearch_dashboards_sample_data_flights`.`DistanceMiles`) AS `TEMP(Calculation_462181953506873347)(3496560911)(0)`, SUM((`opensearch_dashboards_sample_data_flights`.`DistanceMiles` * `opensearch_dashboards_sample_data_flights`.`DistanceMiles`)) AS `TEMP(Calculation_462181953506873347)(3595387140)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `usr_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `TEMP(Calculation_462181953506873347)(105357904)(0)`, COUNT(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `TEMP(Calculation_462181953506873347)(2584840543)(0)`, SUM(((`opensearch_dashboards_sample_data_flights`.`dayOfWeek` + 0.0) * (`opensearch_dashboards_sample_data_flights`.`dayOfWeek` + 0.0))) AS `TEMP(Calculation_462181953506873347)(3340567470)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT SUM(`opensearch_dashboards_sample_data_flights`.`DistanceKilometers`) AS `TEMP(Calculation_462181953506873347)(1474522238)(0)`, COUNT(`opensearch_dashboards_sample_data_flights`.`DistanceKilometers`) AS `TEMP(Calculation_462181953506873347)(2841334535)(0)`, SUM((`opensearch_dashboards_sample_data_flights`.`DistanceKilometers` * `opensearch_dashboards_sample_data_flights`.`DistanceKilometers`)) AS `TEMP(Calculation_462181953506873347)(461715975)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 +SELECT SUBSTRING(`opensearch_dashboards_sample_data_flights`.`OriginWeather`, 1, 1024) AS `OriginWeather` FROM `opensearch_dashboards_sample_data_flights` WHERE (SUBSTRING(`opensearch_dashboards_sample_data_flights`.`OriginWeather`, 1, 1024) = 'ABC') GROUP BY 1 +SELECT SUM((CASE \tWHEN ISNULL(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) THEN NULL \tWHEN ISNULL(10) THEN NULL \tELSE GREATEST(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`, 10) END)) AS `sum_Calculation_160722252357632000_ok` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT `opensearch_dashboards_sample_data_flights`.`AvgTicketPrice` AS `AvgTicketPrice`, `opensearch_dashboards_sample_data_flights`.`Cancelled` AS `Cancelled`, `opensearch_dashboards_sample_data_flights`.`Carrier` AS `Carrier`, `opensearch_dashboards_sample_data_flights`.`DestAirportID` AS `DestAirportID`, `opensearch_dashboards_sample_data_flights`.`DestCityName` AS `DestCityName`, `opensearch_dashboards_sample_data_flights`.`DestCountry` AS `DestCountry`, `opensearch_dashboards_sample_data_flights`.`DestLocation` AS `DestLocation`, `opensearch_dashboards_sample_data_flights`.`DestRegion` AS `Dest~~~<<>>~~~e`.`opensearch_dashboards_sample_data_flights` AS `opensearch_dashboards_sample_data_flights` FROM `opensearch_dashboards_sample_data_ecommerce` LEFT JOIN `opensearch_dashboards_sample_data_flights` ON (`opensearch_dashboards_sample_data_ecommerce`.`day_of_week_i` = `opensearch_dashboards_sample_data_flights`.`dayOfWeek`) LIMIT 1000 +SELECT `opensearch_dashboards_sample_data_flights`.`AvgTicketPrice` AS `AvgTicketPrice`, `opensearch_dashboards_sample_data_flights`.`Cancelled` AS `Cancelled`, `opensearch_dashboards_sample_data_flights`.`Carrier` AS `Carrier`, `opensearch_dashboards_sample_data_flights`.`DestAirportID` AS `DestAirportID`, `opensearch_dashboards_sample_data_flights`.`DestCityName` AS `DestCityName`, `opensearch_dashboards_sample_data_flights`.`DestCountry` AS `DestCountry`, `opensearch_dashboards_sample_data_flights`.`DestLocation` AS `DestLocation`, `opensearch_dashboards_sample_data_flights`.`DestRegion` AS `Dest~~~<<>>~~~`.`opensearch_dashboards_sample_data_flights` AS `opensearch_dashboards_sample_data_flights` FROM `opensearch_dashboards_sample_data_ecommerce` RIGHT JOIN `opensearch_dashboards_sample_data_flights` ON (`opensearch_dashboards_sample_data_ecommerce`.`day_of_week_i` = `opensearch_dashboards_sample_data_flights`.`dayOfWeek`) LIMIT 1000 +SELECT `opensearch_dashboards_sample_data_flights`.`OriginCityName` AS `OriginCityName` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 ORDER BY `OriginCityName` ASC +SELECT `opensearch_dashboards_sample_data_flights`.`OriginCityName` AS `OriginCityName` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 ORDER BY `OriginCityName` ASC +SELECT `opensearch_dashboards_sample_data_flights`.`DestCityName` AS `DestCityName`, SUM(`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice`) AS `$__alias__0` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1 ORDER BY `$__alias__0` DESC, `DestCityName` ASC LIMIT 10 +SELECT 'DESKTOP-7APIVOE\\\\Rupal' AS `Calculation_1122522251639717888` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT 0 AS `Calculation_1122522251639717888` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT 0 AS `Calculation_1122522251639717888` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000002 +SELECT 1 AS `Calculation_1122522251639717888` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT 'DESKTOP-7APIVOE' AS `Calculation_1122522251639717888` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT 'ABC' AS `Calculation_1122522251639717888` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT MAX(`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TC_)(3575797393)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `TEMP(TEMP(TC_)(4001152001)(0))(105357904)(0)`, COUNT(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `TEMP(TEMP(TC_)(4001152001)(0))(2584840543)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT MIN(`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TC_)(2076389572)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TEMP(TC_)(4079199159)(0))(2465277995)(0)`, COUNT(`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TEMP(TC_)(4079199159)(0))(2633997250)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TC_)(2465277995)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT COUNT(`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TC_)(2633997250)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT MAX(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `TEMP(TC_)(718966039)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT MIN(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `TEMP(TC_)(2462140059)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT SUM(`opensearch_dashboards_sample_data_flights`.`dayOfWeek`) AS `TEMP(TC_)(105357904)(0)`, SUM(`opensearch_dashboards_sample_data_flights`.`AvgTicketPrice`) AS `TEMP(TC_)(2465277995)(0)` FROM `opensearch_dashboards_sample_data_flights` GROUP BY 1.1000000000000001 +SELECT 1 AS `empty` FROM `opensearch_dashboards_sample_data_flights` +SELECT substring(OriginWeather, 1, 2) AS OriginWeather FROM opensearch_dashboards_sample_data_flights +SELECT SUM(FlightDelayMin) AS sum_FlightDelayMin_ok FROM opensearch_dashboards_sample_data_flights +SELECT SUM(FlightDelay) AS sum_FlightDelay_ok FROM opensearch_dashboards_sample_data_flights +SELECT SUM(DistanceMiles) AS sum_DistanceMiles_ok FROM opensearch_dashboards_sample_data_flights +SELECT year(timestamp) AS yr_timestamp_ok FROM opensearch_dashboards_sample_data_flights +SELECT abs(AvgTicketPrice) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT acos(FlightDelayMin) AS sum_Calculation_160722252358221825_ok FROM opensearch_dashboards_sample_data_flights +SELECT asin(FlightDelayMin) AS sum_Calculation_160722252358545410_ok FROM opensearch_dashboards_sample_data_flights +SELECT atan(FlightDelayMin) AS sum_Calculation_160722252358811651_ok FROM opensearch_dashboards_sample_data_flights +SELECT atan2(FlightDelayMin,dayOfWeek) AS sum_Calculation_160722252358811651_ok FROM opensearch_dashboards_sample_data_flights +SELECT SUM(FlightDelayMin) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT cos(FlightDelayMin) AS sum_Calculation_160722252358221825_ok FROM opensearch_dashboards_sample_data_flights +SELECT cot(AvgTicketPrice) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT degrees(FlightDelayMin) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT FlightDelayMin div AvgTicketPrice AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT exp(FlightDelayMin) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT SUM(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT SUM((((CASE WHEN (ABS((AvgTicketPrice) - (ROUND( ( (AvgTicketPrice) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((FlightDelayMin) - (ROUND( ( (FlightDelayMin) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN 1.5 ELSE 0.0 END) - (CASE WHEN ((FlightDelayMin) - (ROUND( ( (FlightDelayMin) / 3.0 ), 0 ) * 3.0) < 0.0) AND ((CASE WHEN (ABS((AvgTicketPrice) - (ROUND( ( (AvgTicketPrice) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((FlightDelayMin) - (ROUND( ( (FlightDelayMin) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN SQRT(3.0) / 2.0 ELSE 0.0 END) > 0.0) THEN 3.0 ELSE 0.0 END)) + (ROUND( ( (FlightDelayMin) / 3.0 ), 0 ) * 3.0))) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT SUM(ROUND( (((CASE WHEN (ABS((AvgTicketPrice) - (ROUND( ( (AvgTicketPrice) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((FlightDelayMin) - (ROUND( ( (FlightDelayMin) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN SQRT(3.0) / 2.0 ELSE 0.0 END) - (CASE WHEN ((AvgTicketPrice) - (ROUND( ( (AvgTicketPrice) / SQRT(3.0) ), 0 ) * SQRT(3.0)) < 0.0) AND ((CASE WHEN (ABS((AvgTicketPrice) - (ROUND( ( (AvgTicketPrice) / SQRT(3.0) ), 0 ) * SQRT(3.0)))) + SQRT(3.0) * ((ABS((FlightDelayMin) - (ROUND( ( (FlightDelayMin) / 3.0 ), 0 ) * 3.0))) - 1.0) > 0.0 THEN SQRT(3.0) / 2.0 ELSE 0.0 END) > 0.0) THEN SQRT(3.0) ELSE 0.0 END)) + (ROUND( ( (AvgTicketPrice) / SQRT(3.0) ), 0 ) * SQRT(3.0))), 3)) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT log(FlightDelayMin) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT (log(FlightDelayMin)/log(10)) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT MAX(FlightDelayMin) AS usr_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT MIN(FlightDelayMin) AS usr_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT sum((case when dayOfWeek >= 0 or floor(2) = 2 then power(dayOfWeek,2) end)) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT radians(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT round(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT sign(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT sin(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT sqrt(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT power(dayOfWeek, 2) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT tan(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT SUM(dayOfWeek) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT ascii(substring(OriginWeather, 1, 5)) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT Dest, locate('air',Dest) FROM opensearch_dashboards_sample_data_flights +SELECT substring(OriginWeather, 1, 1024) AS OriginWeather FROM opensearch_dashboards_sample_data_flights WHERE (right(rtrim(lower(substring(OriginWeather, 1, 5))), length('.')) ='.') +SELECT sum(if(isnull(1), null, locate('Cape',Origin,greatest(1,floor(1))))) AS sum_Calculation_462181953493630977_ok FROM opensearch_dashboards_sample_data_flights +SELECT (case when 3 >= 0 then left(Origin,3) else null end) AS Calculation_462181953493630977 FROM opensearch_dashboards_sample_data_flights +SELECT length(Origin) AS Calculation_462181953493630977 FROM opensearch_dashboards_sample_data_flights +SELECT lower(Origin) AS Calculation_462181953493630977 FROM opensearch_dashboards_sample_data_flights +SELECT ltrim(Origin) AS Calculation_462181953493630977 FROM opensearch_dashboards_sample_data_flights +SELECT max(Origin) AS usr_Calculation_462181953493630977_nk FROM opensearch_dashboards_sample_data_flights +SELECT if(isnull(0), null, substring(Origin,greatest(1,floor(0)),floor(5))) AS Calculation_462181953493630977 FROM opensearch_dashboards_sample_data_flights +SELECT min(Origin) AS usr_Calculation_462181953493630977_nk FROM opensearch_dashboards_sample_data_flights +SELECT replace(Origin,'Airport','') AS Calculation_462181953493630977 FROM opensearch_dashboards_sample_data_flights +SELECT (case when 3 >= 0 then right(Origin,3) else null end) AS Calculation_462181953493630977 FROM opensearch_dashboards_sample_data_flights +SELECT rtrim(Origin) AS Calculation_462181953493630977 FROM opensearch_dashboards_sample_data_flights +SELECT if(AvgTicketPrice >= 0, space(floor(AvgTicketPrice)), null) AS Calculation_462181953493630977 FROM opensearch_dashboards_sample_data_flights +SELECT trim(leading '-' FROM trim(leading substring(Origin, '-', (2 - 1)) FROM substring_index(Origin, '-', 2))) AS Calculation_462181953493630977 FROM opensearch_dashboards_sample_data_flights +SELECT substring(OriginWeather, 1, 5) AS OriginWeather FROM opensearch_dashboards_sample_data_flights where (left(ltrim(lower(substring(OriginWeather, 1, 5))), length('$')) = '$') +SELECT trim(Origin) AS Calculation_462181953493630977 FROM opensearch_dashboards_sample_data_flights +SELECT upper(Origin) AS Calculation_462181953493630977 FROM opensearch_dashboards_sample_data_flights +SELECT adddate( date_format( date(timestamp), '%Y-01-01 00:00:00' ), interval 0 second ) AS tyr_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT year(date(timestamp)) AS yr_Calculation_462181953481519104_ok FROM opensearch_dashboards_sample_data_flights +SELECT year(timestamp(str_to_date('5.April.2004', '%d.%i.%Y'))) AS yr_Calculation_462181953481519104_ok FROM opensearch_dashboards_sample_data_flights +SELECT dayofmonth(timestamp) AS Calculation_462181953481519104 FROM opensearch_dashboards_sample_data_flights +SELECT 2019 AS yr_Calculation_462181953481519104_ok FROM opensearch_dashboards_sample_data_flights +SELECT max(timestamp) AS max_timestamp_ok FROM opensearch_dashboards_sample_data_flights +SELECT min(timestamp) AS max_timestamp_ok FROM opensearch_dashboards_sample_data_flights +SELECT month(timestamp) AS mn_timestamp_ok FROM opensearch_dashboards_sample_data_flights +SELECT year(now()) AS yr_Calculation_462181953481519104_ok FROM opensearch_dashboards_sample_data_flights +SELECT year(curdate()) AS yr_Calculation_462181953481519104_ok FROM opensearch_dashboards_sample_data_flights +SELECT year(timestamp) AS yr_timestamp_ok FROM opensearch_dashboards_sample_data_flights +SELECT ((Origin = 'Frankfurt am Main Airport') and (Dest = 'Sydney Kingsford Smith International Airport')) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT (case OriginWeather when 'Sunny' then '1' when 'Rain' then '0' else 'NA' end) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT (case when (FlightDelay = 0) then 'No delay' else cast(null as char(1)) end) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT (case when (FlightDelay = 0) then 'No delay' when (FlightDelay = 1) then 'Delay' else cast(null as char(1)) end) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT (right(rtrim(Origin), length('Airport')) = 'Airport') AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT (case when (FlightDelay = 0) then 'No delay' else cast(null as char(1)) end) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT ifnull(Cancelled, AvgTicketPrice) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT (case when (AvgTicketPrice > 500) THEN 'High' when not (AvgTicketPrice > 500) then 'Low' else null end) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT (not isnull(date_format(Origin, '%Y'))) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT isnull(FlightNum) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT MAX(AvgTicketPrice) AS max_AvgTicketPrice_ok FROM opensearch_dashboards_sample_data_flights +SELECT MIN(AvgTicketPrice) AS min_AvgTicketPrice_ok FROM opensearch_dashboards_sample_data_flights +SELECT (not isnull(date_format(Origin, '%Y'))) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT ((Origin = 'Frankfurt am Main Airport') or (Dest = 'Sydney Kingsford Smith International Airport')) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT (case when (AvgTicketPrice > 500) THEN 'High' when not (AvgTicketPrice > 500) then 'Low' else null end) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT (case when (AvgTicketPrice > 500) THEN 'High' when not (AvgTicketPrice > 500) then 'Low' else null end) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT ifnull(FlightDelay, 0) AS Calculation_462181953506873347 FROM opensearch_dashboards_sample_data_flights +SELECT min(Origin) AS temp(Calculation_462181953504628738)(2376748618)(0), max(Origin) AS temp(Calculation_462181953504628738)(2968235173)(0) FROM opensearch_dashboards_sample_data_flights +SELECT AVG(dayOfWeek) AS avg_dayOfWeek_ok FROM opensearch_dashboards_sample_data_flights +SELECT SUM(1) AS cnt_dayOfWeek_ok FROM opensearch_dashboards_sample_data_flights +SELECT COUNT(DISTINCT AvgTicketPrice) AS ctd_AvgTicketPrice_ok FROM opensearch_dashboards_sample_data_flights +SELECT MAX(AvgTicketPrice) AS max_AvgTicketPrice_ok FROM opensearch_dashboards_sample_data_flights +SELECT MIN(AvgTicketPrice) AS min_AvgTicketPrice_ok FROM opensearch_dashboards_sample_data_flights +SELECT sum((AvgTicketPrice * AvgTicketPrice)) AS temp(Calculation_462181953506873347)(1705728846)(0), sum(AvgTicketPrice) AS temp(Calculation_462181953506873347)(2465277995)(0), count(AvgTicketPrice) AS temp(Calculation_462181953506873347)(2633997250)(0) FROM opensearch_dashboards_sample_data_flights +SELECT count(DistanceMiles) AS temp(Calculation_462181953506873347)(2070533874)(0), sum(DistanceMiles) AS temp(Calculation_462181953506873347)(3496560911)(0), sum((DistanceMiles * DistanceMiles)) AS temp(Calculation_462181953506873347)(3595387140)(0) FROM opensearch_dashboards_sample_data_flights +SELECT SUM(dayOfWeek) AS usr_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT substring(OriginWeather, 1, 5) AS OriginWeather FROM opensearch_dashboards_sample_data_flights WHERE (substring(OriginWeather, 1, 5) = 'ABC') +SELECT sum((case when isnull(FlightDelayMin) then null when isnull(10) then null else greatest(FlightDelayMin, 10) end)) AS sum_Calculation_160722252357632000_ok FROM opensearch_dashboards_sample_data_flights +SELECT AvgTicketPrice AS AvgTicketPrice, Cancelled AS Cancelled, Carrier AS Carrier, DestAirportID AS DestAirportID, DestCityName AS DestCityName, DestCountry AS DestCountry, DestLocation AS DestLocation FROM opensearch_dashboards_sample_data_ecommerce INNER JOIN opensearch_dashboards_sample_data_flights ON (opensearch_dashboards_sample_data_ecommerce.day_of_week_i = dayOfWeek) LIMIT 1000 +SELECT AvgTicketPrice AS AvgTicketPrice, Cancelled AS Cancelled, Carrier AS Carrier, DestAirportID AS DestAirportID, DestCityName AS DestCityName, DestCountry AS DestCountry, DestLocation AS DestLocation FROM opensearch_dashboards_sample_data_ecommerce LEFT JOIN opensearch_dashboards_sample_data_flights ON (opensearch_dashboards_sample_data_ecommerce.day_of_week_i = dayOfWeek) LIMIT 1000 +SELECT AvgTicketPrice AS AvgTicketPrice, Cancelled AS Cancelled, Carrier AS Carrier, DestAirportID AS DestAirportID, DestCityName AS DestCityName, DestCountry AS DestCountry, DestLocation AS DestLocation FROM opensearch_dashboards_sample_data_ecommerce RIGHT JOIN opensearch_dashboards_sample_data_flights ON (opensearch_dashboards_sample_data_ecommerce.day_of_week_i = dayOfWeek) LIMIT 1000 +SELECT OriginCityName FROM opensearch_dashboards_sample_data_flights ORDER BY OriginCityName ASC +SELECT OriginCityName FROM opensearch_dashboards_sample_data_flights ORDER BY OriginCityName DESC +SELECT DestCityName, SUM(AvgTicketPrice) AS $__alias__0 FROM opensearch_dashboards_sample_data_flights ORDER BY $__alias__0 DESC, DestCityName ASC LIMIT 10 +SELECT AvgTicketPrice AS AvgTicketPrice, Cancelled AS Cancelled, Carrier AS Carrier FROM opensearch_dashboards_sample_data_ecommerce INNER JOIN opensearch_dashboards_sample_data_flights ON (opensearch_dashboards_sample_data_ecommerce.day_of_week_i = dayOfWeek) LIMIT 1000 +SELECT AvgTicketPrice AS AvgTicketPrice, Cancelled AS Cancelled, Carrier AS Carrier FROM opensearch_dashboards_sample_data_ecommerce LEFT JOIN opensearch_dashboards_sample_data_flights ON (opensearch_dashboards_sample_data_ecommerce.day_of_week_i = dayOfWeek) LIMIT 1000 +SELECT AvgTicketPrice AS AvgTicketPrice, Cancelled AS Cancelled, Carrier AS Carrier FROM opensearch_dashboards_sample_data_ecommerce RIGHT JOIN opensearch_dashboards_sample_data_flights ON (opensearch_dashboards_sample_data_ecommerce.day_of_week_i = dayOfWeek) LIMIT 1000 \ No newline at end of file diff --git a/sql-odbc/src/PerformanceTests/PTODBCExecution/performance_odbc_execution.cpp b/sql-odbc/src/PerformanceTests/PTODBCExecution/performance_odbc_execution.cpp index e1d7942366..04be5012a2 100644 --- a/sql-odbc/src/PerformanceTests/PTODBCExecution/performance_odbc_execution.cpp +++ b/sql-odbc/src/PerformanceTests/PTODBCExecution/performance_odbc_execution.cpp @@ -16,7 +16,7 @@ // clang-format off #include "chrono" -#include +#include #include #include #include @@ -24,7 +24,7 @@ #define IT_SIZEOF(x) (NULL == (x) ? 0 : (sizeof((x)) / sizeof((x)[0]))) #define ITERATION_COUNT 12 std::wstring dsn_name = L"DSN=test_dsn"; -const wchar_t* const query = L"SELECT * FROM kibana_sample_data_flights limit 10000"; +const wchar_t* const query = L"SELECT * FROM opensearch_dashboards_sample_data_flights limit 10000"; int Setup(SQLHENV* env, SQLHDBC* conn, SQLHSTMT* hstmt) { SQLTCHAR out_conn_string[1024]; diff --git a/sql-odbc/src/PerformanceTests/PTODBCInfo/performance_odbc_info.cpp b/sql-odbc/src/PerformanceTests/PTODBCInfo/performance_odbc_info.cpp index b5755ea9cc..9481cd02f0 100644 --- a/sql-odbc/src/PerformanceTests/PTODBCInfo/performance_odbc_info.cpp +++ b/sql-odbc/src/PerformanceTests/PTODBCInfo/performance_odbc_info.cpp @@ -16,7 +16,7 @@ // clang-format off #include "pch.h" -#include "es_communication.h" +#include "opensearch_communication.h" #include "unit_test_helper.h" #include "it_odbc_helper.h" #include "chrono" @@ -78,19 +78,19 @@ runtime_options rt_opts = []() { void GetVersionInfoString(std::string& version_info) { // Connect to DB - ESCommunication es_comm; - es_comm.ConnectionOptions(rt_opts, false, 0, 0); - ASSERT_TRUE(es_comm.ConnectDBStart()); + OpenSearchCommunication opensearch_comm; + opensearch_comm.ConnectionOptions(rt_opts, false, 0, 0); + ASSERT_TRUE(opensearch_comm.ConnectDBStart()); // Issue request std::string endpoint, content_type, query, fetch_size; std::shared_ptr< Aws::Http::HttpResponse > response = - es_comm.IssueRequest(endpoint, Aws::Http::HttpMethod::HTTP_GET, + opensearch_comm.IssueRequest(endpoint, Aws::Http::HttpMethod::HTTP_GET, content_type, query, fetch_size); // Convert response to string ASSERT_TRUE(response != nullptr); - es_comm.AwsHttpResponseToString(response, version_info); + opensearch_comm.AwsHttpResponseToString(response, version_info); } void ParseVersionInfoString( diff --git a/sql-odbc/src/PerformanceTests/PTODBCResults/performance_odbc_results.cpp b/sql-odbc/src/PerformanceTests/PTODBCResults/performance_odbc_results.cpp index b435b5e3c5..6304e208a5 100644 --- a/sql-odbc/src/PerformanceTests/PTODBCResults/performance_odbc_results.cpp +++ b/sql-odbc/src/PerformanceTests/PTODBCResults/performance_odbc_results.cpp @@ -37,7 +37,7 @@ typedef SQLLEN SQLROWOFFSET; #endif const wchar_t* const m_query = - L"SELECT * FROM kibana_sample_data_flights limit 10000"; + L"SELECT * FROM opensearch_dashboards_sample_data_flights limit 10000"; typedef struct Col { SQLLEN data_len; diff --git a/sql-odbc/src/PowerBIConnector/OdfeSqlOdbcPBIConnector.pq b/sql-odbc/src/PowerBIConnector/OdfeSqlOdbcPBIConnector.pq index e5659bf21f..1ae78f11df 100644 --- a/sql-odbc/src/PowerBIConnector/OdfeSqlOdbcPBIConnector.pq +++ b/sql-odbc/src/PowerBIConnector/OdfeSqlOdbcPBIConnector.pq @@ -14,12 +14,12 @@ shared OdfeSqlOdbcPBIConnector.Contents = Value.ReplaceType(OdfeSqlOdbcPBIConnec OdfeSqlOdbcPBIConnectorType = type function ( Server as (type text meta [ Documentation.FieldCaption = "Server", - Documentation.FieldDescription = "The hostname of the Open Distro For Elasticsearch server.", + Documentation.FieldDescription = "The hostname of the OpenSearch server.", Documentation.SampleValues = { "localhost:9200" } ]) ) as table meta [ - Documentation.Name = "Open Distro For Elasticsearch" + Documentation.Name = "OpenSearch" ]; OdfeSqlOdbcPBIConnectorImpl = (Server as text) as table => @@ -149,7 +149,7 @@ OnOdbcError = (errorRecord as record) => OdbcErrorCode = 202 in if IsDriverNotInstalled then - error Error.Record("", "The Open Distro For Elasticsearch SQL ODBC driver is not installed. Please install the driver") + error Error.Record("", "The OpenSearch SQL ODBC driver is not installed. Please install the driver") else if IsHostUnreachable then error Error.Record("", "Couldn't reach server. Please double-check the server and auth. [" & ConnectionServer & "]") else diff --git a/sql-odbc/src/PowerBIConnector/resources.resx b/sql-odbc/src/PowerBIConnector/resources.resx index 8fe822c55c..3642a474fe 100644 --- a/sql-odbc/src/PowerBIConnector/resources.resx +++ b/sql-odbc/src/PowerBIConnector/resources.resx @@ -118,12 +118,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Connect to Open Distro For Elasticsearch + Connect to OpenSearch - Open Distro For Elasticsearch + OpenSearch - Open Distro For Elasticsearch + OpenSearch \ No newline at end of file diff --git a/sql-odbc/src/TableauConnector/odfe_sql_odbc/README.md b/sql-odbc/src/TableauConnector/odfe_sql_odbc/README.md index 6498f886a5..c1a8a8a994 100644 --- a/sql-odbc/src/TableauConnector/odfe_sql_odbc/README.md +++ b/sql-odbc/src/TableauConnector/odfe_sql_odbc/README.md @@ -1,6 +1,6 @@ ## odfe_sql_odbc -The connector files in `odfe_sql_odbc` can be used to connect to elasticsearch server in Tableau. +The connector files in `odfe_sql_odbc` can be used to connect to OpenSearch server in Tableau. * These connector files remove and modify a set of unsupported functions and operations. * It includes set of capabilities to customize and tune connector behavior diff --git a/sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml b/sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml index 0493b5c286..8fe3aad626 100644 --- a/sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml +++ b/sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml @@ -1,10 +1,10 @@ - + - - + + @@ -37,7 +37,7 @@ diff --git a/sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/manifest.xml b/sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/manifest.xml index 8ba3c4a33a..dcc45b9b53 100644 --- a/sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/manifest.xml +++ b/sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/manifest.xml @@ -1,13 +1,13 @@ - + - - - + + + - + diff --git a/sql-odbc/src/UnitTests/UTConn/test_conn.cpp b/sql-odbc/src/UnitTests/UTConn/test_conn.cpp index 69ea55e612..b12b2502d0 100644 --- a/sql-odbc/src/UnitTests/UTConn/test_conn.cpp +++ b/sql-odbc/src/UnitTests/UTConn/test_conn.cpp @@ -17,7 +17,7 @@ // clang-format off #include "pch.h" #include "unit_test_helper.h" -#include "es_communication.h" +#include "opensearch_communication.h" // clang-format on const size_t valid_option_count = 4; @@ -44,21 +44,21 @@ runtime_options missing_opt_val = {{"", "", "1", "0"}, {"BASIC", "", invalid_pw, valid_region}, {use_ssl, false, "", "", "", ""}}; -TEST(TestESConnConnectionOptions, ValidParameters) { - ESCommunication conn; +TEST(TestOpenSearchConnConnectionOptions, ValidParameters) { + OpenSearchCommunication conn; EXPECT_EQ(true, conn.ConnectionOptions(valid_opt_val, 1, 1, valid_option_count)); } -TEST(TestESConnConnectionOptions, MissingParameters) { - ESCommunication conn; +TEST(TestOpenSearchConnConnectionOptions, MissingParameters) { + OpenSearchCommunication conn; EXPECT_EQ(false, conn.ConnectionOptions(missing_opt_val, 1, 1, missing_option_count)); } -class TestESConnConnectDBStart : public testing::Test { +class TestOpenSearchConnConnectDBStart : public testing::Test { public: - TestESConnConnectDBStart() { + TestOpenSearchConnConnectDBStart() { } void SetUp() { @@ -68,36 +68,36 @@ class TestESConnConnectDBStart : public testing::Test { m_conn.DropDBConnection(); } - ~TestESConnConnectDBStart() { + ~TestOpenSearchConnConnectDBStart() { // cleanup any pending stuff, but no exceptions allowed } - ESCommunication m_conn; + OpenSearchCommunication m_conn; }; -TEST_F(TestESConnConnectDBStart, ValidParameters) { +TEST_F(TestOpenSearchConnConnectDBStart, ValidParameters) { ASSERT_NE(false, m_conn.ConnectionOptions(valid_opt_val, 1, 1, valid_option_count)); EXPECT_EQ(true, m_conn.ConnectDBStart()); EXPECT_EQ(CONNECTION_OK, m_conn.GetConnectionStatus()); } -TEST_F(TestESConnConnectDBStart, InvalidParameters) { +TEST_F(TestOpenSearchConnConnectDBStart, InvalidParameters) { ASSERT_TRUE( m_conn.ConnectionOptions(invalid_opt_val, 1, 1, invalid_option_count)); EXPECT_EQ(false, m_conn.ConnectDBStart()); EXPECT_EQ(CONNECTION_BAD, m_conn.GetConnectionStatus()); } -TEST_F(TestESConnConnectDBStart, MissingParameters) { +TEST_F(TestOpenSearchConnConnectDBStart, MissingParameters) { ASSERT_NE(true, m_conn.ConnectionOptions(missing_opt_val, 1, 1, missing_option_count)); EXPECT_EQ(false, m_conn.ConnectDBStart()); EXPECT_EQ(CONNECTION_BAD, m_conn.GetConnectionStatus()); } -TEST(TestESConnDropDBConnection, InvalidParameters) { - ESCommunication conn; +TEST(TestOpenSearchConnDropDBConnection, InvalidParameters) { + OpenSearchCommunication conn; ASSERT_EQ(CONNECTION_BAD, conn.GetConnectionStatus()); ASSERT_TRUE( conn.ConnectionOptions(invalid_opt_val, 1, 1, invalid_option_count)); @@ -107,8 +107,8 @@ TEST(TestESConnDropDBConnection, InvalidParameters) { EXPECT_EQ(CONNECTION_BAD, conn.GetConnectionStatus()); } -TEST(TestESConnDropDBConnection, MissingParameters) { - ESCommunication conn; +TEST(TestOpenSearchConnDropDBConnection, MissingParameters) { + OpenSearchCommunication conn; ASSERT_EQ(CONNECTION_BAD, conn.GetConnectionStatus()); ASSERT_NE(true, conn.ConnectionOptions(missing_opt_val, 1, 1, missing_option_count)); @@ -118,8 +118,8 @@ TEST(TestESConnDropDBConnection, MissingParameters) { EXPECT_EQ(CONNECTION_BAD, conn.GetConnectionStatus()); } -TEST(TestESConnDropDBConnection, ValidParameters) { - ESCommunication conn; +TEST(TestOpenSearchConnDropDBConnection, ValidParameters) { + OpenSearchCommunication conn; ASSERT_NE(false, conn.ConnectionOptions(valid_opt_val, 1, 1, valid_option_count)); ASSERT_NE(false, conn.ConnectDBStart()); diff --git a/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp b/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp index e2af4d40a0..5d5ed44d9d 100644 --- a/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp +++ b/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp @@ -17,8 +17,8 @@ // clang-format off #include "pch.h" #include "unit_test_helper.h" -#include "es_communication.h" -#include "es_helper.h" +#include "opensearch_communication.h" +#include "opensearch_helper.h" // clang-format on const std::string valid_host = (use_ssl ? "https://localhost" : "localhost"); @@ -27,11 +27,11 @@ const std::string valid_user = "admin"; const std::string valid_pw = "admin"; const std::string valid_region = "us-west-3"; const std::string query = - "SELECT Origin FROM kibana_sample_data_flights LIMIT 5"; + "SELECT Origin FROM opensearch_dashboards_sample_data_flights LIMIT 5"; const std::string all_columns_flights_query = - "SELECT * FROM kibana_sample_data_flights LIMIT 5"; + "SELECT * FROM opensearch_dashboards_sample_data_flights LIMIT 5"; const std::string some_columns_flights_query = - "SELECT Origin, OriginWeather FROM kibana_sample_data_flights LIMIT 5"; + "SELECT Origin, OriginWeather FROM opensearch_dashboards_sample_data_flights LIMIT 5"; const std::string invalid_query = "SELECT"; const int EXECUTION_SUCCESS = 0; const int EXECUTION_ERROR = -1; @@ -43,35 +43,36 @@ runtime_options valid_conn_opt_val = { {"BASIC", valid_user, valid_pw, valid_region}, {use_ssl, false, "", "", "", ""}}; -TEST(TestESExecDirect, ValidQuery) { - ESCommunication conn; +TEST(TestOpenSearchExecDirect, ValidQuery) { + OpenSearchCommunication conn; ASSERT_TRUE(conn.ConnectionOptions(valid_conn_opt_val, false, 0, 0)); ASSERT_TRUE(conn.ConnectDBStart()); EXPECT_EQ(EXECUTION_SUCCESS, - ESExecDirect(&conn, some_columns_flights_query.c_str(), fetch_size.c_str())); + OpenSearchExecDirect(&conn, some_columns_flights_query.c_str(), fetch_size.c_str())); } -TEST(TestESExecDirect, MissingQuery) { - ESCommunication conn; +TEST(TestOpenSearchExecDirect, MissingQuery) { + OpenSearchCommunication conn; ASSERT_TRUE(conn.ConnectionOptions(valid_conn_opt_val, false, 0, 0)); ASSERT_TRUE(conn.ConnectDBStart()); - EXPECT_EQ(EXECUTION_ERROR, ESExecDirect(&conn, NULL, fetch_size.c_str())); + EXPECT_EQ(EXECUTION_ERROR, + OpenSearchExecDirect(&conn, NULL, fetch_size.c_str())); } -TEST(TestESExecDirect, MissingConnection) { +TEST(TestOpenSearchExecDirect, MissingConnection) { EXPECT_EQ(EXECUTION_ERROR, - ESExecDirect(NULL, query.c_str(), fetch_size.c_str())); + OpenSearchExecDirect(NULL, query.c_str(), fetch_size.c_str())); } // Conn::ExecDirect TEST(TestConnExecDirect, ValidQueryAllColumns) { - ESCommunication conn; + OpenSearchCommunication conn; ASSERT_TRUE(conn.ConnectionOptions(valid_conn_opt_val, false, 0, 0)); ASSERT_TRUE(conn.ConnectDBStart()); conn.ExecDirect(all_columns_flights_query.c_str(), fetch_size.c_str()); - ESResult* result = conn.PopResult(); + OpenSearchResult* result = conn.PopResult(); EXPECT_EQ("SELECT", result->command_type); EXPECT_FALSE(result->result_json.empty()); EXPECT_EQ(all_columns_flights_count, result->num_fields); @@ -79,12 +80,12 @@ TEST(TestConnExecDirect, ValidQueryAllColumns) { } TEST(TestConnExecDirect, ValidQuerySomeColumns) { - ESCommunication conn; + OpenSearchCommunication conn; ASSERT_TRUE(conn.ConnectionOptions(valid_conn_opt_val, false, 0, 0)); ASSERT_TRUE(conn.ConnectDBStart()); conn.ExecDirect(some_columns_flights_query.c_str(), fetch_size.c_str()); - ESResult* result = conn.PopResult(); + OpenSearchResult* result = conn.PopResult(); EXPECT_EQ("SELECT", result->command_type); EXPECT_FALSE(result->result_json.empty()); EXPECT_EQ(some_columns_flights_count, result->num_fields); @@ -92,28 +93,28 @@ TEST(TestConnExecDirect, ValidQuerySomeColumns) { } TEST(TestConnExecDirect, InvalidQuery) { - ESCommunication conn; + OpenSearchCommunication conn; ASSERT_TRUE(conn.ConnectionOptions(valid_conn_opt_val, false, 0, 0)); ASSERT_TRUE(conn.ConnectDBStart()); conn.ExecDirect(invalid_query.c_str(), fetch_size.c_str()); - ESResult* result = conn.PopResult(); + OpenSearchResult* result = conn.PopResult(); EXPECT_EQ(NULL, (void*)result); } // Conn::PopResult TEST(TestConnPopResult, PopEmptyQueue) { - ESCommunication conn; + OpenSearchCommunication conn; ASSERT_TRUE(conn.ConnectionOptions(valid_conn_opt_val, false, 0, 0)); ASSERT_TRUE(conn.ConnectDBStart()); - ESResult* result = conn.PopResult(); + OpenSearchResult* result = conn.PopResult(); EXPECT_EQ(NULL, (void*)result); } TEST(TestConnPopResult, PopTwoQueryResults) { - ESCommunication conn; + OpenSearchCommunication conn; ASSERT_TRUE(conn.ConnectionOptions(valid_conn_opt_val, false, 0, 0)); ASSERT_TRUE(conn.ConnectDBStart()); @@ -121,7 +122,7 @@ TEST(TestConnPopResult, PopTwoQueryResults) { conn.ExecDirect(all_columns_flights_query.c_str(), fetch_size.c_str()); // Pop some_columns - ESResult* result = conn.PopResult(); + OpenSearchResult* result = conn.PopResult(); EXPECT_EQ(some_columns_flights_count, result->num_fields); // Pop all_columns diff --git a/sql-odbc/src/UnitTests/UTCriticalSection/test_critical_section.cpp b/sql-odbc/src/UnitTests/UTCriticalSection/test_critical_section.cpp index 5d729ffd83..5cb06386ec 100644 --- a/sql-odbc/src/UnitTests/UTCriticalSection/test_critical_section.cpp +++ b/sql-odbc/src/UnitTests/UTCriticalSection/test_critical_section.cpp @@ -19,7 +19,7 @@ #include #include -#include "es_helper.h" +#include "opensearch_helper.h" #include "pch.h" #include "unit_test_helper.h" diff --git a/sql-odbc/src/UnitTests/UTRabbit/test_rabbit.cpp b/sql-odbc/src/UnitTests/UTRabbit/test_rabbit.cpp index 9a3647b01a..7fb6bf3edf 100644 --- a/sql-odbc/src/UnitTests/UTRabbit/test_rabbit.cpp +++ b/sql-odbc/src/UnitTests/UTRabbit/test_rabbit.cpp @@ -27,7 +27,7 @@ #include "unit_test_helper.h" const std::string invalid_json_schema = "{ invalid schema }"; -const std::string valid_json_schema = "{" // This was generated from the example elasticsearch data +const std::string valid_json_schema = "{" // This was generated from the example OpenSearch data "\"type\": \"object\"," "\"properties\": {" "\"schema\": {" @@ -51,7 +51,7 @@ const std::string valid_json_schema = "{" // This was generated from the example "}," "\"required\": [\"schema\", \"total\", \"datarows\", \"size\", \"status\"]" "}"; -const std::string valid_json_for_schema = "{" // This was taken from the example elasticsearch data +const std::string valid_json_for_schema = "{" // This was taken from the example OpenSearch data "\"schema\": [{" "\"name\": \"valid_name1\"," "\"type\": \"valid_type1\"},{" diff --git a/sql-odbc/src/installer/CMakeLists.txt b/sql-odbc/src/installer/CMakeLists.txt index 0b47894b64..fe30ec4199 100644 --- a/sql-odbc/src/installer/CMakeLists.txt +++ b/sql-odbc/src/installer/CMakeLists.txt @@ -19,8 +19,8 @@ include(CPackComponent) set(CMAKE_INSTALL_PREFIX ${INSTALL_ROOT}) # General package info -set(CPACK_PACKAGE_NAME "Open Distro for Elasticsearch SQL ODBC Driver ${BITNESS}-bit") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Distro for Elasticsearch SQL ODBC Driver ${BITNESS}-bit") +set(CPACK_PACKAGE_NAME "OpenSearch SQL ODBC Driver ${BITNESS}-bit") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenSearch SQL ODBC Driver ${BITNESS}-bit") set(CPACK_PACKAGE_VENDOR "Amazon") set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") @@ -79,16 +79,16 @@ endif() # Set up components for installer cpack_add_component(Docs DISPLAY_NAME "Documentation" - DESCRIPTION "Documentation about Open Distro for Elasticsearch SQL ODBC Driver" + DESCRIPTION "Documentation about OpenSearch SQL ODBC Driver" ) cpack_add_component(Driver DISPLAY_NAME "Driver" - DESCRIPTION "Library files for running the Open Distro for Elasticsearch SQL ODBC Driver" + DESCRIPTION "Library files for running the OpenSearch SQL ODBC Driver" REQUIRED ) cpack_add_component(Resources DISPLAY_NAME "Resources" - DESCRIPTION "Resources for Open Distro for Elasticsearch SQL ODBC Driver" + DESCRIPTION "Resources for OpenSearch SQL ODBC Driver" ) # Install driver files diff --git a/sql-odbc/src/installer/Resources/README.txt b/sql-odbc/src/installer/Resources/README.txt index c311b0cbbc..dc5b7f485d 100644 --- a/sql-odbc/src/installer/Resources/README.txt +++ b/sql-odbc/src/installer/Resources/README.txt @@ -7,13 +7,13 @@ To setup a connection, you can use DSN to store your data source connection info 4. Update the connection string values. For the list of all supported options, check '/Library/ODBC/odfe-sql-odbc/doc/README.md'. 5. Click 'Ok' to save changes. -If using with ODBC compatible BI tools, refer to the tool documentation on configuring a new ODBC driver. The typical requirement is to make the tool aware of the location of the driver library file and then use it to setup database (i.e Elasticsearch) connections. +If using with ODBC compatible BI tools, refer to the tool documentation on configuring a new ODBC driver. The typical requirement is to make the tool aware of the location of the driver library file and then use it to setup database (i.e OpenSearch) connections. -For example, if you want to use Tableau with Elasticsearch Server, +For example, if you want to use Tableau with OpenSearch Server, 1. Open 'Tableau'. 2. Click on 'Other Databases (ODBC)'. 3. Select 'ODFE SQL ODBC DSN' from the DSN list or 'ODFE SQL ODBC Driver' from the driver list. If using driver, you need to enter connection string values. 4. Click on 'Connect'. All connection attributes will be retrived. -5. Click on 'Sign In'. You will be successfully connected to elasticsearch server. +5. Click on 'Sign In'. You will be successfully connected to OpenSearch server. -For more details, check 'https://github.com/opendistro-for-elasticsearch/sql/tree/master/sql-odbc'. \ No newline at end of file +For more details, check 'https://github.com/opensearch-project/sql/tree/main/sql-odbc'. \ No newline at end of file diff --git a/sql-odbc/src/installer/Resources/Welcome.txt b/sql-odbc/src/installer/Resources/Welcome.txt index 8e9d0c1bcf..b4412f3294 100644 --- a/sql-odbc/src/installer/Resources/Welcome.txt +++ b/sql-odbc/src/installer/Resources/Welcome.txt @@ -1 +1 @@ -Open Distro for Elasticsearch SQL ODBC is a read-only ODBC driver for connecting to Open Distro for Elasticsearch SQL support. \ No newline at end of file +OpenSearch SQL ODBC is a read-only ODBC driver for connecting to OpenSearch SQL support. \ No newline at end of file diff --git a/sql-odbc/src/installer/Resources/odfe_sql_odbc.tdc b/sql-odbc/src/installer/Resources/odfe_sql_odbc.tdc index 8603f7149e..7c36b1b72c 100644 --- a/sql-odbc/src/installer/Resources/odfe_sql_odbc.tdc +++ b/sql-odbc/src/installer/Resources/odfe_sql_odbc.tdc @@ -1,6 +1,6 @@ - + diff --git a/sql-odbc/src/odfeenlist/CMakeLists.txt b/sql-odbc/src/odfeenlist/CMakeLists.txt index 23103f8f04..3b5e503553 100644 --- a/sql-odbc/src/odfeenlist/CMakeLists.txt +++ b/sql-odbc/src/odfeenlist/CMakeLists.txt @@ -17,7 +17,7 @@ project(odfeenlist) # Source files for odfeenlist set(SOURCE_FILES msdtc_enlist.cpp) -set(HEADER_FILES elasticenlist.h) +set(HEADER_FILES opensearch_enlist.h) # Generate static lib add_library(odfeenlist STATIC ${SOURCE_FILES} ${HEADER_FILES}) diff --git a/sql-odbc/src/odfeenlist/msdtc_enlist.cpp b/sql-odbc/src/odfeenlist/msdtc_enlist.cpp index e3fade30c4..5c5b29d2e3 100644 --- a/sql-odbc/src/odfeenlist/msdtc_enlist.cpp +++ b/sql-odbc/src/odfeenlist/msdtc_enlist.cpp @@ -41,8 +41,8 @@ #include #define _MYLOG_FUNCS_IMPORT_ #include "mylog.h" -#define _ESENLIST_FUNCS_IMPLEMENT_ -#include "esenlist.h" +#define _OPENSEARCH_ENLIST_FUNCS_IMPLEMENT_ +#include "opensearch_enlist.h" #include "xalibname.h" #ifdef WIN32 @@ -66,7 +66,7 @@ BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) { s_hModule = (HINSTANCE)hInst; /* Save for dialog boxes */ break; case DLL_PROCESS_DETACH: - mylog("DETACHING esenlist\n"); + mylog("DETACHING opensearch_enlist\n"); break; } return TRUE; diff --git a/sql-odbc/src/odfeenlist/elasticenlist.h b/sql-odbc/src/odfeenlist/opensearch_enlist.h similarity index 80% rename from sql-odbc/src/odfeenlist/elasticenlist.h rename to sql-odbc/src/odfeenlist/opensearch_enlist.h index 0e33bf9394..393b5e8cc4 100644 --- a/sql-odbc/src/odfeenlist/elasticenlist.h +++ b/sql-odbc/src/odfeenlist/opensearch_enlist.h @@ -14,8 +14,8 @@ * */ -#ifndef __ESENLIST_H__ -#define __ESENLIST_H__ +#ifndef __OPENSEARCH_ENLIST_H__ +#define __OPENSEARCH_ENLIST_H__ #ifdef __cplusplus extern "C" { @@ -24,15 +24,15 @@ extern "C" { #ifdef _HANDLE_ENLIST_IN_DTC_ #undef DLL_DECLARE -#ifdef _ESENLIST_FUNCS_IMPLEMENT_ +#ifdef _OPENSEARCH_ENLIST_FUNCS_IMPLEMENT_ #define DLL_DECLARE _declspec(dllexport) #else -#ifdef _ESENLIST_FUNCS_IMPORT_ +#ifdef _OPENSEARCH_ENLIST_FUNCS_IMPORT_ #define DLL_DECLARE _declspec(dllimport) #else #define DLL_DECLARE -#endif /* _ESENLIST_FUNCS_IMPORT_ */ -#endif /* _ESENLIST_FUNCS_IMPLEMENT_ */ +#endif /* _OPENSEARCH_ENLIST_FUNCS_IMPORT_ */ +#endif /* _OPENSEARCH_ENLIST_FUNCS_IMPLEMENT_ */ RETCODE EnlistInDtc(void *conn, void *pTra, int method); RETCODE DtcOnDisconnect(void *); @@ -47,4 +47,4 @@ DLL_DECLARE void ReleaseTransactionObject(void *); #ifdef __cplusplus } #endif -#endif /* __ESENLIST_H__ */ +#endif /* __OPENSEARCH_ENLIST_H__ */ diff --git a/sql-odbc/src/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index 2910d4cf32..0f832ace3e 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -22,11 +22,11 @@ set( SOURCE_FILES environ.c execute.c info.c loadlib.c misc.c multibyte.c mylog.c tuple.c parse.c results.c statement.c odbcapi30.c - qresult.c odbcapi30w.c es_api30.c es_types.c - es_utility.cpp es_communication.cpp es_connection.cpp es_odbc.c - es_driver_connect.cpp es_helper.cpp es_info.cpp es_parse_result.cpp - es_semaphore.cpp es_statement.cpp win_unicode.c odbcapi.c - odbcapiw.c es_result_queue.cpp + qresult.c odbcapi30w.c opensearch_api30.c opensearch_types.c + opensearch_utility.cpp opensearch_communication.cpp opensearch_connection.cpp opensearch_odbc.c + opensearch_driver_connect.cpp opensearch_helper.cpp opensearch_info.cpp opensearch_parse_result.cpp + opensearch_semaphore.cpp opensearch_statement.cpp win_unicode.c odbcapi.c + odbcapiw.c opensearch_result_queue.cpp ) if(WIN32) set(SOURCE_FILES ${SOURCE_FILES} dlg_wingui.c setup.c) @@ -35,18 +35,18 @@ endif() set( HEADER_FILES bind.h catfunc.h columninfo.h convert.h descriptor.h dlg_specific.h drvconn.h - environ.h es_apifunc.h es_communication.h es_parse_result.h - es_connection.h es_driver_connect.h es_helper.h es_info.h - es_statement.h es_types.h loadlib.h - misc.h multibyte.h mylog.h es_utility.h + environ.h opensearch_apifunc.h opensearch_communication.h opensearch_parse_result.h + opensearch_connection.h opensearch_driver_connect.h opensearch_helper.h opensearch_info.h + opensearch_statement.h opensearch_types.h loadlib.h + misc.h multibyte.h mylog.h opensearch_utility.h resource.h statement.h tuple.h unicode_support.h - es_apifunc.h es_odbc.h es_semaphore.h qresult.h - version.h win_setup.h es_result_queue.h + opensearch_apifunc.h opensearch_odbc.h opensearch_semaphore.h qresult.h + version.h win_setup.h opensearch_result_queue.h ) # Generate dll (SHARED) if(WIN32) -set(RESOURCE_FILES es_odbc.rc) +set(RESOURCE_FILES opensearch_odbc.rc) add_library(odfesqlodbc SHARED ${SOURCE_FILES} ${HEADER_FILES} ${RESOURCE_FILES} ${AWSSDK_LIB_DIR}) else() add_library(odfesqlodbc SHARED ${SOURCE_FILES} ${HEADER_FILES}) diff --git a/sql-odbc/src/odfesqlodbc/bind.c b/sql-odbc/src/odfesqlodbc/bind.c index a4795203c1..60d180141e 100644 --- a/sql-odbc/src/odfesqlodbc/bind.c +++ b/sql-odbc/src/odfesqlodbc/bind.c @@ -21,28 +21,28 @@ #include "descriptor.h" #include "environ.h" -#include "es_apifunc.h" -#include "es_types.h" #include "misc.h" #include "multibyte.h" +#include "opensearch_apifunc.h" +#include "opensearch_types.h" #include "qresult.h" #include "statement.h" /* Associate a user-supplied buffer with a database column. */ -RETCODE SQL_API ESAPI_BindCol(HSTMT hstmt, SQLUSMALLINT icol, +RETCODE SQL_API OPENSEARCHAPI_BindCol(HSTMT hstmt, SQLUSMALLINT icol, SQLSMALLINT fCType, PTR rgbValue, SQLLEN cbValueMax, SQLLEN *pcbValue) { StatementClass *stmt = (StatementClass *)hstmt; - CSTR func = "ESAPI_BindCol"; + CSTR func = "OPENSEARCHAPI_BindCol"; ARDFields *opts; GetDataInfo *gdata_info; BindInfoClass *bookmark; RETCODE ret = SQL_SUCCESS; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); - MYLOG(ES_DEBUG, "**** : stmt = %p, icol = %d\n", stmt, icol); - MYLOG(ES_DEBUG, "**** : fCType=%d rgb=%p valusMax=" FORMAT_LEN " pcb=%p\n", + MYLOG(OPENSEARCH_DEBUG, "**** : stmt = %p, icol = %d\n", stmt, icol); + MYLOG(OPENSEARCH_DEBUG, "**** : fCType=%d rgb=%p valusMax=" FORMAT_LEN " pcb=%p\n", fCType, rgbValue, cbValueMax, pcbValue); if (!stmt) { @@ -86,7 +86,7 @@ RETCODE SQL_API ESAPI_BindCol(HSTMT hstmt, SQLUSMALLINT icol, "Bind column 0 is not of type SQL_C_BOOKMARK", func); MYLOG( - ES_ERROR, + OPENSEARCH_ERROR, "Bind column 0 is type %d not of type SQL_C_BOOKMARK\n", fCType); ret = SQL_ERROR; @@ -161,7 +161,7 @@ RETCODE SQL_API ESAPI_BindCol(HSTMT hstmt, SQLUSMALLINT icol, } opts->bindings[icol].scale = 0; - MYLOG(ES_DEBUG, " bound buffer[%d] = %p\n", icol, + MYLOG(OPENSEARCH_DEBUG, " bound buffer[%d] = %p\n", icol, opts->bindings[icol].buffer); } @@ -170,13 +170,13 @@ RETCODE SQL_API ESAPI_BindCol(HSTMT hstmt, SQLUSMALLINT icol, return ret; } -RETCODE SQL_API ESAPI_NumParams(HSTMT hstmt, SQLSMALLINT *pcpar) { +RETCODE SQL_API OPENSEARCHAPI_NumParams(HSTMT hstmt, SQLSMALLINT *pcpar) { StatementClass *stmt = (StatementClass *)hstmt; if (pcpar != NULL) { *pcpar = 0; } else { SC_set_error(stmt, STMT_EXEC_ERROR, "Parameter count address is null", - "ESAPI_NumParams"); + "OPENSEARCHAPI_NumParams"); return SQL_ERROR; } return SQL_SUCCESS; @@ -205,7 +205,7 @@ static BindInfoClass *create_empty_bindings(int num_columns) { void extend_parameter_bindings(APDFields *self, SQLSMALLINT num_params) { ParameterInfoClass *new_bindings; - MYLOG(ES_TRACE, + MYLOG(OPENSEARCH_TRACE, "entering ... self=%p, parameters_allocated=%d, num_params=%d,%p\n", self, self->allocated, num_params, self->parameters); @@ -217,7 +217,7 @@ void extend_parameter_bindings(APDFields *self, SQLSMALLINT num_params) { new_bindings = (ParameterInfoClass *)realloc( self->parameters, sizeof(ParameterInfoClass) * num_params); if (!new_bindings) { - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "unable to create %d new bindings from %d old bindings\n", num_params, self->allocated); @@ -234,13 +234,13 @@ void extend_parameter_bindings(APDFields *self, SQLSMALLINT num_params) { self->allocated = num_params; } - MYLOG(ES_TRACE, "leaving %p\n", self->parameters); + MYLOG(OPENSEARCH_TRACE, "leaving %p\n", self->parameters); } void extend_iparameter_bindings(IPDFields *self, SQLSMALLINT num_params) { ParameterImplClass *new_bindings; - MYLOG(ES_TRACE, + MYLOG(OPENSEARCH_TRACE, "entering ... self=%p, parameters_allocated=%d, num_params=%d\n", self, self->allocated, num_params); @@ -252,7 +252,7 @@ void extend_iparameter_bindings(IPDFields *self, SQLSMALLINT num_params) { new_bindings = (ParameterImplClass *)realloc( self->parameters, sizeof(ParameterImplClass) * num_params); if (!new_bindings) { - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "unable to create %d new bindings from %d old bindings\n", num_params, self->allocated); @@ -269,11 +269,11 @@ void extend_iparameter_bindings(IPDFields *self, SQLSMALLINT num_params) { self->allocated = num_params; } - MYLOG(ES_TRACE, "leaving %p\n", self->parameters); + MYLOG(OPENSEARCH_TRACE, "leaving %p\n", self->parameters); } void reset_a_parameter_binding(APDFields *self, int ipar) { - MYLOG(ES_TRACE, "entering ... self=%p, parameters_allocated=%d, ipar=%d\n", + MYLOG(OPENSEARCH_TRACE, "entering ... self=%p, parameters_allocated=%d, ipar=%d\n", self, self->allocated, ipar); if (ipar < 1 || ipar > self->allocated) @@ -290,7 +290,7 @@ void reset_a_parameter_binding(APDFields *self, int ipar) { } void reset_a_iparameter_binding(IPDFields *self, int ipar) { - MYLOG(ES_TRACE, "entering ... self=%p, parameters_allocated=%d, ipar=%d\n", + MYLOG(OPENSEARCH_TRACE, "entering ... self=%p, parameters_allocated=%d, ipar=%d\n", self, self->allocated, ipar); if (ipar < 1 || ipar > self->allocated) @@ -304,7 +304,7 @@ void reset_a_iparameter_binding(IPDFields *self, int ipar) { self->parameters[ipar].decimal_digits = 0; self->parameters[ipar].precision = 0; self->parameters[ipar].scale = 0; - PIC_set_estype(self->parameters[ipar], 0); + PIC_set_opensearch_type(self->parameters[ipar], 0); } int CountParameters(const StatementClass *self, Int2 *inputCount, Int2 *ioCount, @@ -346,7 +346,7 @@ int CountParameters(const StatementClass *self, Int2 *inputCount, Int2 *ioCount, * Free parameters and free the memory. */ void APD_free_params(APDFields *apdopts, char option) { - MYLOG(ES_TRACE, "entering self=%p\n", apdopts); + MYLOG(OPENSEARCH_TRACE, "entering self=%p\n", apdopts); if (!apdopts->parameters) return; @@ -357,13 +357,13 @@ void APD_free_params(APDFields *apdopts, char option) { apdopts->allocated = 0; } - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); } void PDATA_free_params(PutDataInfo *pdata, char option) { int i; - MYLOG(ES_TRACE, "entering self=%p\n", pdata); + MYLOG(OPENSEARCH_TRACE, "entering self=%p\n", pdata); if (!pdata->pdata) return; @@ -385,14 +385,14 @@ void PDATA_free_params(PutDataInfo *pdata, char option) { pdata->allocated = 0; } - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); } /* * Free parameters and free the memory. */ void IPD_free_params(IPDFields *ipdopts, char option) { - MYLOG(ES_TRACE, "entering self=%p\n", ipdopts); + MYLOG(OPENSEARCH_TRACE, "entering self=%p\n", ipdopts); if (!ipdopts->parameters) return; @@ -402,14 +402,14 @@ void IPD_free_params(IPDFields *ipdopts, char option) { ipdopts->allocated = 0; } - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); } void extend_column_bindings(ARDFields *self, SQLSMALLINT num_columns) { BindInfoClass *new_bindings; SQLSMALLINT i; - MYLOG(ES_TRACE, + MYLOG(OPENSEARCH_TRACE, "entering ... self=%p, bindings_allocated=%d, num_columns=%d\n", self, self->allocated, num_columns); @@ -420,7 +420,7 @@ void extend_column_bindings(ARDFields *self, SQLSMALLINT num_columns) { if (self->allocated < num_columns) { new_bindings = create_empty_bindings(num_columns); if (!new_bindings) { - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "unable to create %d new bindings from %d old bindings\n", num_columns, self->allocated); @@ -453,13 +453,13 @@ void extend_column_bindings(ARDFields *self, SQLSMALLINT num_columns) { /* SQLExecDirect(...) # returns 5 cols */ /* SQLExecDirect(...) # returns 10 cols (now OK) */ - MYLOG(ES_TRACE, "leaving %p\n", self->bindings); + MYLOG(OPENSEARCH_TRACE, "leaving %p\n", self->bindings); } void reset_a_column_binding(ARDFields *self, int icol) { BindInfoClass *bookmark; - MYLOG(ES_TRACE, "entering ... self=%p, bindings_allocated=%d, icol=%d\n", + MYLOG(OPENSEARCH_TRACE, "entering ... self=%p, bindings_allocated=%d, icol=%d\n", self, self->allocated, icol); if (icol > self->allocated) @@ -485,7 +485,7 @@ void reset_a_column_binding(ARDFields *self, int icol) { void ARD_unbind_cols(ARDFields *self, BOOL freeall) { Int2 lf; - MYLOG(ES_ALL, "freeall=%d allocated=%d bindings=%p\n", freeall, + MYLOG(OPENSEARCH_ALL, "freeall=%d allocated=%d bindings=%p\n", freeall, self->allocated, self->bindings); for (lf = 1; lf <= self->allocated; lf++) reset_a_column_binding(self, lf); @@ -499,7 +499,7 @@ void ARD_unbind_cols(ARDFields *self, BOOL freeall) { void GDATA_unbind_cols(GetDataInfo *self, BOOL freeall) { Int2 lf; - MYLOG(ES_ALL, "freeall=%d allocated=%d gdata=%p\n", freeall, + MYLOG(OPENSEARCH_ALL, "freeall=%d allocated=%d gdata=%p\n", freeall, self->allocated, self->gdata); if (self->fdata.ttlbuf) { free(self->fdata.ttlbuf); @@ -544,7 +544,7 @@ void extend_getdata_info(GetDataInfo *self, SQLSMALLINT num_columns, BOOL shrink) { GetDataClass *new_gdata; - MYLOG(ES_TRACE, + MYLOG(OPENSEARCH_TRACE, "entering ... self=%p, gdata_allocated=%d, num_columns=%d\n", self, self->allocated, num_columns); @@ -555,7 +555,7 @@ void extend_getdata_info(GetDataInfo *self, SQLSMALLINT num_columns, if (self->allocated < num_columns) { new_gdata = create_empty_gdata(num_columns); if (!new_gdata) { - MYLOG(ES_DEBUG, "unable to create %d new gdata from %d old gdata\n", + MYLOG(OPENSEARCH_DEBUG, "unable to create %d new gdata from %d old gdata\n", num_columns, self->allocated); if (self->gdata) { @@ -592,7 +592,7 @@ void extend_getdata_info(GetDataInfo *self, SQLSMALLINT num_columns, * about it by unbinding those columns. */ - MYLOG(ES_TRACE, "leaving %p\n", self->gdata); + MYLOG(OPENSEARCH_TRACE, "leaving %p\n", self->gdata); } void reset_a_getdata_info(GetDataInfo *gdata_info, int icol) { if (icol < 1 || icol > gdata_info->allocated) @@ -614,7 +614,7 @@ void extend_putdata_info(PutDataInfo *self, SQLSMALLINT num_params, BOOL shrink) { PutDataClass *new_pdata; - MYLOG(ES_TRACE, + MYLOG(OPENSEARCH_TRACE, "entering ... self=%p, parameters_allocated=%d, num_params=%d\n", self, self->allocated, num_params); @@ -624,13 +624,13 @@ void extend_putdata_info(PutDataInfo *self, SQLSMALLINT num_params, */ if (self->allocated < num_params) { if (self->allocated <= 0 && self->pdata) { - MYLOG(ES_DEBUG, "??? pdata is not null while allocated == 0\n"); + MYLOG(OPENSEARCH_DEBUG, "??? pdata is not null while allocated == 0\n"); self->pdata = NULL; } new_pdata = (PutDataClass *)realloc(self->pdata, sizeof(PutDataClass) * num_params); if (!new_pdata) { - MYLOG(ES_DEBUG, "unable to create %d new pdata from %d old pdata\n", + MYLOG(OPENSEARCH_DEBUG, "unable to create %d new pdata from %d old pdata\n", num_params, self->allocated); self->pdata = NULL; @@ -654,7 +654,7 @@ void extend_putdata_info(PutDataInfo *self, SQLSMALLINT num_params, } } - MYLOG(ES_TRACE, "leaving %p\n", self->pdata); + MYLOG(OPENSEARCH_TRACE, "leaving %p\n", self->pdata); } void reset_a_putdata_info(PutDataInfo *pdata_info, int ipar) { if (ipar < 1 || ipar > pdata_info->allocated) diff --git a/sql-odbc/src/odfesqlodbc/bind.h b/sql-odbc/src/odfesqlodbc/bind.h index 7ddb1d76f4..000a6df14e 100644 --- a/sql-odbc/src/odfesqlodbc/bind.h +++ b/sql-odbc/src/odfesqlodbc/bind.h @@ -18,7 +18,7 @@ #define __BIND_H__ #include "descriptor.h" -#include "es_odbc.h" +#include "opensearch_odbc.h" // C Interface #ifdef __cplusplus @@ -82,10 +82,10 @@ typedef struct { * ParameterImplClass -- stores implementation information about a parameter */ struct ParameterImplClass_ { - esNAME paramName; /* this is unavailable even in 8.1 */ + opensearchNAME paramName; /* this is unavailable even in 8.1 */ SQLSMALLINT paramType; SQLSMALLINT SQLType; - OID ESType; + OID OpenSearchType; SQLULEN column_size; SQLSMALLINT decimal_digits; SQLSMALLINT precision; /* the precision for numeric or timestamp type */ @@ -114,11 +114,11 @@ typedef struct { : sizeof(UInt4))) \ * index) -/* Macros to handle estype of parameters */ -#define PIC_get_estype(pari) ((pari).ESType) -#define PIC_set_estype(pari, type) ((pari).ESType = (type)) -#define PIC_dsp_estype(conn, pari) \ - ((pari).ESType ? (pari).ESType : sqltype_to_estype(conn, (pari).SQLType)) +/* Macros to handle opensearch type of parameters */ +#define PIC_get_opensearch_type(pari) ((pari).OpenSearchType) +#define PIC_set_opensearch_type(pari, type) ((pari).OpenSearchType = (type)) +#define PIC_dsp_opensearch_type(conn, pari) \ + ((pari).OpenSearchType ? (pari).OpenSearchType : sqltype_to_opensearchtype(conn, (pari).SQLType)) void extend_column_bindings(ARDFields *opts, SQLSMALLINT num_columns); void reset_a_column_binding(ARDFields *opts, int icol); diff --git a/sql-odbc/src/odfesqlodbc/catfunc.h b/sql-odbc/src/odfesqlodbc/catfunc.h index 647e68f4d8..afd799d45f 100644 --- a/sql-odbc/src/odfesqlodbc/catfunc.h +++ b/sql-odbc/src/odfesqlodbc/catfunc.h @@ -17,7 +17,7 @@ #ifndef __CATFUNC_H__ #define __CATFUNC_H__ -#include "es_odbc.h" +#include "opensearch_odbc.h" /* SQLTables field position */ enum { diff --git a/sql-odbc/src/odfesqlodbc/columninfo.c b/sql-odbc/src/odfesqlodbc/columninfo.c index 5512a628b7..f0a78d186e 100644 --- a/sql-odbc/src/odfesqlodbc/columninfo.c +++ b/sql-odbc/src/odfesqlodbc/columninfo.c @@ -15,12 +15,13 @@ */ #include "columninfo.h" -#include "es_types.h" #include #include -#include "es_apifunc.h" -#include "es_connection.h" + +#include "opensearch_types.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" ColumnInfoClass *CI_Constructor(void) { ColumnInfoClass *rv; @@ -82,7 +83,7 @@ void CI_set_field_info(ColumnInfoClass *self, int field_num, self->coli_array[field_num].adtsize = new_adtsize; self->coli_array[field_num].atttypmod = new_atttypmod; - self->coli_array[field_num].display_size = ES_ADT_UNSET; + self->coli_array[field_num].display_size = OPENSEARCH_ADT_UNSET; self->coli_array[field_num].relid = new_relid; self->coli_array[field_num].attid = (short)new_attid; } diff --git a/sql-odbc/src/odfesqlodbc/columninfo.h b/sql-odbc/src/odfesqlodbc/columninfo.h index c66b93d717..46131a8a47 100644 --- a/sql-odbc/src/odfesqlodbc/columninfo.h +++ b/sql-odbc/src/odfesqlodbc/columninfo.h @@ -17,7 +17,7 @@ #ifndef __COLUMNINFO_H__ #define __COLUMNINFO_H__ -#include "es_odbc.h" +#include "opensearch_odbc.h" struct ColumnInfoClass_ { UInt4 refcount; /* reference count. A ColumnInfo can be shared by @@ -51,7 +51,7 @@ void CI_free_memory(ColumnInfoClass *self); /* without reading from a socket */ void CI_set_num_fields(ColumnInfoClass *self, SQLSMALLINT new_num_fields); -// Used in es_parse_results.cpp +// Used in opensearch_parse_results.cpp #ifdef __cplusplus extern "C" { #endif diff --git a/sql-odbc/src/odfesqlodbc/connection.c b/sql-odbc/src/odfesqlodbc/connection.c index 4c151ac3b6..390906b136 100644 --- a/sql-odbc/src/odfesqlodbc/connection.c +++ b/sql-odbc/src/odfesqlodbc/connection.c @@ -23,7 +23,7 @@ #include #include -#include "es_connection.h" +#include "opensearch_connection.h" #include "misc.h" /* for htonl */ @@ -35,11 +35,11 @@ #include "dlg_specific.h" #include "environ.h" -#include "es_apifunc.h" -#include "es_connection.h" -#include "es_helper.h" #include "loadlib.h" #include "multibyte.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" +#include "opensearch_helper.h" #include "qresult.h" #include "statement.h" #ifndef WIN32 @@ -55,15 +55,15 @@ #define PROTOCOL3_OPTS_MAX 30 -RETCODE SQL_API ESAPI_AllocConnect(HENV henv, HDBC *phdbc) { +RETCODE SQL_API OPENSEARCHAPI_AllocConnect(HENV henv, HDBC *phdbc) { EnvironmentClass *env = (EnvironmentClass *)henv; ConnectionClass *conn; - CSTR func = "ESAPI_AllocConnect"; + CSTR func = "OPENSEARCHAPI_AllocConnect"; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); conn = CC_Constructor(); - MYLOG(ES_DEBUG, "**** henv = %p, conn = %p\n", henv, conn); + MYLOG(OPENSEARCH_DEBUG, "**** henv = %p, conn = %p\n", henv, conn); if (!conn) { env->errormsg = "Couldn't allocate memory for Connection object."; @@ -88,17 +88,17 @@ RETCODE SQL_API ESAPI_AllocConnect(HENV henv, HDBC *phdbc) { return SQL_SUCCESS; } -RETCODE SQL_API ESAPI_Connect(HDBC hdbc, const SQLCHAR *szDSN, +RETCODE SQL_API OPENSEARCHAPI_Connect(HDBC hdbc, const SQLCHAR *szDSN, SQLSMALLINT cbDSN, const SQLCHAR *szUID, SQLSMALLINT cbUID, const SQLCHAR *szAuthStr, SQLSMALLINT cbAuthStr) { ConnectionClass *conn = (ConnectionClass *)hdbc; ConnInfo *ci; - CSTR func = "ESAPI_Connect"; + CSTR func = "OPENSEARCHAPI_Connect"; RETCODE ret = SQL_SUCCESS; char fchar, *tmpstr; - MYLOG(ES_TRACE, "entering..cbDSN=%hi.\n", cbDSN); + MYLOG(OPENSEARCH_TRACE, "entering..cbDSN=%hi.\n", cbDSN); if (!conn) { CC_log_error(func, "", NULL); @@ -114,8 +114,8 @@ RETCODE SQL_API ESAPI_Connect(HDBC hdbc, const SQLCHAR *szDSN, getDSNinfo(ci, NULL); logs_on_off(1, ci->drivers.loglevel, ci->drivers.loglevel); - /* initialize es_version from connInfo.protocol */ - CC_initialize_es_version(conn); + /* initialize opensearch_version from connInfo.protocol */ + CC_initialize_opensearch_version(conn); /* * override values from DSN info with UID and authStr(pwd) This only @@ -132,7 +132,7 @@ RETCODE SQL_API ESAPI_Connect(HDBC hdbc, const SQLCHAR *szDSN, free(tmpstr); } - MYLOG(ES_DEBUG, "conn = %p (DSN='%s', UID='%s', PWD='%s')\n", conn, ci->dsn, + MYLOG(OPENSEARCH_DEBUG, "conn = %p (DSN='%s', UID='%s', PWD='%s')\n", conn, ci->dsn, ci->username, NAME_IS_VALID(ci->password) ? "xxxxx" : ""); if ((fchar = CC_connect(conn)) <= 0) { @@ -143,22 +143,22 @@ RETCODE SQL_API ESAPI_Connect(HDBC hdbc, const SQLCHAR *szDSN, if (SQL_SUCCESS == ret && 2 == fchar) ret = SQL_SUCCESS_WITH_INFO; - MYLOG(ES_TRACE, "leaving..%d.\n", ret); + MYLOG(OPENSEARCH_TRACE, "leaving..%d.\n", ret); return ret; } -RETCODE SQL_API ESAPI_BrowseConnect(HDBC hdbc, const SQLCHAR *szConnStrIn, +RETCODE SQL_API OPENSEARCHAPI_BrowseConnect(HDBC hdbc, const SQLCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn, SQLCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT *pcbConnStrOut) { UNUSED(szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, cbConnStrOutMax, pcbConnStrOut); - CSTR func = "ESAPI_BrowseConnect"; + CSTR func = "OPENSEARCHAPI_BrowseConnect"; ConnectionClass *conn = (ConnectionClass *)hdbc; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); CC_set_error(conn, CONN_NOT_IMPLEMENTED_ERROR, "Function not implemented", func); @@ -166,12 +166,12 @@ RETCODE SQL_API ESAPI_BrowseConnect(HDBC hdbc, const SQLCHAR *szConnStrIn, } /* Drop any hstmts open on hdbc and disconnect from database */ -RETCODE SQL_API ESAPI_Disconnect(HDBC hdbc) { +RETCODE SQL_API OPENSEARCHAPI_Disconnect(HDBC hdbc) { ConnectionClass *conn = (ConnectionClass *)hdbc; - CSTR func = "ESAPI_Disconnect"; + CSTR func = "OPENSEARCHAPI_Disconnect"; RETCODE ret = SQL_SUCCESS; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); if (!conn) { CC_log_error(func, "", NULL); @@ -188,23 +188,23 @@ RETCODE SQL_API ESAPI_Disconnect(HDBC hdbc) { logs_on_off(-1, conn->connInfo.drivers.loglevel, conn->connInfo.drivers.loglevel); - MYLOG(ES_DEBUG, "about to CC_cleanup\n"); + MYLOG(OPENSEARCH_DEBUG, "about to CC_cleanup\n"); /* Close the connection and free statements */ ret = CC_cleanup(conn, FALSE); - MYLOG(ES_DEBUG, "done CC_cleanup\n"); - MYLOG(ES_TRACE, "leaving...\n"); + MYLOG(OPENSEARCH_DEBUG, "done CC_cleanup\n"); + MYLOG(OPENSEARCH_TRACE, "leaving...\n"); return ret; } -RETCODE SQL_API ESAPI_FreeConnect(HDBC hdbc) { +RETCODE SQL_API OPENSEARCHAPI_FreeConnect(HDBC hdbc) { ConnectionClass *conn = (ConnectionClass *)hdbc; - CSTR func = "ESAPI_FreeConnect"; + CSTR func = "OPENSEARCHAPI_FreeConnect"; EnvironmentClass *env; - MYLOG(ES_TRACE, "entering...hdbc=%p\n", hdbc); + MYLOG(OPENSEARCH_TRACE, "entering...hdbc=%p\n", hdbc); if (!conn) { CC_log_error(func, "", NULL); @@ -222,7 +222,7 @@ RETCODE SQL_API ESAPI_FreeConnect(HDBC hdbc) { CC_Destructor(conn); - MYLOG(ES_TRACE, "leaving...\n"); + MYLOG(OPENSEARCH_TRACE, "leaving...\n"); return SQL_SUCCESS; } @@ -274,7 +274,7 @@ static ConnectionClass *CC_initialize(ConnectionClass *rv, BOOL lockinit) { rv->num_descs = STMT_INCREMENT; - rv->lobj_type = ES_TYPE_LO_UNDEFINED; + rv->lobj_type = OPENSEARCH_TYPE_LO_UNDEFINED; if (isMsAccess()) rv->ms_jet = 1; rv->isolation = 0; // means initially unknown server's default isolation @@ -311,14 +311,14 @@ ConnectionClass *CC_Constructor() { } char CC_Destructor(ConnectionClass *self) { - MYLOG(ES_TRACE, "entering self=%p\n", self); + MYLOG(OPENSEARCH_TRACE, "entering self=%p\n", self); if (self->status == CONN_EXECUTING) return 0; CC_cleanup(self, FALSE); /* cleanup socket and statements */ - MYLOG(ES_DEBUG, "after CC_Cleanup\n"); + MYLOG(OPENSEARCH_DEBUG, "after CC_Cleanup\n"); /* Free up statement holders */ if (self->stmts) { @@ -329,7 +329,7 @@ char CC_Destructor(ConnectionClass *self) { free(self->descs); self->descs = NULL; } - MYLOG(ES_DEBUG, "after free statement holders\n"); + MYLOG(OPENSEARCH_DEBUG, "after free statement holders\n"); NULL_THE_NAME(self->schemaIns); NULL_THE_NAME(self->tableIns); @@ -340,7 +340,7 @@ char CC_Destructor(ConnectionClass *self) { DELETE_CONNLOCK(self); free(self); - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); return 1; } @@ -364,7 +364,7 @@ BOOL CC_set_autocommit(ConnectionClass *self, BOOL on) { if ((on && currsts) || (!on && !currsts)) return on; - MYLOG(ES_DEBUG, " %d->%d\n", currsts, on); + MYLOG(OPENSEARCH_DEBUG, " %d->%d\n", currsts, on); if (on) self->transact_status |= CONN_IN_AUTOCOMMIT; else @@ -410,22 +410,22 @@ CC_cleanup(ConnectionClass *self, BOOL keepCommunication) { if (self->status == CONN_EXECUTING) return FALSE; - MYLOG(ES_TRACE, "entering self=%p\n", self); + MYLOG(OPENSEARCH_TRACE, "entering self=%p\n", self); ENTER_CONN_CS(self); /* Cancel an ongoing transaction */ /* We are always in the middle of a transaction, */ /* even if we are in auto commit. */ - if (self->esconn) { - QLOG(0, "LIBES_disconnect: %p\n", self->esconn); - LIBES_disconnect(self->esconn); - self->esconn = NULL; + if (self->opensearchconn) { + QLOG(0, "LIBOPENSEARCH_disconnect: %p\n", self->opensearchconn); + LIBOPENSEARCH_disconnect(self->opensearchconn); + self->opensearchconn = NULL; } else { ret = SQL_ERROR; CC_set_error(self, CC_not_connected(self), "Connection not open", func); } - MYLOG(ES_DEBUG, "after LIBES_disconnect\n"); + MYLOG(OPENSEARCH_DEBUG, "after LIBOPENSEARCH_disconnect\n"); /* Free all the stmts on this connection */ for (i = 0; i < self->num_stmts; i++) { @@ -491,12 +491,12 @@ CC_cleanup(ConnectionClass *self, BOOL keepCommunication) { } LEAVE_CONN_CS(self); - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); return ret; } -#ifndef ES_DIAG_SEVERITY_NONLOCALIZED -#define ES_DIAG_SEVERITY_NONLOCALIZED 'V' +#ifndef OPENSEARCH_DIAG_SEVERITY_NONLOCALIZED +#define OPENSEARCH_DIAG_SEVERITY_NONLOCALIZED 'V' #endif #define TRANSACTION_ISOLATION "transaction_isolation" @@ -506,7 +506,7 @@ char CC_add_statement(ConnectionClass *self, StatementClass *stmt) { int i; char ret = TRUE; - MYLOG(ES_DEBUG, "self=%p, stmt=%p\n", self, stmt); + MYLOG(OPENSEARCH_DEBUG, "self=%p, stmt=%p\n", self, stmt); CONNLOCK_ACQUIRE(self); for (i = 0; i < self->num_stmts; i++) { @@ -550,7 +550,7 @@ char CC_add_statement(ConnectionClass *self, StatementClass *stmt) { static void CC_set_error_statements(ConnectionClass *self) { int i; - MYLOG(ES_TRACE, "entering self=%p\n", self); + MYLOG(OPENSEARCH_TRACE, "entering self=%p\n", self); for (i = 0; i < self->num_stmts; i++) { if (NULL != self->stmts[i]) @@ -615,7 +615,7 @@ void CC_set_errormsg(ConnectionClass *self, const char *message) { int CC_get_error(ConnectionClass *self, int *number, char **message) { int rv; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); CONNLOCK_ACQUIRE(self); @@ -627,7 +627,7 @@ int CC_get_error(ConnectionClass *self, int *number, char **message) { CONNLOCK_RELEASE(self); - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); return rv; } @@ -636,19 +636,19 @@ void CC_log_error(const char *func, const char *desc, #define NULLCHECK(a) (a ? a : "(NULL)") if (self) { - MYLOG(ES_ERROR, + MYLOG(OPENSEARCH_ERROR, "CONN ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->__error_number, NULLCHECK(self->__error_message)); - MYLOG(ES_ERROR, + MYLOG(OPENSEARCH_ERROR, " " "------------------------------------------------------------\n"); - MYLOG(ES_ERROR, + MYLOG(OPENSEARCH_ERROR, " henv=%p, conn=%p, status=%u, num_stmts=%d\n", self->henv, self, self->status, self->num_stmts); - MYLOG(ES_ERROR, " esconn=%p, stmts=%p, lobj_type=%d\n", - self->esconn, self->stmts, self->lobj_type); + MYLOG(OPENSEARCH_ERROR, " opensearchconn=%p, stmts=%p, lobj_type=%d\n", + self->opensearchconn, self->stmts, self->lobj_type); } else { - MYLOG(ES_ERROR, "INVALID CONNECTION HANDLE ERROR: func=%s, desc='%s'\n", + MYLOG(OPENSEARCH_ERROR, "INVALID CONNECTION HANDLE ERROR: func=%s, desc='%s'\n", func, desc); } } diff --git a/sql-odbc/src/odfesqlodbc/convert.c b/sql-odbc/src/odfesqlodbc/convert.c index 7a03f6fa73..5aaa6540cf 100644 --- a/sql-odbc/src/odfesqlodbc/convert.c +++ b/sql-odbc/src/odfesqlodbc/convert.c @@ -38,9 +38,9 @@ #include "bind.h" #include "catfunc.h" -#include "es_apifunc.h" -#include "es_connection.h" -#include "es_types.h" +#include "opensearch_types.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" @@ -72,13 +72,13 @@ typedef struct { 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, +static size_t convert_from_opensearchbinary(const char *value, char *rgbValue, SQLLEN cbValueMax); static int convert_lo(StatementClass *stmt, const void *value, SQLSMALLINT fCType, PTR rgbValue, SQLLEN cbValueMax, SQLLEN *pcbValue); static int conv_from_octal(const char *s); -static SQLLEN es_bin2hex(const char *src, char *dst, SQLLEN length); +static SQLLEN opensearch_bin2hex(const char *src, char *dst, SQLLEN length); #ifdef UNICODE_SUPPORT static SQLLEN es_bin2whex(const char *src, SQLWCHAR *dst, SQLLEN length); #endif /* UNICODE_SUPPORT */ @@ -88,16 +88,16 @@ static SQLLEN es_bin2whex(const char *src, SQLWCHAR *dst, SQLLEN length); * * field_type fCType Output * ---------- ------ ---------- - * ES_TYPE_DATE SQL_C_DEFAULT SQL_C_DATE - * ES_TYPE_DATE SQL_C_DATE SQL_C_DATE - * ES_TYPE_DATE SQL_C_TIMESTAMP SQL_C_TIMESTAMP (time = 0 - *(midnight)) ES_TYPE_TIME SQL_C_DEFAULT SQL_C_TIME ES_TYPE_TIME + * OPENSEARCH_TYPE_DATE SQL_C_DEFAULT SQL_C_DATE + * OPENSEARCH_TYPE_DATE SQL_C_DATE SQL_C_DATE + * OPENSEARCH_TYPE_DATE SQL_C_TIMESTAMP SQL_C_TIMESTAMP (time = 0 + *(midnight)) OPENSEARCH_TYPE_TIME SQL_C_DEFAULT SQL_C_TIME OPENSEARCH_TYPE_TIME *SQL_C_TIME SQL_C_TIME - * ES_TYPE_TIME SQL_C_TIMESTAMP SQL_C_TIMESTAMP (date = - *current date) ES_TYPE_ABSTIME SQL_C_DEFAULT SQL_C_TIMESTAMP - *ES_TYPE_ABSTIME SQL_C_DATE SQL_C_DATE (time is truncated) - *ES_TYPE_ABSTIME SQL_C_TIME SQL_C_TIME (date is truncated) - *ES_TYPE_ABSTIME SQL_C_TIMESTAMP SQL_C_TIMESTAMP + * OPENSEARCH_TYPE_TIME SQL_C_TIMESTAMP SQL_C_TIMESTAMP (date = + *current date) OPENSEARCH_TYPE_ABSTIME SQL_C_DEFAULT SQL_C_TIMESTAMP + *OPENSEARCH_TYPE_ABSTIME SQL_C_DATE SQL_C_DATE (time is truncated) + *OPENSEARCH_TYPE_ABSTIME SQL_C_TIME SQL_C_TIME (date is truncated) + *OPENSEARCH_TYPE_ABSTIME SQL_C_TIMESTAMP SQL_C_TIMESTAMP *--------- */ @@ -696,7 +696,7 @@ static int setup_getdataclass(SQLLEN *const length_return, BOOL hybrid = FALSE; #endif /* UNICODE_SUPPORT */ - if (ES_TYPE_BYTEA == field_type) { + if (OPENSEARCH_TYPE_BYTEA == field_type) { if (SQL_C_BINARY == fCType) bytea_process_kind = BYTEA_PROCESS_BINARY; else if (0 == strnicmp(neut_str, "\\x", 2)) /* hex format */ @@ -712,23 +712,23 @@ static int setup_getdataclass(SQLLEN *const length_return, { BOOL wcs_debug = 0; BOOL same_encoding = - (conn->ccsc == es_CS_code(conn->locale_encoding)); + (conn->ccsc == opensearch_CS_code(conn->locale_encoding)); BOOL is_utf8 = (UTF8 == conn->ccsc); switch (field_type) { - case ES_TYPE_UNKNOWN: - case ES_TYPE_BPCHAR: - case ES_TYPE_VARCHAR: - case ES_TYPE_TEXT: - case ES_TYPE_BPCHARARRAY: - case ES_TYPE_VARCHARARRAY: - case ES_TYPE_TEXTARRAY: + case OPENSEARCH_TYPE_UNKNOWN: + case OPENSEARCH_TYPE_BPCHAR: + case OPENSEARCH_TYPE_VARCHAR: + case OPENSEARCH_TYPE_TEXT: + case OPENSEARCH_TYPE_BPCHARARRAY: + case OPENSEARCH_TYPE_VARCHARARRAY: + case OPENSEARCH_TYPE_TEXTARRAY: if (SQL_C_CHAR == fCType || SQL_C_BINARY == fCType) localize_needed = (!same_encoding || wcs_debug); if (SQL_C_WCHAR == fCType) hybrid = (!is_utf8 || (same_encoding && wcs_debug)); } - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "localize=%d hybrid=%d is_utf8=%d same_encoding=%d " "wcs_debug=%d\n", localize_needed, hybrid, is_utf8, same_encoding, wcs_debug); @@ -736,9 +736,9 @@ static int setup_getdataclass(SQLLEN *const length_return, } if (fCType == SQL_C_WCHAR) { if (BYTEA_PROCESS_ESCAPE == bytea_process_kind) - unicode_count = (int)convert_from_esbinary(neut_str, NULL, 0) * 2; + unicode_count = (int)convert_from_opensearchbinary(neut_str, NULL, 0) * 2; else if (hybrid) { - MYLOG(ES_DEBUG, "hybrid estimate\n"); + MYLOG(OPENSEARCH_DEBUG, "hybrid estimate\n"); if ((unicode_count = (int)bindcol_hybrid_estimate(neut_str, lf_conv, &allocbuf)) < 0) { @@ -765,7 +765,7 @@ static int setup_getdataclass(SQLLEN *const length_return, if (already_processed) /* skip */ ; else if (0 != bytea_process_kind) { - len = convert_from_esbinary(neut_str, NULL, 0); + len = convert_from_opensearchbinary(neut_str, NULL, 0); if (BYTEA_PROCESS_BINARY != bytea_process_kind) len *= 2; changed = TRUE; @@ -800,7 +800,7 @@ static int setup_getdataclass(SQLLEN *const length_return, #ifdef UNICODE_SUPPORT if (fCType == SQL_C_WCHAR) { if (BYTEA_PROCESS_ESCAPE == bytea_process_kind) { - len = convert_from_esbinary(neut_str, esdc->ttlbuf, + len = convert_from_opensearchbinary(neut_str, esdc->ttlbuf, esdc->ttlbuflen); len = es_bin2whex(esdc->ttlbuf, (SQLWCHAR *)esdc->ttlbuf, len); } else { @@ -810,7 +810,7 @@ static int setup_getdataclass(SQLLEN *const length_return, FALSE); else /* hybrid */ { - MYLOG(ES_DEBUG, "hybrid convert\n"); + MYLOG(OPENSEARCH_DEBUG, "hybrid convert\n"); if (bindcol_hybrid_exec((SQLWCHAR *)esdc->ttlbuf, neut_str, unicode_count + 1, lf_conv, &allocbuf) @@ -834,10 +834,10 @@ static int setup_getdataclass(SQLLEN *const length_return, if (already_processed) ; else if (0 != bytea_process_kind) { - len = - convert_from_esbinary(neut_str, esdc->ttlbuf, esdc->ttlbuflen); + len = convert_from_opensearchbinary(neut_str, esdc->ttlbuf, + esdc->ttlbuflen); if (BYTEA_PROCESS_ESCAPE == bytea_process_kind) - len = es_bin2hex(esdc->ttlbuf, esdc->ttlbuf, len); + len = opensearch_bin2hex(esdc->ttlbuf, esdc->ttlbuf, len); } else convert_linefeeds(neut_str, esdc->ttlbuf, esdc->ttlbuflen, lf_conv, &changed); @@ -884,12 +884,12 @@ static int convert_text_field_to_sql_c( int copy_len = 0, needbuflen = 0, i; const char *ptr; - MYLOG(ES_DEBUG, "field_type=%u type=%d\n", field_type, fCType); + MYLOG(OPENSEARCH_DEBUG, "field_type=%u type=%d\n", field_type, fCType); switch (field_type) { - case ES_TYPE_FLOAT4: - case ES_TYPE_FLOAT8: - case ES_TYPE_NUMERIC: + case OPENSEARCH_TYPE_FLOAT4: + case OPENSEARCH_TYPE_FLOAT8: + case OPENSEARCH_TYPE_NUMERIC: set_client_decimal_point((char *)neut_str); break; } @@ -910,7 +910,7 @@ static int convert_text_field_to_sql_c( len = esdc->ttlbufused; } - MYLOG(ES_DEBUG, "DEFAULT: len = " FORMAT_LEN ", ptr = '%.*s'\n", len, + MYLOG(OPENSEARCH_DEBUG, "DEFAULT: len = " FORMAT_LEN ", ptr = '%.*s'\n", len, (int)len, ptr); if (current_col >= 0) { @@ -962,19 +962,19 @@ static int convert_text_field_to_sql_c( #ifdef UNICODE_SUPPORT if (SQL_C_WCHAR == fCType) - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, " SQL_C_WCHAR, default: len = " FORMAT_LEN ", cbValueMax = " FORMAT_LEN ", rgbValueBindRow = '%s'\n", len, cbValueMax, rgbValueBindRow); else #endif /* UNICODE_SUPPORT */ if (SQL_C_BINARY == fCType) - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, " SQL_C_BINARY, default: len = " FORMAT_LEN ", cbValueMax = " FORMAT_LEN ", rgbValueBindRow = '%.*s'\n", len, cbValueMax, copy_len, rgbValueBindRow); else - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, " SQL_C_CHAR, default: len = " FORMAT_LEN ", cbValueMax = " FORMAT_LEN ", rgbValueBindRow = '%s'\n", len, cbValueMax, rgbValueBindRow); @@ -1059,7 +1059,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, memset(&std_time, 0, sizeof(SIMPLE_TIME)); - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "field_type = %d, fctype = %d, value = '%s', cbValueMax=" FORMAT_LEN "\n", field_type, fCType, (value == NULL) ? "" : value, cbValueMax); @@ -1090,7 +1090,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, } /* - * First convert any specific elasticsearch types into more useable data. + * First convert any specific OpenSearch types into more useable data. * * NOTE: Conversions from ES char/varchar of a date/time/timestamp value * to SQL_C_DATE,SQL_C_TIME, SQL_C_TIMESTAMP not supported @@ -1098,22 +1098,22 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, switch (field_type) { /* * $$$ need to add parsing for date/time/timestamp strings in - * ES_TYPE_CHAR,VARCHAR $$$ + * OPENSEARCH_TYPE_CHAR,VARCHAR $$$ */ - case ES_TYPE_DATE: + case OPENSEARCH_TYPE_DATE: sscanf(value, "%4d-%2d-%2d", &std_time.y, &std_time.m, &std_time.d); break; - case ES_TYPE_TIME: { + case OPENSEARCH_TYPE_TIME: { BOOL bZone = FALSE; /* time zone stuff is unreliable */ int zone; timestamp2stime(value, &std_time, &bZone, &zone); } break; - case ES_TYPE_ABSTIME: - case ES_TYPE_DATETIME: - case ES_TYPE_TIMESTAMP_NO_TMZONE: - case ES_TYPE_TIMESTAMP: + case OPENSEARCH_TYPE_ABSTIME: + case OPENSEARCH_TYPE_DATETIME: + case OPENSEARCH_TYPE_TIMESTAMP_NO_TMZONE: + case OPENSEARCH_TYPE_TIMESTAMP: std_time.fr = 0; std_time.infinity = 0; if (strnicmp(value, INFINITY_STRING, 8) == 0) { @@ -1136,7 +1136,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, std_time.ss = 0; } if (strnicmp(value, "invalid", 7) != 0) { - BOOL bZone = field_type != ES_TYPE_TIMESTAMP_NO_TMZONE; + BOOL bZone = field_type != OPENSEARCH_TYPE_TIMESTAMP_NO_TMZONE; int zone; /* @@ -1146,7 +1146,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, */ bZone = FALSE; /* time zone stuff is unreliable */ timestamp2stime(value, &std_time, &bZone, &zone); - MYLOG(ES_ALL, "2stime fr=%d\n", std_time.fr); + MYLOG(OPENSEARCH_ALL, "2stime fr=%d\n", std_time.fr); } else { /* * The timestamp is invalid so set something conspicuous, @@ -1168,7 +1168,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, } break; - case ES_TYPE_BOOL: { /* change T/F to 1/0 */ + case OPENSEARCH_TYPE_BOOL: { /* change T/F to 1/0 */ switch (((char *)value)[0]) { case 'f': case 'F': @@ -1184,7 +1184,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, } break; /* This is for internal use by SQLStatistics() */ - case ES_TYPE_INT2VECTOR: + case OPENSEARCH_TYPE_INT2VECTOR: if (SQL_C_DEFAULT == fCType) { int i, nval, maxc; const char *vp; @@ -1196,7 +1196,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, maxc = (int)cbValueMax / sizeof(short); vp = value; nval = 0; - MYLOG(ES_DEBUG, "index=("); + MYLOG(OPENSEARCH_DEBUG, "index=("); for (i = 0;; i++) { if (sscanf(vp, "%hi", &shortv) != 1) break; @@ -1235,7 +1235,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, * This is a large object OID, which is used to store * LONGVARBINARY objects. */ - case ES_TYPE_LO_UNDEFINED: + case OPENSEARCH_TYPE_LO_UNDEFINED: return convert_lo(stmt, value, fCType, rgbValueBindRow, cbValueMax, pcbValueBindRow); @@ -1247,7 +1247,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, if (field_type == (OID)stmt->hdbc ->lobj_type /* hack until permanent type available */ - || (ES_TYPE_OID == field_type && SQL_C_BINARY == fCType + || (OPENSEARCH_TYPE_OID == field_type && SQL_C_BINARY == fCType && conn->lo_is_domain)) return convert_lo(stmt, value, fCType, rgbValueBindRow, cbValueMax, pcbValueBindRow); @@ -1255,13 +1255,13 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, /* Change default into something useable */ if (fCType == SQL_C_DEFAULT) { - fCType = estype_attr_to_ctype(conn, field_type, atttypmod); + fCType = opensearchtype_attr_to_ctype(conn, field_type, atttypmod); #ifdef UNICODE_SUPPORT if (fCType == SQL_C_WCHAR && CC_default_is_c(conn)) fCType = SQL_C_CHAR; #endif - MYLOG(ES_DEBUG, ", SQL_C_DEFAULT: fCType = %d\n", fCType); + MYLOG(OPENSEARCH_DEBUG, ", SQL_C_DEFAULT: fCType = %d\n", fCType); } text_bin_handling = FALSE; @@ -1275,16 +1275,16 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, break; case SQL_C_BINARY: switch (field_type) { - case ES_TYPE_UNKNOWN: - case ES_TYPE_BPCHAR: - case ES_TYPE_VARCHAR: - case ES_TYPE_TEXT: - case ES_TYPE_XML: - case ES_TYPE_BPCHARARRAY: - case ES_TYPE_VARCHARARRAY: - case ES_TYPE_TEXTARRAY: - case ES_TYPE_XMLARRAY: - case ES_TYPE_BYTEA: + case OPENSEARCH_TYPE_UNKNOWN: + case OPENSEARCH_TYPE_BPCHAR: + case OPENSEARCH_TYPE_VARCHAR: + case OPENSEARCH_TYPE_TEXT: + case OPENSEARCH_TYPE_XML: + case OPENSEARCH_TYPE_BPCHARARRAY: + case OPENSEARCH_TYPE_VARCHARARRAY: + case OPENSEARCH_TYPE_TEXTARRAY: + case OPENSEARCH_TYPE_XMLARRAY: + case OPENSEARCH_TYPE_BYTEA: text_bin_handling = TRUE; break; } @@ -1303,12 +1303,12 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, * enough. */ switch (field_type) { - case ES_TYPE_DATE: + case OPENSEARCH_TYPE_DATE: len = SPRINTF_FIXED(midtemp, "%.4d-%.2d-%.2d", std_time.y, std_time.m, std_time.d); break; - case ES_TYPE_TIME: + case OPENSEARCH_TYPE_TIME: len = SPRINTF_FIXED(midtemp, "%.2d:%.2d:%.2d", std_time.hh, std_time.mm, std_time.ss); if (std_time.fr > 0) { @@ -1321,20 +1321,20 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, } break; - case ES_TYPE_ABSTIME: - case ES_TYPE_DATETIME: - case ES_TYPE_TIMESTAMP_NO_TMZONE: - case ES_TYPE_TIMESTAMP: + case OPENSEARCH_TYPE_ABSTIME: + case OPENSEARCH_TYPE_DATETIME: + case OPENSEARCH_TYPE_TIMESTAMP_NO_TMZONE: + case OPENSEARCH_TYPE_TIMESTAMP: len = stime2timestamp(&std_time, midtemp, midsize, FALSE, (int)(midsize - 19 - 2)); break; - case ES_TYPE_UUID: + case OPENSEARCH_TYPE_UUID: len = strlen(neut_str); for (i = 0; i < len && i < midsize - 2; i++) midtemp[i] = (char)toupper((UCHAR)neut_str[i]); midtemp[i] = '\0'; - MYLOG(ES_DEBUG, "ES_TYPE_UUID: rgbValueBindRow = '%s'\n", + MYLOG(OPENSEARCH_DEBUG, "OPENSEARCH_TYPE_UUID: rgbValueBindRow = '%s'\n", rgbValueBindRow); break; @@ -1344,14 +1344,14 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, * cbValueMax because the driver can't handle multiple * calls to SQLGetData for these, yet. Most likely, the * buffer passed in will be big enough to handle the - * maximum limit of elasticsearch, anyway. + * maximum limit of OpenSearch, anyway. * * LongVarBinary types are handled correctly above, observing * truncation and all that stuff since there is * essentially no limit on the large object used to store * those. */ - case ES_TYPE_BYTEA: /* convert binary data to hex strings + case OPENSEARCH_TYPE_BYTEA: /* convert binary data to hex strings * (i.e, 255 = "FF") */ default: @@ -1370,11 +1370,11 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, * But to convert to numeric types, it is necessary to get rid of * those. */ - if (field_type == ES_TYPE_MONEY) { + if (field_type == OPENSEARCH_TYPE_MONEY) { if (convert_money(neut_str, midtemp, sizeof(midtemp))) neut_str = midtemp; else { - MYLOG(ES_DEBUG, "couldn't convert money type to %d\n", fCType); + MYLOG(OPENSEARCH_DEBUG, "couldn't convert money type to %d\n", fCType); return COPY_UNSUPPORTED_TYPE; } } @@ -1590,10 +1590,10 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, #endif /* ODBCINT64 */ case SQL_C_BINARY: /* The following is for SQL_C_VARBOOKMARK */ - if (ES_TYPE_INT4 == field_type) { + if (OPENSEARCH_TYPE_INT4 == field_type) { UInt4 ival = ATOI32U(neut_str); - MYLOG(ES_ALL, "SQL_C_VARBOOKMARK value=%d\n", ival); + MYLOG(OPENSEARCH_ALL, "SQL_C_VARBOOKMARK value=%d\n", ival); if (pcbValue) *pcbValueBindRow = sizeof(ival); if (cbValueMax >= (SQLLEN)sizeof(ival)) { @@ -1601,7 +1601,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, return COPY_OK; } else return COPY_RESULT_TRUNCATED; - } else if (ES_TYPE_UUID == field_type) { + } else if (OPENSEARCH_TYPE_UUID == field_type) { int rtn = char2guid(neut_str, &g); if (COPY_OK != rtn) @@ -1614,7 +1614,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, } else return COPY_RESULT_TRUNCATED; } else { - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "couldn't convert the type %d to SQL_C_BINARY\n", field_type); return COPY_UNSUPPORTED_TYPE; @@ -1624,7 +1624,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, result = char2guid(neut_str, &g); if (COPY_OK != result) { - MYLOG(ES_DEBUG, "Could not convert to SQL_C_GUID\n"); + MYLOG(OPENSEARCH_DEBUG, "Could not convert to SQL_C_GUID\n"); return COPY_UNSUPPORTED_TYPE; } len = sizeof(g); @@ -1652,7 +1652,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, break; default: - MYLOG(ES_DEBUG, "conversion to the type %d isn't supported\n", + MYLOG(OPENSEARCH_DEBUG, "conversion to the type %d isn't supported\n", fCType); return COPY_UNSUPPORTED_TYPE; } @@ -1910,7 +1910,7 @@ int findIdentifier(const UCHAR *str, int ccsc, const UCHAR **next_token) { return slen; } -static esNAME lower_or_remove_dquote(esNAME nm, const UCHAR *src, int srclen, +static opensearchNAME lower_or_remove_dquote(opensearchNAME nm, const UCHAR *src, int srclen, int ccsc) { int i, outlen; char *tc; @@ -1953,8 +1953,8 @@ static esNAME lower_or_remove_dquote(esNAME nm, const UCHAR *src, int srclen, return nm; } -int eatTableIdentifiers(const UCHAR *str, int ccsc, esNAME *table, - esNAME *schema) { +int eatTableIdentifiers(const UCHAR *str, int ccsc, opensearchNAME *table, + opensearchNAME *schema) { int len; const UCHAR *next_token; const UCHAR *tstr = str; @@ -2131,7 +2131,7 @@ size_t convert_linefeeds(const char *si, char *dst, size_t max, BOOL convlf, for (i = 0; si[i] && out < max - 1; i++) { if (convlf && si[i] == '\n') { /* Only add the carriage-return if needed */ - if (i > 0 && ES_CARRIAGE_RETURN == si[i - 1]) { + if (i > 0 && OPENSEARCH_CARRIAGE_RETURN == si[i - 1]) { if (dst) dst[out++] = si[i]; else @@ -2141,7 +2141,7 @@ size_t convert_linefeeds(const char *si, char *dst, size_t max, BOOL convlf, *changed = TRUE; if (dst) { - dst[out++] = ES_CARRIAGE_RETURN; + dst[out++] = OPENSEARCH_CARRIAGE_RETURN; dst[out++] = '\n'; } else out += 2; @@ -2168,7 +2168,7 @@ static int conv_from_octal(const char *s) { } /* convert octal escapes to bytes */ -static size_t convert_from_esbinary(const char *value, char *rgbValue, +static size_t convert_from_opensearchbinary(const char *value, char *rgbValue, SQLLEN cbValueMax) { UNUSED(cbValueMax); size_t i, ilen = strlen(value); @@ -2186,7 +2186,7 @@ static size_t convert_from_esbinary(const char *value, char *rgbValue, if (i < ilen) { ilen -= i; if (rgbValue) - es_hex2bin(value + i, rgbValue + o, ilen); + opensearch_hex2bin(value + i, rgbValue + o, ilen); o += ilen / 2; } break; @@ -2203,14 +2203,14 @@ static size_t convert_from_esbinary(const char *value, char *rgbValue, i++; } /** if (rgbValue) - MYLOG(ES_DEBUG, "i=%d, rgbValue[%d] = %d, %c\n", i, o, rgbValue[o], + MYLOG(OPENSEARCH_DEBUG, "i=%d, rgbValue[%d] = %d, %c\n", i, o, rgbValue[o], rgbValue[o]); ***/ } if (rgbValue) rgbValue[o] = '\0'; /* extra protection */ - MYLOG(ES_DEBUG, "in=" FORMAT_SIZE_T ", out = " FORMAT_SIZE_T "\n", ilen, o); + MYLOG(OPENSEARCH_DEBUG, "in=" FORMAT_SIZE_T ", out = " FORMAT_SIZE_T "\n", ilen, o); return o; } @@ -2254,9 +2254,9 @@ static const char *hextbl = "0123456789ABCDEF"; static SQLLEN es_bin2whex def_bin2hex(SQLWCHAR) #endif /* UNICODE_SUPPORT */ - static SQLLEN es_bin2hex def_bin2hex(char) + static SQLLEN opensearch_bin2hex def_bin2hex(char) - SQLLEN es_hex2bin(const char *src, char *dst, SQLLEN length) { + SQLLEN opensearch_hex2bin(const char *in, char *out, SQLLEN len) { UCHAR chr; const char *src_wk; char *dst_wk; @@ -2264,7 +2264,7 @@ static SQLLEN es_bin2whex def_bin2hex(SQLWCHAR) int val; BOOL HByte = TRUE; - for (i = 0, src_wk = src, dst_wk = dst; i < length; i++, src_wk++) { + for (i = 0, src_wk = in, dst_wk = out; i < len; i++, src_wk++) { chr = *src_wk; if (!chr) break; @@ -2283,7 +2283,7 @@ static SQLLEN es_bin2whex def_bin2hex(SQLWCHAR) HByte = !HByte; } *dst_wk = '\0'; - return length; + return len; } static int convert_lo(StatementClass *stmt, const void *value, diff --git a/sql-odbc/src/odfesqlodbc/convert.h b/sql-odbc/src/odfesqlodbc/convert.h index 31f112e67c..63942d3cf2 100644 --- a/sql-odbc/src/odfesqlodbc/convert.h +++ b/sql-odbc/src/odfesqlodbc/convert.h @@ -17,7 +17,7 @@ #ifndef __CONVERT_H__ #define __CONVERT_H__ -#include "es_odbc.h" +#include "opensearch_odbc.h" #ifdef __cplusplus extern "C" { @@ -38,7 +38,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, PTR rgbValue, SQLLEN cbValueMax, SQLLEN *pcbValue, SQLLEN *pIndicator); -SQLLEN es_hex2bin(const char *in, char *out, SQLLEN len); +SQLLEN opensearch_hex2bin(const char *in, char *out, SQLLEN len); #ifdef __cplusplus } diff --git a/sql-odbc/src/odfesqlodbc/descriptor.c b/sql-odbc/src/odfesqlodbc/descriptor.c index 7f3902473d..3266daef73 100644 --- a/sql-odbc/src/odfesqlodbc/descriptor.c +++ b/sql-odbc/src/odfesqlodbc/descriptor.c @@ -21,22 +21,22 @@ #include #include "environ.h" -#include "es_apifunc.h" -#include "es_connection.h" #include "misc.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" void TI_Destructor(TABLE_INFO **ti, int count) { int i; - MYLOG(ES_TRACE, "entering count=%d\n", count); + MYLOG(OPENSEARCH_TRACE, "entering count=%d\n", count); if (ti) { for (i = 0; i < count; i++) { if (ti[i]) { COL_INFO *coli = ti[i]->col_info; if (coli) { - MYLOG(ES_ALL, "!!!refcnt %p:%d -> %d\n", coli, coli->refcnt, + MYLOG(OPENSEARCH_ALL, "!!!refcnt %p:%d -> %d\n", coli, coli->refcnt, coli->refcnt - 1); coli->refcnt--; if (coli->refcnt <= 0 @@ -60,7 +60,7 @@ void TI_Destructor(TABLE_INFO **ti, int count) { void FI_Destructor(FIELD_INFO **fi, int count, BOOL freeFI) { int i; - MYLOG(ES_TRACE, "entering count=%d\n", count); + MYLOG(OPENSEARCH_TRACE, "entering count=%d\n", count); if (fi) { for (i = 0; i < count; i++) { if (fi[i]) { @@ -102,7 +102,7 @@ void DC_Constructor(DescriptorClass *self, BOOL embedded, } static void ARDFields_free(ARDFields *self) { - MYLOG(ES_TRACE, "entering %p bookmark=%p\n", self, self->bookmark); + MYLOG(OPENSEARCH_TRACE, "entering %p bookmark=%p\n", self, self->bookmark); if (self->bookmark) { free(self->bookmark); self->bookmark = NULL; @@ -145,9 +145,9 @@ void DC_Destructor(DescriptorClass *self) { free(deschd->__error_message); deschd->__error_message = NULL; } - if (deschd->eserror) { - ER_Destructor(deschd->eserror); - deschd->eserror = NULL; + if (deschd->opensearch_error) { + ER_Destructor(deschd->opensearch_error); + deschd->opensearch_error = NULL; } if (deschd->type_defined) { switch (deschd->desc_type) { @@ -228,7 +228,7 @@ char CC_add_descriptor(ConnectionClass *self, DescriptorClass *desc) { int new_num_descs; DescriptorClass **descs; - MYLOG(ES_TRACE, "entering self=%p, desc=%p\n", self, desc); + MYLOG(OPENSEARCH_TRACE, "entering self=%p, desc=%p\n", self, desc); for (i = 0; i < self->num_descs; i++) { if (!self->descs[i]) { @@ -257,14 +257,14 @@ char CC_add_descriptor(ConnectionClass *self, DescriptorClass *desc) { /* * This API allocates a Application descriptor. */ -RETCODE SQL_API ESAPI_AllocDesc(HDBC ConnectionHandle, +RETCODE SQL_API OPENSEARCHAPI_AllocDesc(HDBC ConnectionHandle, SQLHDESC *DescriptorHandle) { - CSTR func = "ESAPI_AllocDesc"; + CSTR func = "OPENSEARCHAPI_AllocDesc"; ConnectionClass *conn = (ConnectionClass *)ConnectionHandle; RETCODE ret = SQL_SUCCESS; DescriptorClass *desc; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); desc = (DescriptorClass *)malloc(sizeof(DescriptorClass)); if (desc) { @@ -286,11 +286,11 @@ RETCODE SQL_API ESAPI_AllocDesc(HDBC ConnectionHandle, return ret; } -RETCODE SQL_API ESAPI_FreeDesc(SQLHDESC DescriptorHandle) { +RETCODE SQL_API OPENSEARCHAPI_FreeDesc(SQLHDESC DescriptorHandle) { DescriptorClass *desc = (DescriptorClass *)DescriptorHandle; RETCODE ret = SQL_SUCCESS; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); DC_Destructor(desc); if (!desc->deschd.embedded) { int i; @@ -382,7 +382,7 @@ static void IPDFields_copy(const IPDFields *src, IPDFields *target) { } } -RETCODE SQL_API ESAPI_CopyDesc(SQLHDESC SourceDescHandle, +RETCODE SQL_API OPENSEARCHAPI_CopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle) { RETCODE ret = SQL_ERROR; DescriptorClass *src, *target; @@ -391,26 +391,26 @@ RETCODE SQL_API ESAPI_CopyDesc(SQLHDESC SourceDescHandle, APDFields *apd_src, *apd_tgt; IPDFields *ipd_src, *ipd_tgt; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); src = (DescriptorClass *)SourceDescHandle; target = (DescriptorClass *)TargetDescHandle; srchd = &(src->deschd); targethd = &(target->deschd); if (!srchd->type_defined) { - MYLOG(ES_ERROR, "source type undefined\n"); + MYLOG(OPENSEARCH_ERROR, "source type undefined\n"); DC_set_error(target, DESC_EXEC_ERROR, "source handle type undefined"); return ret; } if (targethd->type_defined) { - MYLOG(ES_DEBUG, "source type=%d -> target type=%d\n", srchd->desc_type, + MYLOG(OPENSEARCH_DEBUG, "source type=%d -> target type=%d\n", srchd->desc_type, targethd->desc_type); if (SQL_ATTR_IMP_ROW_DESC == targethd->desc_type) { - MYLOG(ES_DEBUG, "can't modify IRD\n"); + MYLOG(OPENSEARCH_DEBUG, "can't modify IRD\n"); DC_set_error(target, DESC_EXEC_ERROR, "can't copy to IRD"); return ret; } else if (targethd->desc_type != srchd->desc_type) { if (targethd->embedded) { - MYLOG(ES_DEBUG, "src type != target type\n"); + MYLOG(OPENSEARCH_DEBUG, "src type != target type\n"); DC_set_error( target, DESC_EXEC_ERROR, "copying different type descriptor to embedded one"); @@ -422,21 +422,21 @@ RETCODE SQL_API ESAPI_CopyDesc(SQLHDESC SourceDescHandle, ret = SQL_SUCCESS; switch (srchd->desc_type) { case SQL_ATTR_APP_ROW_DESC: - MYLOG(ES_DEBUG, "src=%p target=%p type=%d", src, target, + MYLOG(OPENSEARCH_DEBUG, "src=%p target=%p type=%d", src, target, srchd->desc_type); if (!targethd->type_defined) { targethd->desc_type = srchd->desc_type; } ard_src = &(src->ardf); - MYPRINTF(ES_DEBUG, + MYPRINTF(OPENSEARCH_DEBUG, " rowset_size=" FORMAT_LEN " bind_size=" FORMAT_UINTEGER " ope_ptr=%p off_ptr=%p\n", ard_src->size_of_rowset, ard_src->bind_size, ard_src->row_operation_ptr, ard_src->row_offset_ptr); ard_tgt = &(target->ardf); - MYPRINTF(ES_DEBUG, " target=%p", ard_tgt); + MYPRINTF(OPENSEARCH_DEBUG, " target=%p", ard_tgt); ARDFields_copy(ard_src, ard_tgt); - MYPRINTF(ES_DEBUG, " offset_ptr=%p\n", ard_tgt->row_offset_ptr); + MYPRINTF(OPENSEARCH_DEBUG, " offset_ptr=%p\n", ard_tgt->row_offset_ptr); break; case SQL_ATTR_APP_PARAM_DESC: if (!targethd->type_defined) { @@ -455,7 +455,7 @@ RETCODE SQL_API ESAPI_CopyDesc(SQLHDESC SourceDescHandle, IPDFields_copy(ipd_src, ipd_tgt); break; default: - MYLOG(ES_DEBUG, "invalid descriptor handle type=%d\n", + MYLOG(OPENSEARCH_DEBUG, "invalid descriptor handle type=%d\n", srchd->desc_type); DC_set_error(target, DESC_EXEC_ERROR, "invalid descriptor type"); ret = SQL_ERROR; @@ -536,16 +536,16 @@ static const struct { {DESC_COUNT_FIELD_INCORRECT, "07002", "07002"}, }; -static ES_ErrorInfo *DC_create_errorinfo(const DescriptorClass *self) { +static OpenSearch_ErrorInfo *DC_create_errorinfo(const DescriptorClass *self) { const DescriptorHeader *deschd = &(self->deschd); - ES_ErrorInfo *error; + OpenSearch_ErrorInfo *error; ConnectionClass *conn; EnvironmentClass *env; Int4 errornum; BOOL env_is_odbc3 = TRUE; - if (deschd->eserror) - return deschd->eserror; + if (deschd->opensearch_error) + return deschd->opensearch_error; errornum = deschd->__error_number; error = ER_Constructor(errornum, deschd->__error_message); if (!error) @@ -567,7 +567,7 @@ void DC_log_error(const char *func, const char *desc, const DescriptorClass *self) { #define nullcheck(a) (a ? a : "(NULL)") if (self) { - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "DESCRIPTOR ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->deschd.__error_number, nullcheck(self->deschd.__error_message)); @@ -575,7 +575,7 @@ void DC_log_error(const char *func, const char *desc, } /* Returns the next SQL error information. */ -RETCODE SQL_API ESAPI_DescError(SQLHDESC hdesc, SQLSMALLINT RecNumber, +RETCODE SQL_API OPENSEARCHAPI_DescError(SQLHDESC hdesc, SQLSMALLINT RecNumber, SQLCHAR *szSqlState, SQLINTEGER *pfNativeError, SQLCHAR *szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT *pcbErrorMsg, UWORD flag) { @@ -583,8 +583,8 @@ RETCODE SQL_API ESAPI_DescError(SQLHDESC hdesc, SQLSMALLINT RecNumber, DescriptorClass *desc = (DescriptorClass *)hdesc; DescriptorHeader *deschd = &(desc->deschd); - MYLOG(ES_TRACE, "entering RecN=%hd\n", RecNumber); - deschd->eserror = DC_create_errorinfo(desc); - return ER_ReturnError(deschd->eserror, RecNumber, szSqlState, pfNativeError, + MYLOG(OPENSEARCH_TRACE, "entering RecN=%hd\n", RecNumber); + deschd->opensearch_error = DC_create_errorinfo(desc); + return ER_ReturnError(deschd->opensearch_error, RecNumber, szSqlState, pfNativeError, szErrorMsg, cbErrorMsgMax, pcbErrorMsg, flag); } diff --git a/sql-odbc/src/odfesqlodbc/descriptor.h b/sql-odbc/src/odfesqlodbc/descriptor.h index 6ff4f4bfec..d7ab45feaa 100644 --- a/sql-odbc/src/odfesqlodbc/descriptor.h +++ b/sql-odbc/src/odfesqlodbc/descriptor.h @@ -17,7 +17,7 @@ #ifndef __DESCRIPTOR_H__ #define __DESCRIPTOR_H__ -#include "es_odbc.h" +#include "opensearch_odbc.h" #ifdef WIN32 #pragma warning(push) @@ -29,10 +29,10 @@ typedef struct InheritanceClass { UInt4 allocated; UInt4 count; OID cur_tableoid; - esNAME cur_fullTable; + opensearchNAME cur_fullTable; struct { OID tableoid; - esNAME fullTable; + opensearchNAME fullTable; } inf[1]; } InheritanceClass; @@ -46,11 +46,11 @@ enum { typedef struct { OID table_oid; COL_INFO *col_info; /* cached SQLColumns info for this table */ - esNAME schema_name; - esNAME table_name; - esNAME table_alias; - esNAME bestitem; - esNAME bestqual; + opensearchNAME schema_name; + opensearchNAME table_name; + opensearchNAME table_alias; + opensearchNAME bestitem; + opensearchNAME bestqual; UInt4 flags; InheritanceClass *ih; } TABLE_INFO; @@ -80,10 +80,10 @@ typedef struct { char flag; char updatable; Int2 attnum; - esNAME schema_name; + opensearchNAME schema_name; TABLE_INFO *ti; /* to resolve explicit table names */ - esNAME column_name; - esNAME column_alias; + opensearchNAME column_name; + opensearchNAME column_alias; char nullable; char auto_increment; char func; @@ -99,7 +99,7 @@ typedef struct { char quote; char dquote; char numeric; - esNAME before_dot; + opensearchNAME before_dot; } FIELD_INFO; Int4 FI_precision(const FIELD_INFO *); void FI_Destructor(FIELD_INFO **, int, BOOL freeFI); @@ -116,7 +116,7 @@ typedef struct DescriptorHeader_ { UInt4 error_index; /* 1-based index */ Int4 __error_number; char *__error_message; - ES_ErrorInfo *eserror; + OpenSearch_ErrorInfo *opensearch_error; } DescriptorHeader; /* @@ -215,7 +215,7 @@ void IPD_free_params(IPDFields *self, char option); RETCODE DC_set_stmt(DescriptorClass *desc, StatementClass *stmt); void DC_set_error(DescriptorClass *desc, int errornumber, const char *errormsg); void DC_set_errormsg(DescriptorClass *desc, const char *errormsg); -ES_ErrorInfo *DC_get_error(DescriptorClass *self); +OpenSearch_ErrorInfo *DC_get_error(DescriptorClass *self); int DC_get_errornumber(const DescriptorClass *self); const char *DC_get_errormsg(const DescriptorClass *self); void DC_log_error(const char *func, const char *desc, diff --git a/sql-odbc/src/odfesqlodbc/dlg_specific.c b/sql-odbc/src/odfesqlodbc/dlg_specific.c index 5578bb64ef..50b637de4c 100644 --- a/sql-odbc/src/odfesqlodbc/dlg_specific.c +++ b/sql-odbc/src/odfesqlodbc/dlg_specific.c @@ -18,14 +18,14 @@ #include -#include "es_apifunc.h" #include "misc.h" +#include "opensearch_apifunc.h" #define NULL_IF_NULL(a) ((a) ? ((const char *)(a)) : "(null)") -static void encode(const esNAME, char *out, int outlen); -static esNAME decode(const char *in); -static esNAME decode_or_remove_braces(const char *in); +static void encode(const opensearchNAME, char *out, int outlen); +static opensearchNAME decode(const char *in); +static opensearchNAME decode_or_remove_braces(const char *in); #define OVR_EXTRA_BITS \ (BIT_FORCEABBREVCONNSTR | BIT_FAKE_MSS | BIT_BDE_ENVIRONMENT \ @@ -57,7 +57,7 @@ void makeConnectString(char *connect_string, const ConnInfo *ci, UWORD len) { connect_string, nlen, "%s=%s;" INI_SERVER "=%s;" - "database=elasticsearch;" INI_PORT "=%s;" INI_USERNAME_ABBR + "database=OpenSearch;" INI_PORT "=%s;" INI_USERNAME_ABBR "=%s;" INI_PASSWORD_ABBR "=%s;" INI_AUTH_MODE "=%s;" INI_REGION "=%s;" INI_SSL_USE "=%d;" INI_SSL_HOST_VERIFY "=%d;" INI_LOG_LEVEL "=%d;" INI_LOG_OUTPUT "=%s;" INI_TIMEOUT "=%s;" INI_FETCH_SIZE "=%s;", @@ -118,7 +118,7 @@ BOOL copyConnAttributes(ConnInfo *ci, const char *attribute, || (stricmp(attribute, INI_PASSWORD_ABBR) == 0)) { ci->password = decode_or_remove_braces(value); #ifndef FORCE_PASSWORDE_DISPLAY - MYLOG(ES_DEBUG, "key='%s' value='xxxxxxxx'\n", attribute); + MYLOG(OPENSEARCH_DEBUG, "key='%s' value='xxxxxxxx'\n", attribute); printed = TRUE; #endif } else if (stricmp(attribute, INI_AUTH_MODE) == 0) @@ -141,7 +141,7 @@ BOOL copyConnAttributes(ConnInfo *ci, const char *attribute, found = FALSE; if (!printed) - MYLOG(ES_DEBUG, "key='%s' value='%s'%s\n", attribute, value, + MYLOG(OPENSEARCH_DEBUG, "key='%s' value='%s'%s\n", attribute, value, found ? NULL_STRING : " not found"); return found; @@ -221,7 +221,7 @@ void getDSNinfo(ConnInfo *ci, const char *configDrvrname) { if (!drivername[0] && DSN[0]) getDriverNameFromDSN(DSN, (char *)drivername, sizeof(ci->drivername)); - MYLOG(ES_DEBUG, "drivername=%s\n", drivername); + MYLOG(OPENSEARCH_DEBUG, "drivername=%s\n", drivername); if (!drivername[0]) drivername = INVALID_DRIVER; getDriversDefaults(drivername, &(ci->drivers)); @@ -335,7 +335,7 @@ void writeDSNinfo(const ConnInfo *ci) { } -static void encode(const esNAME in, char *out, int outlen) { +static void encode(const opensearchNAME in, char *out, int outlen) { size_t i, ilen = 0; int o = 0; char inc, *ins; @@ -383,10 +383,10 @@ static unsigned int conv_from_hex(const char *s) { return y; } -static esNAME decode(const char *in) { +static opensearchNAME decode(const char *in) { size_t i, ilen = strlen(in), o = 0; char inc, *outs; - esNAME out; + opensearchNAME out; INIT_NAME(out); if (0 == ilen) { @@ -416,7 +416,7 @@ static esNAME decode(const char *in) { * Remove braces if the input value is enclosed by braces({}). * Othewise decode the input value. */ -static esNAME decode_or_remove_braces(const char *in) { +static opensearchNAME decode_or_remove_braces(const char *in) { if (OPENING_BRACKET == in[0]) { size_t inlen = strlen(in); if (CLOSING_BRACKET == in[inlen - 1]) /* enclosed with braces */ @@ -424,7 +424,7 @@ static esNAME decode_or_remove_braces(const char *in) { int i; const char *istr, *eptr; char *ostr; - esNAME out; + opensearchNAME out; INIT_NAME(out); if (NULL == (ostr = (char *)malloc(inlen))) @@ -449,7 +449,7 @@ void CC_conninfo_release(ConnInfo *conninfo) { } void CC_conninfo_init(ConnInfo *conninfo, UInt4 option) { - MYLOG(ES_TRACE, "entering opt=%d\n", option); + MYLOG(OPENSEARCH_TRACE, "entering opt=%d\n", option); if (0 != (CLEANUP_FOR_REUSE & option)) CC_conninfo_release(conninfo); diff --git a/sql-odbc/src/odfesqlodbc/dlg_specific.h b/sql-odbc/src/odfesqlodbc/dlg_specific.h index 02af631ae2..013f75a262 100644 --- a/sql-odbc/src/odfesqlodbc/dlg_specific.h +++ b/sql-odbc/src/odfesqlodbc/dlg_specific.h @@ -17,7 +17,7 @@ #ifndef __DLG_SPECIFIC_H__ #define __DLG_SPECIFIC_H__ -#include "es_odbc.h" +#include "opensearch_odbc.h" #ifdef WIN32 #include @@ -46,9 +46,9 @@ extern "C" { #define INVALID_DRIVER " @@driver not exist@@ " #ifdef UNICODE_SUPPORT -#define INI_DSN "Elasticsearch35W" +#define INI_DSN "OpenSearch35W" #else -#define INI_DSN "Elasticsearch30" +#define INI_DSN "OpenSearch30" #endif /* UNICODE_SUPPORT */ #define INI_HOST "host" @@ -76,7 +76,7 @@ extern "C" { #define DEFAULT_PORT "" #define DEFAULT_USERNAME "" #define DEFAULT_PASSWORD "" -#define DEFAULT_DRIVERNAME "elasticsearchodbc" +#define DEFAULT_DRIVERNAME "opensearchodbc" #define DEFAULT_DESC "" #define DEFAULT_DSN "" #define DEFAULT_REGION "" @@ -135,7 +135,7 @@ extern "C" { #define DEFAULT_UNKNOWNSASLONGVARCHAR 0 #define DEFAULT_BOOLSASCHAR 0 #define DEFAULT_UNIQUEINDEX 1 /* dont recognize */ -#define DEFAULT_LOGLEVEL ES_WARNING +#define DEFAULT_LOGLEVEL OPENSEARCH_WARNING #define DEFAULT_USE_SSL 0 #define DEFAULT_TRUST_SELF_SIGNED 0 #define DEFAULT_AUTH_MODE "NONE" diff --git a/sql-odbc/src/odfesqlodbc/dlg_wingui.c b/sql-odbc/src/odfesqlodbc/dlg_wingui.c index 62f76abe0a..5400a4748d 100644 --- a/sql-odbc/src/odfesqlodbc/dlg_wingui.c +++ b/sql-odbc/src/odfesqlodbc/dlg_wingui.c @@ -17,7 +17,7 @@ #ifdef WIN32 #include "dlg_specific.h" -#include "es_apifunc.h" +#include "opensearch_apifunc.h" #include "loadlib.h" #include "misc.h" // strncpy_null #include "win_setup.h" @@ -89,7 +89,7 @@ void SetAuthenticationVisibility(HWND hdlg, const struct authmode *am) { void SetDlgStuff(HWND hdlg, const ConnInfo *ci) { // Connection - SetDlgItemText(hdlg, IDC_DRIVER_VERSION, "V."ELASTICSEARCHDRIVERVERSION); + SetDlgItemText(hdlg, IDC_DRIVER_VERSION, "V."OPENSEARCHDRIVERVERSION); SetDlgItemText(hdlg, IDC_DSNAME, ci->dsn); SetDlgItemText(hdlg, IDC_SERVER, ci->server); SetDlgItemText(hdlg, IDC_PORT, ci->port); @@ -114,7 +114,7 @@ void SetDlgStuff(HWND hdlg, const ConnInfo *ci) { SetDlgItemText(hdlg, IDC_REGION, ci->region); } -static void GetNameField(HWND hdlg, int item, esNAME *name) { +static void GetNameField(HWND hdlg, int item, opensearchNAME *name) { char medium_buf[MEDIUM_REGISTRY_LEN + 1]; GetDlgItemText(hdlg, item, medium_buf, sizeof(medium_buf)); STR_TO_NAME((*name), medium_buf); @@ -221,31 +221,31 @@ INT_PTR CALLBACK logOptionsProc(HWND hdlg, UINT wMsg, WPARAM wParam, int log = GetCurrentLogLevel(hdlg); switch (log) { case IDS_LOGTYPE_OFF: - ci->drivers.loglevel = (char)ES_OFF; + ci->drivers.loglevel = (char)OPENSEARCH_OFF; break; case IDS_LOGTYPE_FATAL: - ci->drivers.loglevel = (char)ES_FATAL; + ci->drivers.loglevel = (char)OPENSEARCH_FATAL; break; case IDS_LOGTYPE_ERROR: - ci->drivers.loglevel = (char)ES_ERROR; + ci->drivers.loglevel = (char)OPENSEARCH_ERROR; break; case IDS_LOGTYPE_WARNING: - ci->drivers.loglevel = (char)ES_WARNING; + ci->drivers.loglevel = (char)OPENSEARCH_WARNING; break; case IDS_LOGTYPE_INFO: - ci->drivers.loglevel = (char)ES_INFO; + ci->drivers.loglevel = (char)OPENSEARCH_INFO; break; case IDS_LOGTYPE_DEBUG: - ci->drivers.loglevel = (char)ES_DEBUG; + ci->drivers.loglevel = (char)OPENSEARCH_DEBUG; break; case IDS_LOGTYPE_TRACE: - ci->drivers.loglevel = (char)ES_TRACE; + ci->drivers.loglevel = (char)OPENSEARCH_TRACE; break; case IDS_LOGTYPE_ALL: - ci->drivers.loglevel = (char)ES_ALL; + ci->drivers.loglevel = (char)OPENSEARCH_ALL; break; default: - ci->drivers.loglevel = (char)ES_OFF; + ci->drivers.loglevel = (char)OPENSEARCH_OFF; break; } setGlobalCommlog(ci->drivers.loglevel); diff --git a/sql-odbc/src/odfesqlodbc/drvconn.c b/sql-odbc/src/odfesqlodbc/drvconn.c index b000845902..a2bc91d0d6 100644 --- a/sql-odbc/src/odfesqlodbc/drvconn.c +++ b/sql-odbc/src/odfesqlodbc/drvconn.c @@ -19,9 +19,9 @@ #include #include -#include "es_connection.h" -#include "es_odbc.h" +#include "opensearch_odbc.h" #include "misc.h" +#include "opensearch_connection.h" #ifndef WIN32 #include @@ -39,7 +39,7 @@ #include "win_setup.h" #endif #include "dlg_specific.h" -#include "es_apifunc.h" +#include "opensearch_apifunc.h" #ifdef WIN32 INT_PTR CALLBACK dconn_FDriverConnectProc(HWND hdlg, UINT wMsg, WPARAM wParam, @@ -83,7 +83,7 @@ RETCODE dconn_DoDialog(HWND hwnd, ConnInfo *ci) { INT_PTR dialog_result; - MYLOG(ES_TRACE, "entering ci = %p\n", ci); + MYLOG(OPENSEARCH_TRACE, "entering ci = %p\n", ci); if (hwnd) { dialog_result = @@ -91,7 +91,7 @@ dconn_DoDialog(HWND hwnd, ConnInfo *ci) { dconn_FDriverConnectProc, (LPARAM)ci); if (-1 == dialog_result) { int errc = GetLastError(); - MYLOG(ES_DEBUG, " LastError=%d\n", errc); + MYLOG(OPENSEARCH_DEBUG, " LastError=%d\n", errc); } if (!dialog_result || (dialog_result == -1)) return SQL_NO_DATA_FOUND; @@ -99,13 +99,13 @@ dconn_DoDialog(HWND hwnd, ConnInfo *ci) { return SQL_SUCCESS; } - MYLOG(ES_DEBUG, " No window specified\n"); + MYLOG(OPENSEARCH_DEBUG, " No window specified\n"); return SQL_ERROR; } INT_PTR CALLBACK dconn_FDriverConnectProc(HWND hdlg, UINT wMsg, WPARAM wParam, LPARAM lParam) { - MYLOG(ES_DEBUG, "dconn_FDriverConnectProc\n"); + MYLOG(OPENSEARCH_DEBUG, "dconn_FDriverConnectProc\n"); ConnInfo *ci; switch (wMsg) { @@ -113,7 +113,7 @@ INT_PTR CALLBACK dconn_FDriverConnectProc(HWND hdlg, UINT wMsg, WPARAM wParam, ci = (ConnInfo *)lParam; /* Change the caption for the setup dialog */ - SetWindowText(hdlg, "Elasticsearch Connection"); + SetWindowText(hdlg, "OpenSearch Connection"); /* Hide the DSN and description fields */ ShowWindow(GetDlgItem(hdlg, IDC_DSNAMETEXT), SW_HIDE); @@ -215,12 +215,12 @@ BOOL dconn_get_attributes(copyfunc func, const char *connect_string, strtok_arg = our_connect_string; #ifdef FORCE_PASSWORD_DISPLAY - MYLOG(ES_DEBUG, "our_connect_string = '%s'\n", our_connect_string); + MYLOG(OPENSEARCH_DEBUG, "our_connect_string = '%s'\n", our_connect_string); #else if (get_mylog()) { char *hide_str = hide_password(our_connect_string); - MYLOG(ES_DEBUG, "our_connect_string = '%s'\n", hide_str); + MYLOG(OPENSEARCH_DEBUG, "our_connect_string = '%s'\n", hide_str); free(hide_str); } #endif /* FORCE_PASSWORD_DISPLAY */ @@ -273,7 +273,7 @@ BOOL dconn_get_attributes(copyfunc func, const char *connect_string, if (NULL == closep) { if (!delp) /* error */ { - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "closing bracket doesn't exist 1\n"); ret = FALSE; goto cleanup; @@ -281,7 +281,7 @@ BOOL dconn_get_attributes(copyfunc func, const char *connect_string, closep = strchr(delp + 1, CLOSING_BRACKET); if (!closep) /* error */ { - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "closing bracket doesn't exist 2\n"); ret = FALSE; goto cleanup; @@ -307,7 +307,7 @@ BOOL dconn_get_attributes(copyfunc func, const char *connect_string, eoftok = TRUE; break; } - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "subsequent char to the closing bracket is %c " "value=%s\n", closep[1], value); diff --git a/sql-odbc/src/odfesqlodbc/drvconn.h b/sql-odbc/src/odfesqlodbc/drvconn.h index f85ebe6f59..9569b22c8e 100644 --- a/sql-odbc/src/odfesqlodbc/drvconn.h +++ b/sql-odbc/src/odfesqlodbc/drvconn.h @@ -20,9 +20,9 @@ #include #include -#include "es_connection.h" -#include "es_odbc.h" +#include "opensearch_odbc.h" #include "misc.h" +#include "opensearch_connection.h" #ifndef WIN32 #include @@ -39,7 +39,7 @@ #include "resource.h" #endif #include "dlg_specific.h" -#include "es_apifunc.h" +#include "opensearch_apifunc.h" #define PASSWORD_IS_REQUIRED 1 diff --git a/sql-odbc/src/odfesqlodbc/environ.c b/sql-odbc/src/odfesqlodbc/environ.c index f5e28df0d9..c9a2a8b114 100644 --- a/sql-odbc/src/odfesqlodbc/environ.c +++ b/sql-odbc/src/odfesqlodbc/environ.c @@ -20,9 +20,9 @@ #include #include "dlg_specific.h" -#include "es_apifunc.h" -#include "es_connection.h" #include "misc.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "statement.h" #ifdef WIN32 #include @@ -37,11 +37,11 @@ void *conns_cs = NULL; void *common_cs = NULL; void *common_lcs = NULL; -RETCODE SQL_API ESAPI_AllocEnv(HENV *phenv) { - CSTR func = "ESAPI_AllocEnv"; +RETCODE SQL_API OPENSEARCHAPI_AllocEnv(HENV *phenv) { + CSTR func = "OPENSEARCHAPI_AllocEnv"; SQLRETURN ret = SQL_SUCCESS; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); /* * For systems on which none of the constructor-making @@ -57,19 +57,19 @@ RETCODE SQL_API ESAPI_AllocEnv(HENV *phenv) { ret = SQL_ERROR; } - MYLOG(ES_TRACE, "leaving phenv=%p\n", *phenv); + MYLOG(OPENSEARCH_TRACE, "leaving phenv=%p\n", *phenv); return ret; } -RETCODE SQL_API ESAPI_FreeEnv(HENV henv) { - CSTR func = "ESAPI_FreeEnv"; +RETCODE SQL_API OPENSEARCHAPI_FreeEnv(HENV henv) { + CSTR func = "OPENSEARCHAPI_FreeEnv"; SQLRETURN ret = SQL_SUCCESS; EnvironmentClass *env = (EnvironmentClass *)henv; - MYLOG(ES_TRACE, "entering env=%p\n", env); + MYLOG(OPENSEARCH_TRACE, "entering env=%p\n", env); if (env && EN_Destructor(env)) { - MYLOG(ES_DEBUG, " ok\n"); + MYLOG(OPENSEARCH_DEBUG, " ok\n"); goto cleanup; } @@ -81,14 +81,14 @@ RETCODE SQL_API ESAPI_FreeEnv(HENV henv) { #define SIZEOF_SQLSTATE 6 -static void es_sqlstate_set(const EnvironmentClass *env, UCHAR *szSqlState, +static void opensearch_sqlstate_set(const EnvironmentClass *env, UCHAR *szSqlState, const char *ver3str, const char *ver2str) { strncpy_null((char *)szSqlState, EN_is_odbc3(env) ? ver3str : ver2str, SIZEOF_SQLSTATE); } -ES_ErrorInfo *ER_Constructor(SDWORD errnumber, const char *msg) { - ES_ErrorInfo *error; +OpenSearch_ErrorInfo *ER_Constructor(SDWORD errnumber, const char *msg) { + OpenSearch_ErrorInfo *error; ssize_t aladd, errsize; if (DESC_OK == errnumber) @@ -102,9 +102,9 @@ ES_ErrorInfo *ER_Constructor(SDWORD errnumber, const char *msg) { errsize = -1; aladd = 0; } - error = (ES_ErrorInfo *)malloc(sizeof(ES_ErrorInfo) + aladd); + error = (OpenSearch_ErrorInfo *)malloc(sizeof(OpenSearch_ErrorInfo) + aladd); if (error) { - memset(error, 0, sizeof(ES_ErrorInfo)); + memset(error, 0, sizeof(OpenSearch_ErrorInfo)); error->status = errnumber; error->errorsize = (Int2)errsize; if (errsize > 0) @@ -115,20 +115,20 @@ ES_ErrorInfo *ER_Constructor(SDWORD errnumber, const char *msg) { return error; } -void ER_Destructor(ES_ErrorInfo *self) { +void ER_Destructor(OpenSearch_ErrorInfo *self) { free(self); } -ES_ErrorInfo *ER_Dup(const ES_ErrorInfo *self) { - ES_ErrorInfo *new; +OpenSearch_ErrorInfo *ER_Dup(const OpenSearch_ErrorInfo *self) { + OpenSearch_ErrorInfo *new; Int4 alsize; if (!self) return NULL; - alsize = sizeof(ES_ErrorInfo); + alsize = sizeof(OpenSearch_ErrorInfo); if (self->errorsize > 0) alsize += self->errorsize; - new = (ES_ErrorInfo *)malloc(alsize); + new = (OpenSearch_ErrorInfo *)malloc(alsize); if (new) memcpy(new, self, alsize); @@ -137,21 +137,21 @@ ES_ErrorInfo *ER_Dup(const ES_ErrorInfo *self) { #define DRVMNGRDIV 511 /* Returns the next SQL error information. */ -RETCODE SQL_API ER_ReturnError(ES_ErrorInfo *eserror, SQLSMALLINT RecNumber, +RETCODE SQL_API ER_ReturnError(OpenSearch_ErrorInfo *openSearchError, SQLSMALLINT RecNumber, SQLCHAR *szSqlState, SQLINTEGER *pfNativeError, SQLCHAR *szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT *pcbErrorMsg, UWORD flag) { /* CC: return an error of a hstmt */ - ES_ErrorInfo *error; + OpenSearch_ErrorInfo *error; BOOL partial_ok = ((flag & PODBC_ALLOW_PARTIAL_EXTRACT) != 0); const char *msg; SWORD msglen, stapos, wrtlen, pcblen; - if (!eserror) + if (!openSearchError) return SQL_NO_DATA_FOUND; - error = eserror; + error = openSearchError; msg = error->__error_message; - MYLOG(ES_TRACE, "entering status = %d, msg = #%s#\n", error->status, msg); + MYLOG(OPENSEARCH_TRACE, "entering status = %d, msg = #%s#\n", error->status, msg); msglen = (SQLSMALLINT)strlen(msg); /* * Even though an application specifies a larger error message @@ -203,7 +203,7 @@ RETCODE SQL_API ER_ReturnError(ES_ErrorInfo *eserror, SQLSMALLINT RecNumber, if (NULL != szSqlState) strncpy_null((char *)szSqlState, error->sqlstate, 6); - MYLOG(ES_DEBUG, " szSqlState = '%s',len=%d, szError='%s'\n", + MYLOG(OPENSEARCH_DEBUG, " szSqlState = '%s',len=%d, szError='%s'\n", szSqlState, pcblen, szErrorMsg); if (wrtlen < pcblen) return SQL_SUCCESS_WITH_INFO; @@ -211,7 +211,7 @@ RETCODE SQL_API ER_ReturnError(ES_ErrorInfo *eserror, SQLSMALLINT RecNumber, return SQL_SUCCESS; } -RETCODE SQL_API ESAPI_ConnectError(HDBC hdbc, SQLSMALLINT RecNumber, +RETCODE SQL_API OPENSEARCHAPI_ConnectError(HDBC hdbc, SQLSMALLINT RecNumber, SQLCHAR *szSqlState, SQLINTEGER *pfNativeError, SQLCHAR *szErrorMsg, @@ -225,14 +225,14 @@ RETCODE SQL_API ESAPI_ConnectError(HDBC hdbc, SQLSMALLINT RecNumber, BOOL once_again = FALSE; ssize_t msglen; - MYLOG(ES_ERROR, "entering hdbc=%p <%d>\n", hdbc, cbErrorMsgMax); + MYLOG(OPENSEARCH_ERROR, "entering hdbc=%p <%d>\n", hdbc, cbErrorMsgMax); if (RecNumber != 1 && RecNumber != -1) return SQL_NO_DATA_FOUND; if (cbErrorMsgMax < 0) return SQL_ERROR; if (CONN_EXECUTING == conn->status || !CC_get_error(conn, &status, &msg) || NULL == msg) { - MYLOG(ES_ERROR, "CC_Get_error returned nothing.\n"); + MYLOG(OPENSEARCH_ERROR, "CC_Get_error returned nothing.\n"); if (NULL != szSqlState) strncpy_null((char *)szSqlState, "00000", SIZEOF_SQLSTATE); if (NULL != pcbErrorMsg) @@ -242,7 +242,7 @@ RETCODE SQL_API ESAPI_ConnectError(HDBC hdbc, SQLSMALLINT RecNumber, return SQL_NO_DATA_FOUND; } - MYLOG(ES_ERROR, "CC_get_error: status = %d, msg = #%s#\n", status, msg); + MYLOG(OPENSEARCH_ERROR, "CC_get_error: status = %d, msg = #%s#\n", status, msg); msglen = strlen(msg); if (NULL != pcbErrorMsg) { @@ -263,70 +263,70 @@ RETCODE SQL_API ESAPI_ConnectError(HDBC hdbc, SQLSMALLINT RecNumber, else switch (status) { case CONN_OPTION_VALUE_CHANGED: - es_sqlstate_set(env, szSqlState, "01S02", "01S02"); + opensearch_sqlstate_set(env, szSqlState, "01S02", "01S02"); break; case CONN_TRUNCATED: - es_sqlstate_set(env, szSqlState, "01004", "01004"); + opensearch_sqlstate_set(env, szSqlState, "01004", "01004"); /* data truncated */ break; case CONN_INIREAD_ERROR: - es_sqlstate_set(env, szSqlState, "IM002", "IM002"); + opensearch_sqlstate_set(env, szSqlState, "IM002", "IM002"); /* data source not found */ break; case CONNECTION_SERVER_NOT_REACHED: case CONN_OPENDB_ERROR: - es_sqlstate_set(env, szSqlState, "08001", "08001"); + opensearch_sqlstate_set(env, szSqlState, "08001", "08001"); /* unable to connect to data source */ break; case CONN_INVALID_AUTHENTICATION: case CONN_AUTH_TYPE_UNSUPPORTED: - es_sqlstate_set(env, szSqlState, "28000", "28000"); + opensearch_sqlstate_set(env, szSqlState, "28000", "28000"); break; case CONN_STMT_ALLOC_ERROR: - es_sqlstate_set(env, szSqlState, "HY001", "S1001"); + opensearch_sqlstate_set(env, szSqlState, "HY001", "S1001"); /* memory allocation failure */ break; case CONN_IN_USE: - es_sqlstate_set(env, szSqlState, "HY000", "S1000"); + opensearch_sqlstate_set(env, szSqlState, "HY000", "S1000"); /* general error */ break; case CONN_UNSUPPORTED_OPTION: - es_sqlstate_set(env, szSqlState, "HYC00", "IM001"); + opensearch_sqlstate_set(env, szSqlState, "HYC00", "IM001"); /* driver does not support this function */ break; case CONN_INVALID_ARGUMENT_NO: - es_sqlstate_set(env, szSqlState, "HY009", "S1009"); + opensearch_sqlstate_set(env, szSqlState, "HY009", "S1009"); /* invalid argument value */ break; case CONN_TRANSACT_IN_PROGRES: - es_sqlstate_set(env, szSqlState, "HY011", "S1011"); + opensearch_sqlstate_set(env, szSqlState, "HY011", "S1011"); break; case CONN_NO_MEMORY_ERROR: - es_sqlstate_set(env, szSqlState, "HY001", "S1001"); + opensearch_sqlstate_set(env, szSqlState, "HY001", "S1001"); break; case CONN_NOT_IMPLEMENTED_ERROR: - es_sqlstate_set(env, szSqlState, "HYC00", "S1C00"); + opensearch_sqlstate_set(env, szSqlState, "HYC00", "S1C00"); break; case CONN_ILLEGAL_TRANSACT_STATE: - es_sqlstate_set(env, szSqlState, "25000", "S1010"); + opensearch_sqlstate_set(env, szSqlState, "25000", "S1010"); break; case CONN_VALUE_OUT_OF_RANGE: - es_sqlstate_set(env, szSqlState, "HY019", "22003"); + opensearch_sqlstate_set(env, szSqlState, "HY019", "22003"); break; case CONNECTION_COULD_NOT_SEND: case CONNECTION_COULD_NOT_RECEIVE: case CONNECTION_COMMUNICATION_ERROR: case CONNECTION_NO_RESPONSE: - es_sqlstate_set(env, szSqlState, "08S01", "08S01"); + opensearch_sqlstate_set(env, szSqlState, "08S01", "08S01"); break; default: - es_sqlstate_set(env, szSqlState, "HY000", "S1000"); + opensearch_sqlstate_set(env, szSqlState, "HY000", "S1000"); /* general error */ break; } } - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, " szSqlState = '%s',len=" FORMAT_SSIZE_T ", szError='%s'\n", szSqlState ? (char *)szSqlState : PRINT_NULL, msglen, szErrorMsg ? (char *)szErrorMsg : PRINT_NULL); @@ -337,7 +337,7 @@ RETCODE SQL_API ESAPI_ConnectError(HDBC hdbc, SQLSMALLINT RecNumber, return SQL_SUCCESS; } -RETCODE SQL_API ESAPI_EnvError(HENV henv, SQLSMALLINT RecNumber, +RETCODE SQL_API OPENSEARCHAPI_EnvError(HENV henv, SQLSMALLINT RecNumber, SQLCHAR *szSqlState, SQLINTEGER *pfNativeError, SQLCHAR *szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT *pcbErrorMsg, UWORD flag) { @@ -346,16 +346,16 @@ RETCODE SQL_API ESAPI_EnvError(HENV henv, SQLSMALLINT RecNumber, char *msg = NULL; int status; - MYLOG(ES_ERROR, "entering henv=%p <%d>\n", henv, cbErrorMsgMax); + MYLOG(OPENSEARCH_ERROR, "entering henv=%p <%d>\n", henv, cbErrorMsgMax); if (RecNumber != 1 && RecNumber != -1) return SQL_NO_DATA_FOUND; if (cbErrorMsgMax < 0) return SQL_ERROR; if (!EN_get_error(env, &status, &msg) || NULL == msg) { - MYLOG(ES_ERROR, "EN_get_error: msg = #%s#\n", msg); + MYLOG(OPENSEARCH_ERROR, "EN_get_error: msg = #%s#\n", msg); if (NULL != szSqlState) - es_sqlstate_set(env, szSqlState, "00000", "00000"); + opensearch_sqlstate_set(env, szSqlState, "00000", "00000"); if (NULL != pcbErrorMsg) *pcbErrorMsg = 0; if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) @@ -363,7 +363,7 @@ RETCODE SQL_API ESAPI_EnvError(HENV henv, SQLSMALLINT RecNumber, return SQL_NO_DATA_FOUND; } - MYLOG(ES_ERROR, "EN_get_error: status = %d, msg = #%s#\n", status, msg); + MYLOG(OPENSEARCH_ERROR, "EN_get_error: status = %d, msg = #%s#\n", status, msg); if (NULL != pcbErrorMsg) *pcbErrorMsg = (SQLSMALLINT)strlen(msg); @@ -376,10 +376,10 @@ RETCODE SQL_API ESAPI_EnvError(HENV henv, SQLSMALLINT RecNumber, switch (status) { case ENV_ALLOC_ERROR: /* memory allocation failure */ - es_sqlstate_set(env, szSqlState, "HY001", "S1001"); + opensearch_sqlstate_set(env, szSqlState, "HY001", "S1001"); break; default: - es_sqlstate_set(env, szSqlState, "HY000", "S1000"); + opensearch_sqlstate_set(env, szSqlState, "HY000", "S1000"); /* general error */ break; } @@ -402,7 +402,7 @@ EnvironmentClass *EN_Constructor(void) { wVersionRequested = MAKEWORD(major, minor); if (WSAStartup(wVersionRequested, &wsaData)) { - MYLOG(ES_ERROR, " WSAStartup error\n"); + MYLOG(OPENSEARCH_ERROR, " WSAStartup error\n"); return rv; } /* Verify that this is the minimum version of WinSock */ @@ -410,7 +410,7 @@ EnvironmentClass *EN_Constructor(void) { && (LOBYTE(wsaData.wVersion) >= 2 || HIBYTE(wsaData.wVersion) >= 1)) ; else { - MYLOG(ES_DEBUG, " WSAStartup version=(%d,%d)\n", + MYLOG(OPENSEARCH_DEBUG, " WSAStartup version=(%d,%d)\n", LOBYTE(wsaData.wVersion), HIBYTE(wsaData.wVersion)); goto cleanup; } @@ -418,7 +418,7 @@ EnvironmentClass *EN_Constructor(void) { rv = (EnvironmentClass *)malloc(sizeof(EnvironmentClass)); if (NULL == rv) { - MYLOG(ES_ERROR, " malloc error\n"); + MYLOG(OPENSEARCH_ERROR, " malloc error\n"); goto cleanup; } rv->errormsg = 0; @@ -439,7 +439,7 @@ char EN_Destructor(EnvironmentClass *self) { int lf, nullcnt; char rv = 1; - MYLOG(ES_TRACE, "entering self=%p\n", self); + MYLOG(OPENSEARCH_TRACE, "entering self=%p\n", self); if (!self) return 0; @@ -462,7 +462,7 @@ char EN_Destructor(EnvironmentClass *self) { } } if (conns && nullcnt >= conns_count) { - MYLOG(ES_DEBUG, "clearing conns count=%d\n", conns_count); + MYLOG(OPENSEARCH_DEBUG, "clearing conns count=%d\n", conns_count); free(conns); conns = NULL; conns_count = 0; @@ -474,7 +474,7 @@ char EN_Destructor(EnvironmentClass *self) { #ifdef WIN32 WSACleanup(); #endif - MYLOG(ES_TRACE, "leaving rv=%d\n", rv); + MYLOG(OPENSEARCH_TRACE, "leaving rv=%d\n", rv); #ifdef _MEMORY_DEBUG_ debug_memory_check(); #endif /* _MEMORY_DEBUG_ */ @@ -499,7 +499,7 @@ char EN_add_connection(EnvironmentClass *self, ConnectionClass *conn) { ConnectionClass **newa; char ret = FALSE; - MYLOG(ES_TRACE, "entering self = %p, conn = %p\n", self, conn); + MYLOG(OPENSEARCH_TRACE, "entering self = %p, conn = %p\n", self, conn); ENTER_CONNS_CS; for (i = 0; i < conns_count; i++) { @@ -526,7 +526,7 @@ char EN_add_connection(EnvironmentClass *self, ConnectionClass *conn) { newa[conns_count] = conn; conns = newa; ret = TRUE; - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, " added at %d, conn->henv = %p, conns[%d]->henv = %p\n", conns_count, conn->henv, conns_count, conns[conns_count]->henv); for (i = conns_count + 1; i < alloc; i++) @@ -554,10 +554,10 @@ char EN_remove_connection(EnvironmentClass *self, ConnectionClass *conn) { void EN_log_error(const char *func, char *desc, EnvironmentClass *self) { if (self) - MYLOG(ES_ERROR, + MYLOG(OPENSEARCH_ERROR, "ENVIRON ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, self->errormsg); else - MYLOG(ES_ERROR, "INVALID ENVIRON HANDLE ERROR: func=%s, desc='%s'\n", + MYLOG(OPENSEARCH_ERROR, "INVALID ENVIRON HANDLE ERROR: func=%s, desc='%s'\n", func, desc); } diff --git a/sql-odbc/src/odfesqlodbc/environ.h b/sql-odbc/src/odfesqlodbc/environ.h index c4dc26a53d..202b6917fa 100644 --- a/sql-odbc/src/odfesqlodbc/environ.h +++ b/sql-odbc/src/odfesqlodbc/environ.h @@ -21,8 +21,8 @@ extern "C" { #endif -#include "es_helper.h" -#include "es_odbc.h" +#include "opensearch_helper.h" +#include "opensearch_odbc.h" #define ENV_ALLOC_ERROR 1 diff --git a/sql-odbc/src/odfesqlodbc/es_helper.h b/sql-odbc/src/odfesqlodbc/es_helper.h deleted file mode 100644 index 9aa05f9302..0000000000 --- a/sql-odbc/src/odfesqlodbc/es_helper.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright <2019> Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - * - */ - -#ifndef __ES_HELPER_H__ -#define __ES_HELPER_H__ - -#include "es_types.h" - -#ifdef __cplusplus -// C++ interface -std::string ESGetClientEncoding(void* es_conn); -bool ESSetClientEncoding(void* es_conn, std::string& encoding); -ESResult* ESGetResult(void* es_conn); -void ESClearResult(ESResult* es_result); -void* ESConnectDBParams(runtime_options& rt_opts, int expand_dbname, - unsigned int option_count); -std::string GetServerVersion(void* es_conn); -std::string GetClusterName(void* es_conn); -std::string GetErrorMsg(void* es_conn); -ConnErrorType GetErrorType(void* es_conn); -std::vector< std::string > ESGetColumnsWithSelectQuery( - void* es_conn, const std::string table_name); - -// C Interface -extern "C" { -#endif -void XPlatformInitializeCriticalSection(void** critical_section_helper); -void XPlatformEnterCriticalSection(void* critical_section_helper); -void XPlatformLeaveCriticalSection(void* critical_section_helper); -void XPlatformDeleteCriticalSection(void** critical_section_helper); -ConnStatusType ESStatus(void* es_conn); -int ESExecDirect(void* es_conn, const char* statement, const char* fetch_size); -void ESSendCursorQueries(void* es_conn, const char* cursor); -void ESDisconnect(void* es_conn); -void ESStopRetrieval(void* es_conn); -#ifdef __cplusplus -} -#endif - -void* InitializeESConn(); - -#endif // __ES_HELPER_H__ diff --git a/sql-odbc/src/odfesqlodbc/execute.c b/sql-odbc/src/odfesqlodbc/execute.c index 5d14b6dd65..3ccbeb1190 100644 --- a/sql-odbc/src/odfesqlodbc/execute.c +++ b/sql-odbc/src/odfesqlodbc/execute.c @@ -17,7 +17,7 @@ #include #include -#include "es_odbc.h" +#include "opensearch_odbc.h" #include "misc.h" #ifndef WIN32 @@ -27,14 +27,14 @@ #include "bind.h" #include "convert.h" #include "environ.h" -#include "es_apifunc.h" -#include "es_connection.h" -#include "es_statement.h" -#include "es_types.h" +#include "opensearch_types.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" +#include "opensearch_statement.h" #include "qresult.h" #include "statement.h" -RETCODE SQL_API ESAPI_Prepare(HSTMT hstmt, const SQLCHAR *stmt_str, +RETCODE SQL_API OPENSEARCHAPI_Prepare(HSTMT hstmt, const SQLCHAR *stmt_str, SQLINTEGER stmt_sz) { if (hstmt == NULL) return SQL_ERROR; @@ -55,7 +55,7 @@ RETCODE SQL_API ESAPI_Prepare(HSTMT hstmt, const SQLCHAR *stmt_str, return ret; } -RETCODE SQL_API ESAPI_Execute(HSTMT hstmt) { +RETCODE SQL_API OPENSEARCHAPI_Execute(HSTMT hstmt) { if (hstmt == NULL) return SQL_ERROR; @@ -85,7 +85,7 @@ RETCODE SQL_API ESAPI_Execute(HSTMT hstmt) { return ret; } -RETCODE SQL_API ESAPI_ExecDirect(HSTMT hstmt, const SQLCHAR *stmt_str, +RETCODE SQL_API OPENSEARCHAPI_ExecDirect(HSTMT hstmt, const SQLCHAR *stmt_str, SQLINTEGER stmt_sz, BOOL commit) { if (hstmt == NULL) return SQL_ERROR; @@ -109,16 +109,16 @@ RETCODE SQL_API ESAPI_ExecDirect(HSTMT hstmt, const SQLCHAR *stmt_str, * Currently, just copy the input string without modification * observing buffer limits and truncation. */ -RETCODE SQL_API ESAPI_NativeSql(HDBC hdbc, const SQLCHAR *szSqlStrIn, +RETCODE SQL_API OPENSEARCHAPI_NativeSql(HDBC hdbc, const SQLCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR *szSqlStr, SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr) { - CSTR func = "ESAPI_NativeSql"; + CSTR func = "OPENSEARCHAPI_NativeSql"; size_t len = 0; char *ptr; ConnectionClass *conn = (ConnectionClass *)hdbc; RETCODE result; - MYLOG(ES_TRACE, "entering...cbSqlStrIn=" FORMAT_INTEGER "\n", cbSqlStrIn); + MYLOG(OPENSEARCH_TRACE, "entering...cbSqlStrIn=" FORMAT_INTEGER "\n", cbSqlStrIn); ptr = (cbSqlStrIn == 0) ? "" : make_string(szSqlStrIn, cbSqlStrIn, NULL, 0); if (!ptr) { diff --git a/sql-odbc/src/odfesqlodbc/info.c b/sql-odbc/src/odfesqlodbc/info.c index 45e1bad0e3..2e0e73e2b9 100644 --- a/sql-odbc/src/odfesqlodbc/info.c +++ b/sql-odbc/src/odfesqlodbc/info.c @@ -14,29 +14,26 @@ * */ -#include "es_odbc.h" -#include "unicode_support.h" - #include #include +#include "opensearch_odbc.h" +#include "unicode_support.h" + #ifndef WIN32 #include #endif -#include "dlg_specific.h" -#include "es_types.h" -#include "tuple.h" - #include "bind.h" #include "catfunc.h" +#include "dlg_specific.h" #include "environ.h" -#include "es_apifunc.h" -#include "es_connection.h" -#include "es_info.h" -#include "es_types.h" +#include "opensearch_types.h" #include "misc.h" #include "multibyte.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" +#include "opensearch_info.h" #include "qresult.h" #include "statement.h" #include "tuple.h" @@ -47,10 +44,10 @@ #define TRIGGER_DELETE 0x01 #define TRIGGER_UPDATE 0x02 -RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, +RETCODE SQL_API OPENSEARCHAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, PTR rgbInfoValue, SQLSMALLINT cbInfoValueMax, SQLSMALLINT *pcbInfoValue) { - CSTR func = "ESAPI_GetInfo"; + CSTR func = "OPENSEARCHAPI_GetInfo"; ConnectionClass *conn = (ConnectionClass *)hdbc; ConnInfo *ci; const char *p = NULL; @@ -59,7 +56,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, RETCODE ret = SQL_ERROR; char odbcver[16]; - MYLOG(ES_TRACE, "entering...fInfoType=%d\n", fInfoType); + MYLOG(OPENSEARCH_TRACE, "entering...fInfoType=%d\n", fInfoType); if (!conn) { CC_log_error(func, NULL_STRING, NULL); @@ -148,7 +145,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, case SQL_CONVERT_FUNCTIONS: /* ODBC 1.0 */ len = sizeof(SQLUINTEGER); value = SQL_FN_CVT_CAST; - MYLOG(ES_DEBUG, "CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value); + MYLOG(OPENSEARCH_DEBUG, "CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value); break; case SQL_CORRELATION_NAME: /* ODBC 1.0 */ @@ -192,11 +189,11 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, break; case SQL_DBMS_NAME: /* ODBC 1.0 */ - p = "Elasticsearch"; + p = "OpenSearch"; break; case SQL_DBMS_VER: /* ODBC 1.0 */ - STRCPY_FIXED(tmp, conn->es_version); + STRCPY_FIXED(tmp, conn->opensearch_version); p = tmp; break; @@ -218,7 +215,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, break; case SQL_DRIVER_VER: /* ODBC 1.0 */ - p = ELASTICSEARCHDRIVERVERSION; + p = OPENSEARCHDRIVERVERSION; break; case SQL_EXPRESSIONS_IN_ORDERBY: /* ODBC 1.0 */ @@ -356,7 +353,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, case SQL_MAX_TABLE_NAME_LEN: /* ODBC 1.0 */ len = 2; - if (ES_VERSION_GT(conn, 7.4)) + if (OPENSEARCH_VERSION_GT(conn, 7.4)) value = CC_get_max_idlen(conn); #ifdef MAX_TABLE_LEN else @@ -453,7 +450,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, break; case SQL_OWNER_USAGE: /* ODBC 2.0 */ - // Elasticsearch does not support schemas. + // OpenSearch does not support schemas. // This will disable showing an empty schema box in Tableau. len = 4; value = 0; @@ -577,7 +574,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, case SQL_TXN_CAPABLE: /* ODBC 1.0 */ /* - * Elasticsearch does not support transactions. + * OpenSearch does not support transactions. */ len = 2; value = SQL_TC_NONE; @@ -861,13 +858,13 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, default: /* unrecognized key */ CC_set_error(conn, CONN_NOT_IMPLEMENTED_ERROR, - "Unrecognized key passed to ESAPI_GetInfo.", NULL); + "Unrecognized key passed to OPENSEARCHAPI_GetInfo.", NULL); goto cleanup; } ret = SQL_SUCCESS; - MYLOG(ES_DEBUG, "p='%s', len=" FORMAT_ULEN ", value=" FORMAT_ULEN ", cbMax=%d\n", + MYLOG(OPENSEARCH_DEBUG, "p='%s', len=" FORMAT_ULEN ", value=" FORMAT_ULEN ", cbMax=%d\n", p ? p : "", len, value, cbInfoValueMax); /* @@ -918,33 +915,36 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, } /* - * macros for estype_xxxx() calls which have ES_ATP_UNSET parameters + * macros for opensearchtype_xxxx() calls which have OPENSEARCH_ATP_UNSET parameters */ -#define ESTYPE_COLUMN_SIZE(conn, esType) \ - estype_attr_column_size(conn, esType, ES_ATP_UNSET, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) -#define ESTYPE_TO_CONCISE_TYPE(conn, esType) \ - estype_attr_to_concise_type(conn, esType, ES_ATP_UNSET, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) -#define ESTYPE_TO_SQLDESCTYPE(conn, esType) \ - estype_attr_to_sqldesctype(conn, esType, ES_ATP_UNSET, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) -#define ESTYPE_BUFFER_LENGTH(conn, esType) \ - estype_attr_buffer_length(conn, esType, ES_ATP_UNSET, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) -#define ESTYPE_DECIMAL_DIGITS(conn, esType) \ - estype_attr_decimal_digits(conn, esType, ES_ATP_UNSET, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) -#define ESTYPE_TRANSFER_OCTET_LENGTH(conn, esType) \ - estype_attr_transfer_octet_length(conn, esType, ES_ATP_UNSET, \ - ES_UNKNOWNS_UNSET) -#define ESTYPE_TO_NAME(conn, esType, auto_increment) \ - estype_attr_to_name(conn, esType, ES_ATP_UNSET, auto_increment) - -RETCODE SQL_API ESAPI_GetFunctions(HDBC hdbc, SQLUSMALLINT fFunction, +#define OPENSEARCHTYPE_COLUMN_SIZE(conn, openSearchType) \ + opensearchtype_attr_column_size(conn, openSearchType, OPENSEARCH_ATP_UNSET, \ + OPENSEARCH_ADT_UNSET, OPENSEARCH_UNKNOWNS_UNSET) +#define OPENSEARCHTYPE_TO_CONCISE_TYPE(conn, openSearchType) \ + opensearchtype_attr_to_concise_type(conn, openSearchType, OPENSEARCH_ATP_UNSET, \ + OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) +#define OPENSEARCHTYPE_TO_SQLDESCTYPE(conn, openSearchType) \ + opensearchtype_attr_to_sqldesctype(conn, openSearchType, OPENSEARCH_ATP_UNSET, \ + OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) +#define OPENSEARCHTYPE_BUFFER_LENGTH(conn, openSearchType) \ + opensearchtype_attr_buffer_length(conn, openSearchType, OPENSEARCH_ATP_UNSET, \ + OPENSEARCH_ADT_UNSET, OPENSEARCH_UNKNOWNS_UNSET) +#define OPENSEARCHTYPE_DECIMAL_DIGITS(conn, openSearchType) \ + opensearchtype_attr_decimal_digits(conn, openSearchType, OPENSEARCH_ATP_UNSET, \ + OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) +#define OPENSEARCHTYPE_TRANSFER_OCTET_LENGTH(conn, openSearchType) \ + opensearchtype_attr_transfer_octet_length(conn, openSearchType, OPENSEARCH_ATP_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) +#define OPENSEARCHTYPE_TO_NAME(conn, openSearchType, auto_increment) \ + opensearchtype_attr_to_name(conn, openSearchType, OPENSEARCH_ATP_UNSET, auto_increment) + +RETCODE SQL_API OPENSEARCHAPI_GetFunctions(HDBC hdbc, SQLUSMALLINT fFunction, SQLUSMALLINT *pfExists) { UNUSED(hdbc); - MYLOG(ES_TRACE, "entering...%u\n", fFunction); + MYLOG(OPENSEARCH_TRACE, "entering...%u\n", fFunction); if (fFunction == SQL_API_ALL_FUNCTIONS) { memset(pfExists, 0, sizeof(pfExists[0]) * 100); @@ -1199,7 +1199,7 @@ char *identifierEscape(const SQLCHAR *src, SQLLEN srclen, srclen = (SQLLEN)strlen((char *)src); if (srclen <= 0) return dest; - MYLOG(ES_TRACE, "entering in=%s(" FORMAT_LEN ")\n", src, srclen); + MYLOG(OPENSEARCH_TRACE, "entering in=%s(" FORMAT_LEN ")\n", src, srclen); if (NULL != buf && bufsize > 0) dest = buf; else { @@ -1228,7 +1228,7 @@ char *identifierEscape(const SQLCHAR *src, SQLLEN srclen, if (double_quote) dest[outlen++] = IDENTIFIER_QUOTE; dest[outlen] = '\0'; - MYLOG(ES_TRACE, "leaving output=%s(%d)\n", dest, (int)outlen); + MYLOG(OPENSEARCH_TRACE, "leaving output=%s(%d)\n", dest, (int)outlen); return dest; } @@ -1242,39 +1242,39 @@ char *identifierEscape(const SQLCHAR *src, SQLLEN srclen, #define TABLE_IN_RELKIND "('r', 'v', 'm', 'f', 'p')" /* - * macros for estype_attr_xxxx() calls which have - * ES_ADT_UNSET or ES_UNKNOWNS_UNSET parameters + * macros for opensearchtype_attr_xxxx() calls which have + * OPENSEARCH_ADT_UNSET or OPENSEARCH_UNKNOWNS_UNSET parameters */ -#define ESTYPE_ATTR_COLUMN_SIZE(conn, esType, atttypmod) \ - estype_attr_column_size(conn, esType, atttypmod, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) -#define ESTYPE_ATTR_TO_CONCISE_TYPE(conn, esType, atttypmod) \ - estype_attr_to_concise_type(conn, esType, atttypmod, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) -#define ESTYPE_ATTR_TO_SQLDESCTYPE(conn, esType, atttypmod) \ - estype_attr_to_sqldesctype(conn, esType, atttypmod, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) -#define ESTYPE_ATTR_DISPLAY_SIZE(conn, esType, atttypmod) \ - estype_attr_display_size(conn, esType, atttypmod, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) -#define ESTYPE_ATTR_BUFFER_LENGTH(conn, esType, atttypmod) \ - estype_attr_buffer_length(conn, esType, atttypmod, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) -#define ESTYPE_ATTR_DECIMAL_DIGITS(conn, esType, atttypmod) \ - estype_attr_decimal_digits(conn, esType, atttypmod, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) -#define ESTYPE_ATTR_TRANSFER_OCTET_LENGTH(conn, esType, atttypmod) \ - estype_attr_transfer_octet_length(conn, esType, atttypmod, \ - ES_UNKNOWNS_UNSET) - -RETCODE SQL_API ESAPI_SpecialColumns( +#define OPENSEARCHTYPE_ATTR_COLUMN_SIZE(conn, openSearchType, atttypmod) \ + opensearchtype_attr_column_size(conn, openSearchType, atttypmod, OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) +#define OPENSEARCHTYPE_ATTR_TO_CONCISE_TYPE(conn, openSearchType, atttypmod) \ + opensearchtype_attr_to_concise_type(conn, openSearchType, atttypmod, OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) +#define OPENSEARCHTYPE_ATTR_TO_SQLDESCTYPE(conn, openSearchType, atttypmod) \ + opensearchtype_attr_to_sqldesctype(conn, openSearchType, atttypmod, OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) +#define OPENSEARCHTYPE_ATTR_DISPLAY_SIZE(conn, openSearchType, atttypmod) \ + opensearchtype_attr_display_size(conn, openSearchType, atttypmod, OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) +#define OPENSEARCHTYPE_ATTR_BUFFER_LENGTH(conn, openSearchType, atttypmod) \ + opensearchtype_attr_buffer_length(conn, openSearchType, atttypmod, OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) +#define OPENSEARCHTYPE_ATTR_DECIMAL_DIGITS(conn, openSearchType, atttypmod) \ + opensearchtype_attr_decimal_digits(conn, openSearchType, atttypmod, OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) +#define OPENSEARCHTYPE_ATTR_TRANSFER_OCTET_LENGTH(conn, openSearchType, atttypmod) \ + opensearchtype_attr_transfer_octet_length(conn, openSearchType, atttypmod, \ + OPENSEARCH_UNKNOWNS_UNSET) + +RETCODE SQL_API OPENSEARCHAPI_SpecialColumns( HSTMT hstmt, SQLUSMALLINT fColType, const SQLCHAR *szTableQualifier, SQLSMALLINT cbTableQualifier, const SQLCHAR *szTableOwner, /* OA E*/ SQLSMALLINT cbTableOwner, const SQLCHAR *szTableName, /* OA(R) E*/ SQLSMALLINT cbTableName, SQLUSMALLINT fScope, SQLUSMALLINT fNullable) { UNUSED(fColType, szTableQualifier, cbTableQualifier, szTableOwner, cbTableOwner, szTableName, cbTableName, fScope, fNullable); - CSTR func = "ESAPI_SpecialColumns"; + CSTR func = "OPENSEARCHAPI_SpecialColumns"; // Initialize Statement StatementClass *stmt = (StatementClass *)hstmt; @@ -1287,7 +1287,7 @@ RETCODE SQL_API ESAPI_SpecialColumns( if (!res) { SC_set_error( stmt, STMT_NO_MEMORY_ERROR, - "Couldn't allocate memory for ESAPI_SpecialColumns result.", func); + "Couldn't allocate memory for OPENSEARCHAPI_SpecialColumns result.", func); return SQL_ERROR; } @@ -1301,20 +1301,23 @@ RETCODE SQL_API ESAPI_SpecialColumns( // Setup fields QR_set_num_fields(res, NUM_OF_SPECOLS_FIELDS); - QR_set_field_info_v(res, SPECOLS_SCOPE, "SCOPE", ES_TYPE_INT2, 2); + QR_set_field_info_v(res, SPECOLS_SCOPE, "SCOPE", OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, SPECOLS_COLUMN_NAME, "COLUMN_NAME", - ES_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, SPECOLS_DATA_TYPE, "DATA_TYPE", ES_TYPE_INT2, 2); - QR_set_field_info_v(res, SPECOLS_TYPE_NAME, "TYPE_NAME", ES_TYPE_VARCHAR, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); + QR_set_field_info_v(res, SPECOLS_DATA_TYPE, "DATA_TYPE", + OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, SPECOLS_TYPE_NAME, "TYPE_NAME", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, SPECOLS_COLUMN_SIZE, "COLUMN_SIZE", ES_TYPE_INT4, + QR_set_field_info_v(res, SPECOLS_COLUMN_SIZE, "COLUMN_SIZE", + OPENSEARCH_TYPE_INT4, 4); QR_set_field_info_v(res, SPECOLS_BUFFER_LENGTH, "BUFFER_LENGTH", - ES_TYPE_INT4, 4); + OPENSEARCH_TYPE_INT4, 4); QR_set_field_info_v(res, SPECOLS_DECIMAL_DIGITS, "DECIMAL_DIGITS", - ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, SPECOLS_PSEUDO_COLUMN, "PSEUDO_COLUMN", - ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_INT2, 2); // Set result to okay and adjust fields if keys exist QR_set_rstatus(res, PORES_FIELDS_OK); @@ -1332,14 +1335,14 @@ RETCODE SQL_API ESAPI_SpecialColumns( } #define INDOPTION_DESC 0x0001 /* values are in reverse order */ -RETCODE SQL_API ESAPI_Statistics( +RETCODE SQL_API OPENSEARCHAPI_Statistics( HSTMT hstmt, const SQLCHAR *szTableQualifier, /* OA X*/ SQLSMALLINT cbTableQualifier, const SQLCHAR *szTableOwner, /* OA E*/ SQLSMALLINT cbTableOwner, const SQLCHAR *szTableName, /* OA(R) E*/ SQLSMALLINT cbTableName, SQLUSMALLINT fUnique, SQLUSMALLINT fAccuracy) { UNUSED(szTableQualifier, cbTableQualifier, szTableOwner, cbTableOwner, szTableName, cbTableName, fUnique, fAccuracy); - CSTR func = "ESAPI_Statistics"; + CSTR func = "OPENSEARCHAPI_Statistics"; // Initialize Statement StatementClass *stmt = (StatementClass *)hstmt; @@ -1351,7 +1354,7 @@ RETCODE SQL_API ESAPI_Statistics( QResultClass *res = QR_Constructor(); if (!res) { SC_set_error(stmt, STMT_NO_MEMORY_ERROR, - "Couldn't allocate memory for ESAPI_Statistics result.", + "Couldn't allocate memory for OPENSEARCHAPI_Statistics result.", func); return SQL_ERROR; } @@ -1367,26 +1370,33 @@ RETCODE SQL_API ESAPI_Statistics( // Setup fields QR_set_num_fields(res, NUM_OF_STATS_FIELDS); QR_set_field_info_v(res, STATS_CATALOG_NAME, "TABLE_QUALIFIER", - ES_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, STATS_SCHEMA_NAME, "TABLE_OWNER", ES_TYPE_VARCHAR, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); + QR_set_field_info_v(res, STATS_SCHEMA_NAME, "TABLE_OWNER", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, STATS_TABLE_NAME, "TABLE_NAME", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, STATS_TABLE_NAME, "TABLE_NAME", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, STATS_NON_UNIQUE, "NON_UNIQUE", ES_TYPE_INT2, 2); + QR_set_field_info_v(res, STATS_NON_UNIQUE, "NON_UNIQUE", + OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, STATS_INDEX_QUALIFIER, "INDEX_QUALIFIER", - ES_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, STATS_INDEX_NAME, "INDEX_NAME", ES_TYPE_VARCHAR, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); + QR_set_field_info_v(res, STATS_INDEX_NAME, "INDEX_NAME", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, STATS_TYPE, "TYPE", ES_TYPE_INT2, 2); - QR_set_field_info_v(res, STATS_SEQ_IN_INDEX, "SEQ_IN_INDEX", ES_TYPE_INT2, + QR_set_field_info_v(res, STATS_TYPE, "TYPE", OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, STATS_SEQ_IN_INDEX, "SEQ_IN_INDEX", + OPENSEARCH_TYPE_INT2, 2); - QR_set_field_info_v(res, STATS_COLUMN_NAME, "COLUMN_NAME", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, STATS_COLUMN_NAME, "COLUMN_NAME", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, STATS_COLLATION, "COLLATION", ES_TYPE_CHAR, 1); - QR_set_field_info_v(res, STATS_CARDINALITY, "CARDINALITY", ES_TYPE_INT4, 4); - QR_set_field_info_v(res, STATS_PAGES, "PAGES", ES_TYPE_INT4, 4); + QR_set_field_info_v(res, STATS_COLLATION, "COLLATION", OPENSEARCH_TYPE_CHAR, 1); + QR_set_field_info_v(res, STATS_CARDINALITY, "CARDINALITY", + OPENSEARCH_TYPE_INT4, 4); + QR_set_field_info_v(res, STATS_PAGES, "PAGES", OPENSEARCH_TYPE_INT4, 4); QR_set_field_info_v(res, STATS_FILTER_CONDITION, "FILTER_CONDITION", - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); // Set result to okay and adjust fields if keys exist QR_set_rstatus(res, PORES_FIELDS_OK); @@ -1403,7 +1413,7 @@ RETCODE SQL_API ESAPI_Statistics( return SQL_SUCCESS; } -RETCODE SQL_API ESAPI_ColumnPrivileges( +RETCODE SQL_API OPENSEARCHAPI_ColumnPrivileges( HSTMT hstmt, const SQLCHAR *szTableQualifier, /* OA X*/ SQLSMALLINT cbTableQualifier, const SQLCHAR *szTableOwner, /* OA E*/ SQLSMALLINT cbTableOwner, const SQLCHAR *szTableName, /* OA(R) E*/ @@ -1411,7 +1421,7 @@ RETCODE SQL_API ESAPI_ColumnPrivileges( SQLSMALLINT cbColumnName, UWORD flag) { UNUSED(szTableQualifier, cbTableQualifier, szTableOwner, cbTableOwner, szTableName, cbTableName, szColumnName, cbColumnName, flag); - CSTR func = "ESAPI_ColumnPrivileges"; + CSTR func = "OPENSEARCHAPI_ColumnPrivileges"; // Initialize Statement StatementClass *stmt = (StatementClass *)hstmt; @@ -1424,7 +1434,7 @@ RETCODE SQL_API ESAPI_ColumnPrivileges( if (!res) { SC_set_error( stmt, STMT_NO_MEMORY_ERROR, - "Couldn't allocate memory for ESAPI_ColumnPrivileges result.", + "Couldn't allocate memory for OPENSEARCHAPI_ColumnPrivileges result.", func); return SQL_ERROR; } @@ -1439,22 +1449,27 @@ RETCODE SQL_API ESAPI_ColumnPrivileges( // Setup fields QR_set_num_fields(res, NUM_OF_COLPRIV_FIELDS); - QR_set_field_info_v(res, COLPRIV_TABLE_CAT, "TABLE_CAT", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, COLPRIV_TABLE_CAT, "TABLE_CAT", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, COLPRIV_TABLE_SCHEM, "TABLE_SCHEM", - ES_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, COLPRIV_TABLE_NAME, "TABLE_NAME", ES_TYPE_VARCHAR, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); + QR_set_field_info_v(res, COLPRIV_TABLE_NAME, "TABLE_NAME", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, COLPRIV_COLUMN_NAME, "COLUMN_NAME", - ES_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, COLPRIV_GRANTOR, "GRANTOR", ES_TYPE_VARCHAR, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); + QR_set_field_info_v(res, COLPRIV_GRANTOR, "GRANTOR", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, COLPRIV_GRANTEE, "GRANTEE", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, COLPRIV_GRANTEE, "GRANTEE", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, COLPRIV_PRIVILEGE, "PRIVILEGE", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, COLPRIV_PRIVILEGE, "PRIVILEGE", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, COLPRIV_IS_GRANTABLE, "IS_GRANTABLE", - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); // Set result to okay and adjust fields if keys exist QR_set_rstatus(res, PORES_FIELDS_OK); @@ -1476,7 +1491,7 @@ RETCODE SQL_API ESAPI_ColumnPrivileges( * * Retrieve the primary key columns for the specified table. */ -RETCODE SQL_API ESAPI_PrimaryKeys(HSTMT hstmt, +RETCODE SQL_API OPENSEARCHAPI_PrimaryKeys(HSTMT hstmt, const SQLCHAR *szTableQualifier, /* OA X*/ SQLSMALLINT cbTableQualifier, const SQLCHAR *szTableOwner, /* OA E*/ @@ -1485,7 +1500,7 @@ RETCODE SQL_API ESAPI_PrimaryKeys(HSTMT hstmt, SQLSMALLINT cbTableName, OID reloid) { UNUSED(szTableQualifier, cbTableQualifier, szTableOwner, cbTableOwner, szTableName, cbTableName, reloid); - CSTR func = "ESAPI_PrimaryKeys"; + CSTR func = "OPENSEARCHAPI_PrimaryKeys"; // Initialize Statement StatementClass *stmt = (StatementClass *)hstmt; @@ -1497,7 +1512,7 @@ RETCODE SQL_API ESAPI_PrimaryKeys(HSTMT hstmt, QResultClass *res = QR_Constructor(); if (res == NULL) { SC_set_error(stmt, STMT_NO_MEMORY_ERROR, - "Couldn't allocate memory for ESAPI_PrimaryKeys result.", + "Couldn't allocate memory for OPENSEARCHAPI_PrimaryKeys result.", func); return SQL_ERROR; } @@ -1512,16 +1527,20 @@ RETCODE SQL_API ESAPI_PrimaryKeys(HSTMT hstmt, // Setup fields QR_set_num_fields(res, NUM_OF_PKS_FIELDS); - QR_set_field_info_v(res, PKS_TABLE_CAT, "TABLE_QUALIFIER", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, PKS_TABLE_CAT, "TABLE_QUALIFIER", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, PKS_TABLE_SCHEM, "TABLE_OWNER", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, PKS_TABLE_SCHEM, "TABLE_OWNER", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, PKS_TABLE_NAME, "TABLE_NAME", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, PKS_TABLE_NAME, "TABLE_NAME", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, PKS_COLUMN_NAME, "COLUMN_NAME", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, PKS_COLUMN_NAME, "COLUMN_NAME", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, PKS_KEY_SQ, "KEY_SEQ", ES_TYPE_INT2, 2); - QR_set_field_info_v(res, PKS_PK_NAME, "PK_NAME", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, PKS_KEY_SQ, "KEY_SEQ", OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, PKS_PK_NAME, "PK_NAME", OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); // Set result to okay and adjust fields if keys exist @@ -1539,7 +1558,7 @@ RETCODE SQL_API ESAPI_PrimaryKeys(HSTMT hstmt, return ret; } -RETCODE SQL_API ESAPI_ForeignKeys( +RETCODE SQL_API OPENSEARCHAPI_ForeignKeys( HSTMT hstmt, const SQLCHAR *szPkTableQualifier, /* OA X*/ SQLSMALLINT cbPkTableQualifier, const SQLCHAR *szPkTableOwner, /* OA E*/ SQLSMALLINT cbPkTableOwner, const SQLCHAR *szPkTableName, /* OA(R) E*/ @@ -1551,7 +1570,7 @@ RETCODE SQL_API ESAPI_ForeignKeys( cbPkTableOwner, szPkTableName, cbPkTableName, szFkTableQualifier, cbFkTableQualifier, szFkTableOwner, cbFkTableOwner, szFkTableName, cbFkTableName); - CSTR func = "ESAPI_ForeignKeys"; + CSTR func = "OPENSEARCHAPI_ForeignKeys"; // Initialize Statement StatementClass *stmt = (StatementClass *)hstmt; @@ -1563,7 +1582,7 @@ RETCODE SQL_API ESAPI_ForeignKeys( QResultClass *res = QR_Constructor(); if (!res) { SC_set_error(stmt, STMT_NO_MEMORY_ERROR, - "Couldn't allocate memory for ESAPI_ForeignKeys result.", + "Couldn't allocate memory for OPENSEARCHAPI_ForeignKeys result.", func); return SQL_ERROR; } @@ -1579,31 +1598,37 @@ RETCODE SQL_API ESAPI_ForeignKeys( // Setup fields QR_set_num_fields(res, NUM_OF_FKS_FIELDS); QR_set_field_info_v(res, FKS_PKTABLE_CAT, "PKTABLE_QUALIFIER", - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, FKS_PKTABLE_SCHEM, "PKTABLE_OWNER", - ES_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, FKS_PKTABLE_NAME, "PKTABLE_NAME", ES_TYPE_VARCHAR, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); + QR_set_field_info_v(res, FKS_PKTABLE_NAME, "PKTABLE_NAME", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, FKS_PKCOLUMN_NAME, "PKCOLUMN_NAME", - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, FKS_FKTABLE_CAT, "FKTABLE_QUALIFIER", - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, FKS_FKTABLE_SCHEM, "FKTABLE_OWNER", - ES_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, FKS_FKTABLE_NAME, "FKTABLE_NAME", ES_TYPE_VARCHAR, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); + QR_set_field_info_v(res, FKS_FKTABLE_NAME, "FKTABLE_NAME", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, FKS_FKCOLUMN_NAME, "FKCOLUMN_NAME", - ES_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, FKS_KEY_SEQ, "KEY_SEQ", ES_TYPE_INT2, 2); - QR_set_field_info_v(res, FKS_UPDATE_RULE, "UPDATE_RULE", ES_TYPE_INT2, 2); - QR_set_field_info_v(res, FKS_DELETE_RULE, "DELETE_RULE", ES_TYPE_INT2, 2); - QR_set_field_info_v(res, FKS_FK_NAME, "FK_NAME", ES_TYPE_VARCHAR, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); + QR_set_field_info_v(res, FKS_KEY_SEQ, "KEY_SEQ", OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, FKS_UPDATE_RULE, "UPDATE_RULE", + OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, FKS_DELETE_RULE, "DELETE_RULE", + OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, FKS_FK_NAME, "FK_NAME", OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, FKS_PK_NAME, "PK_NAME", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, FKS_PK_NAME, "PK_NAME", OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, FKS_DEFERRABILITY, "DEFERRABILITY", ES_TYPE_INT2, + QR_set_field_info_v(res, FKS_DEFERRABILITY, "DEFERRABILITY", + OPENSEARCH_TYPE_INT2, 2); - QR_set_field_info_v(res, FKS_TRIGGER_NAME, "TRIGGER_NAME", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, FKS_TRIGGER_NAME, "TRIGGER_NAME", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); // Set result to okay and adjust fields if keys exist @@ -1624,7 +1649,7 @@ RETCODE SQL_API ESAPI_ForeignKeys( #define PRORET_COUNT #define DISPLAY_ARGNAME -RETCODE SQL_API ESAPI_ProcedureColumns( +RETCODE SQL_API OPENSEARCHAPI_ProcedureColumns( HSTMT hstmt, const SQLCHAR *szProcQualifier, /* OA X*/ SQLSMALLINT cbProcQualifier, const SQLCHAR *szProcOwner, /* PV E*/ SQLSMALLINT cbProcOwner, const SQLCHAR *szProcName, /* PV E*/ @@ -1632,7 +1657,7 @@ RETCODE SQL_API ESAPI_ProcedureColumns( SQLSMALLINT cbColumnName, UWORD flag) { UNUSED(szProcQualifier, cbProcQualifier, szProcOwner, cbProcOwner, szProcName, cbProcName, szColumnName, cbColumnName, flag); - CSTR func = "ESAPI_ProcedureColumns"; + CSTR func = "OPENSEARCHAPI_ProcedureColumns"; // Initialize Statement StatementClass *stmt = (StatementClass *)hstmt; @@ -1645,7 +1670,7 @@ RETCODE SQL_API ESAPI_ProcedureColumns( if (res == NULL) { SC_set_error( stmt, STMT_NO_MEMORY_ERROR, - "Couldn't allocate memory for ESAPI_ProcedureColumns result.", + "Couldn't allocate memory for OPENSEARCHAPI_ProcedureColumns result.", func); return SQL_ERROR; } @@ -1661,41 +1686,47 @@ RETCODE SQL_API ESAPI_ProcedureColumns( // Setup fields QR_set_num_fields(res, NUM_OF_PROCOLS_FIELDS); QR_set_field_info_v(res, PROCOLS_PROCEDURE_CAT, "PROCEDURE_CAT", - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, PROCOLS_PROCEDURE_SCHEM, "PROCEDUR_SCHEM", - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, PROCOLS_PROCEDURE_NAME, "PROCEDURE_NAME", - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, PROCOLS_COLUMN_NAME, "COLUMN_NAME", - ES_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, PROCOLS_COLUMN_TYPE, "COLUMN_TYPE", ES_TYPE_INT2, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); + QR_set_field_info_v(res, PROCOLS_COLUMN_TYPE, "COLUMN_TYPE", + OPENSEARCH_TYPE_INT2, 2); - QR_set_field_info_v(res, PROCOLS_DATA_TYPE, "DATA_TYPE", ES_TYPE_INT2, 2); - QR_set_field_info_v(res, PROCOLS_TYPE_NAME, "TYPE_NAME", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, PROCOLS_DATA_TYPE, "DATA_TYPE", + OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, PROCOLS_TYPE_NAME, "TYPE_NAME", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, PROCOLS_COLUMN_SIZE, "COLUMN_SIZE", ES_TYPE_INT4, + QR_set_field_info_v(res, PROCOLS_COLUMN_SIZE, "COLUMN_SIZE", + OPENSEARCH_TYPE_INT4, 4); QR_set_field_info_v(res, PROCOLS_BUFFER_LENGTH, "BUFFER_LENGTH", - ES_TYPE_INT4, 4); + OPENSEARCH_TYPE_INT4, 4); QR_set_field_info_v(res, PROCOLS_DECIMAL_DIGITS, "DECIMAL_DIGITS", - ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, PROCOLS_NUM_PREC_RADIX, "NUM_PREC_RADIX", - ES_TYPE_INT2, 2); - QR_set_field_info_v(res, PROCOLS_NULLABLE, "NULLABLE", ES_TYPE_INT2, 2); - QR_set_field_info_v(res, PROCOLS_REMARKS, "REMARKS", ES_TYPE_VARCHAR, + OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, PROCOLS_NULLABLE, "NULLABLE", OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, PROCOLS_REMARKS, "REMARKS", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, PROCOLS_COLUMN_DEF, "COLUMN_DEF", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, PROCOLS_COLUMN_DEF, "COLUMN_DEF", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, PROCOLS_SQL_DATA_TYPE, "SQL_DATA_TYPE", - ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, PROCOLS_SQL_DATETIME_SUB, "SQL_DATETIME_SUB", - ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, PROCOLS_CHAR_OCTET_LENGTH, "CHAR_OCTET_LENGTH", - ES_TYPE_INT4, 4); + OPENSEARCH_TYPE_INT4, 4); QR_set_field_info_v(res, PROCOLS_ORDINAL_POSITION, "ORDINAL_POSITION", - ES_TYPE_INT4, 4); + OPENSEARCH_TYPE_INT4, 4); QR_set_field_info_v(res, PROCOLS_IS_NULLABLE, "IS_NULLABLE", - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); // Set result to okay and adjust fields if keys exist QR_set_rstatus(res, PORES_FIELDS_OK); @@ -1712,7 +1743,7 @@ RETCODE SQL_API ESAPI_ProcedureColumns( return ret; } -RETCODE SQL_API ESAPI_Procedures(HSTMT hstmt, +RETCODE SQL_API OPENSEARCHAPI_Procedures(HSTMT hstmt, const SQLCHAR *szProcQualifier, /* OA X*/ SQLSMALLINT cbProcQualifier, const SQLCHAR *szProcOwner, /* PV E*/ @@ -1721,7 +1752,7 @@ RETCODE SQL_API ESAPI_Procedures(HSTMT hstmt, SQLSMALLINT cbProcName, UWORD flag) { UNUSED(szProcQualifier, cbProcQualifier, szProcOwner, cbProcOwner, szProcName, cbProcName, flag); - CSTR func = "ESAPI_Procedures"; + CSTR func = "OPENSEARCHAPI_Procedures"; // Initialize Statement StatementClass *stmt = (StatementClass *)hstmt; @@ -1733,7 +1764,7 @@ RETCODE SQL_API ESAPI_Procedures(HSTMT hstmt, QResultClass *res = QR_Constructor(); if (res == NULL) { SC_set_error(stmt, STMT_NO_MEMORY_ERROR, - "Couldn't allocate memory for ESAPI_Procedures result.", + "Couldn't allocate memory for OPENSEARCHAPI_Procedures result.", func); return SQL_ERROR; } @@ -1749,21 +1780,23 @@ RETCODE SQL_API ESAPI_Procedures(HSTMT hstmt, // Setup fields QR_set_num_fields(res, NUM_OF_PRO_FIELDS); QR_set_field_info_v(res, PRO_PROCEDURE_CAT, "PRO_PROCEDURE_CAT", - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, PRO_PROCEDURE_SCHEM, "PRO_PROCEDURE_SCHEM", - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, PRO_PROCEDURE_NAME, "PRO_PROCEDURE_NAME", - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, PRO_NUM_INPUT_PARAMS, "PRO_NUM_INPUT_PARAMS", - ES_TYPE_INT4, 4); + OPENSEARCH_TYPE_INT4, 4); QR_set_field_info_v(res, PRO_NUM_OUTPUT_PARAMS, "PRO_NUM_OUTPUT_PARAMS", - ES_TYPE_INT4, 4); - QR_set_field_info_v(res, PRO_RESULT_SETS, "PRO_RESULT_SETS", ES_TYPE_INT4, + OPENSEARCH_TYPE_INT4, 4); + QR_set_field_info_v(res, PRO_RESULT_SETS, "PRO_RESULT_SETS", + OPENSEARCH_TYPE_INT4, 4); - QR_set_field_info_v(res, PRO_REMARKS, "PRO_REMARKS", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, PRO_REMARKS, "PRO_REMARKS", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, PRO_PROCEDURE_TYPE, "PRO_PROCEDURE_TYPE", - ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_INT2, 2); // Set result to okay and adjust fields if keys exist QR_set_rstatus(res, PORES_FIELDS_OK); @@ -1783,7 +1816,7 @@ RETCODE SQL_API ESAPI_Procedures(HSTMT hstmt, #define ACLMAX 8 #define ALL_PRIVILIGES "arwdRxt" -RETCODE SQL_API ESAPI_TablePrivileges(HSTMT hstmt, +RETCODE SQL_API OPENSEARCHAPI_TablePrivileges(HSTMT hstmt, const SQLCHAR *szTableQualifier, /* OA X*/ SQLSMALLINT cbTableQualifier, const SQLCHAR *szTableOwner, /* PV E*/ @@ -1792,7 +1825,7 @@ RETCODE SQL_API ESAPI_TablePrivileges(HSTMT hstmt, SQLSMALLINT cbTableName, UWORD flag) { UNUSED(szTableQualifier, cbTableQualifier, szTableOwner, cbTableOwner, szTableName, cbTableName, flag); - CSTR func = "ESAPI_TablePrivileges"; + CSTR func = "OPENSEARCHAPI_TablePrivileges"; // Initialize Statement StatementClass *stmt = (StatementClass *)hstmt; @@ -1804,7 +1837,7 @@ RETCODE SQL_API ESAPI_TablePrivileges(HSTMT hstmt, QResultClass *res = QR_Constructor(); if (!res) { SC_set_error(stmt, STMT_NO_MEMORY_ERROR, - "Couldn't allocate memory for ESAPI_Statistics result.", + "Couldn't allocate memory for OPENSEARCHAPI_Statistics result.", func); return SQL_ERROR; } @@ -1819,20 +1852,25 @@ RETCODE SQL_API ESAPI_TablePrivileges(HSTMT hstmt, // Setup fields QR_set_num_fields(res, NUM_OF_TABPRIV_FIELDS); - QR_set_field_info_v(res, TABPRIV_TABLE_CAT, "TABLE_CAT", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, TABPRIV_TABLE_CAT, "TABLE_CAT", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, TABPRIV_TABLE_SCHEM, "TABLE_SCHEM", - ES_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, TABPRIV_TABLE_NAME, "TABLE_NAME", ES_TYPE_VARCHAR, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); + QR_set_field_info_v(res, TABPRIV_TABLE_NAME, "TABLE_NAME", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, TABPRIV_GRANTOR, "GRANTOR", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, TABPRIV_GRANTOR, "GRANTOR", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, TABPRIV_GRANTEE, "GRANTEE", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, TABPRIV_GRANTEE, "GRANTEE", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, TABPRIV_PRIVILEGE, "PRIVILEGE", ES_TYPE_VARCHAR, + QR_set_field_info_v(res, TABPRIV_PRIVILEGE, "PRIVILEGE", + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, TABPRIV_IS_GRANTABLE, "IS_GRANTABLE", - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); // Set result to okay and adjust fields if keys exist QR_set_rstatus(res, PORES_FIELDS_OK); diff --git a/sql-odbc/src/odfesqlodbc/loadlib.c b/sql-odbc/src/odfesqlodbc/loadlib.c index 628681aa9c..c7c0573ad8 100644 --- a/sql-odbc/src/odfesqlodbc/loadlib.c +++ b/sql-odbc/src/odfesqlodbc/loadlib.c @@ -21,7 +21,7 @@ #include #endif /* WIN32 */ -#include "elasticenlist.h" +#include "opensearch_enlist.h" #include "loadlib.h" #include "misc.h" @@ -30,18 +30,18 @@ #pragma comment(lib, "Delayimp") #ifdef _HANDLE_ENLIST_IN_DTC_ #ifdef UNICODE_SUPPORT -#pragma comment(lib, "elasticenlist") +#pragma comment(lib, "opensearch_enlist") #else -#pragma comment(lib, "elasticenlista") +#pragma comment(lib, "opensearch_enlista") #endif /* UNICODE_SUPPORT */ #endif /* _HANDLE_ENLIST_IN_DTC_ */ // The followings works under VC++6.0 but doesn't work under VC++7.0. // Please add the equivalent linker options using command line etc. #if (_MSC_VER == 1200) && defined(DYNAMIC_LOAD) // VC6.0 #ifdef UNICODE_SUPPORT -#pragma comment(linker, "/Delayload:elasticenlist.dll") +#pragma comment(linker, "/Delayload:opensearch_enlist.dll") #else -#pragma comment(linker, "/Delayload:elasticenlista.dll") +#pragma comment(linker, "/Delayload:opensearch_enlista.dll") #endif /* UNICODE_SUPPORT */ #pragma comment(linker, "/Delay:UNLOAD") #endif /* _MSC_VER */ @@ -50,13 +50,13 @@ #if defined(DYNAMIC_LOAD) #define WIN_DYN_LOAD #ifdef UNICODE_SUPPORT -CSTR elasticenlist = "elasticenlist"; -CSTR elasticenlistdll = "elasticenlist.dll"; +CSTR opensearch_enlist = "opensearch_enlist"; +CSTR opensearch_enlistdll = "opensearch_enlist.dll"; CSTR elasticodbc = "odfesqlodbc35w"; CSTR elasticodbcdll = "odfesqlodbc35w.dll"; #else -CSTR elasticenlist = "elasticenlista"; -CSTR elasticenlistdll = "elasticenlista.dll"; +CSTR opensearch_enlist = "opensearch_enlista"; +CSTR opensearch_enlistdll = "opensearch_enlista.dll"; CSTR elasticodbc = "odfesqlodbc30a"; CSTR elasticodbcdll = "odfesqlodbc30a.dll"; #endif /* UNICODE_SUPPORT */ @@ -97,7 +97,7 @@ extern PfnDliHook __pfnDliNotifyHook2; #endif /* _MSC_DELAY_LOAD_IMPORT */ #if defined(_MSC_DELAY_LOAD_IMPORT) -static BOOL loaded_elasticenlist = FALSE; +static BOOL loaded_opensearch_enlist = FALSE; static HMODULE enlist_module = NULL; static BOOL loaded_elasticodbc = FALSE; /* @@ -117,7 +117,7 @@ HMODULE MODULE_load_from_elasticodbc_path(const char *module_name) { if (_strnicmp(szFileName, sysdir, strlen(sysdir)) != 0) { hmodule = LoadLibraryEx(szFileName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - MYLOG(ES_DEBUG, "elasticodbc path based %s loaded module=%p\n", + MYLOG(OPENSEARCH_DEBUG, "elasticodbc path based %s loaded module=%p\n", module_name, hmodule); } } @@ -128,7 +128,7 @@ static FARPROC WINAPI DliErrorHook(unsigned dliNotify, PDelayLoadInfo pdli) { HMODULE hmodule = NULL; const char *call_module = NULL; - MYLOG(ES_DEBUG, "Dli%sHook %s Notify=%d\n", + MYLOG(OPENSEARCH_DEBUG, "Dli%sHook %s Notify=%d\n", (dliFailLoadLib == dliNotify || dliFailGetProc == dliNotify) ? "Error" : "Notify", @@ -144,8 +144,8 @@ static FARPROC WINAPI DliErrorHook(unsigned dliNotify, PDelayLoadInfo pdli) { NULL == hmodule) hmodule = LoadLibrary(call_module); if (NULL != hmodule) { - if (elasticenlist == call_module) - loaded_elasticenlist = TRUE; + if (opensearch_enlist == call_module) + loaded_opensearch_enlist = TRUE; else if (elasticodbc == call_module) loaded_elasticodbc = TRUE; } @@ -155,7 +155,7 @@ static FARPROC WINAPI DliErrorHook(unsigned dliNotify, PDelayLoadInfo pdli) { return (FARPROC)hmodule; } -void AlreadyLoadedElasticsearchodbc(void) { +void AlreadyLoadedOpenSearchodbc(void) { loaded_elasticodbc = TRUE; } @@ -172,20 +172,20 @@ void CleanupDelayLoadedDLLs(void) { UnloadFunc func = __FUnloadDelayLoadedDLL2; #endif /* The dll names are case sensitive for the unload helper */ - if (loaded_elasticenlist) { + if (loaded_opensearch_enlist) { if (enlist_module != NULL) { - MYLOG(ES_DEBUG, "Freeing Library %s\n", elasticenlistdll); + MYLOG(OPENSEARCH_DEBUG, "Freeing Library %s\n", opensearch_enlistdll); FreeLibrary(enlist_module); } - MYLOG(ES_DEBUG, "%s unloading\n", elasticenlistdll); - success = (*func)(elasticenlistdll); - MYLOG(ES_DEBUG, "%s unloaded success=%d\n", elasticenlistdll, success); - loaded_elasticenlist = FALSE; + MYLOG(OPENSEARCH_DEBUG, "%s unloading\n", opensearch_enlistdll); + success = (*func)(opensearch_enlistdll); + MYLOG(OPENSEARCH_DEBUG, "%s unloaded success=%d\n", opensearch_enlistdll, success); + loaded_opensearch_enlist = FALSE; } if (loaded_elasticodbc) { - MYLOG(ES_DEBUG, "%s unloading\n", elasticodbcdll); + MYLOG(OPENSEARCH_DEBUG, "%s unloading\n", elasticodbcdll); success = (*func)(elasticodbcdll); - MYLOG(ES_DEBUG, "%s unloaded success=%d\n", elasticodbcdll, success); + MYLOG(OPENSEARCH_DEBUG, "%s unloaded success=%d\n", elasticodbcdll, success); loaded_elasticodbc = FALSE; } return; @@ -202,37 +202,37 @@ RETCODE CALL_EnlistInDtc(ConnectionClass *conn, void *pTra, int method) { BOOL loaded = TRUE; #if defined(_MSC_DELAY_LOAD_IMPORT) - if (!loaded_elasticenlist) { + if (!loaded_opensearch_enlist) { TRY_DLI_HOOK ret = EnlistInDtc(conn, pTra, method); } __except ((GetExceptionCode() & 0xffff) == ERROR_MOD_NOT_FOUND ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { - if (enlist_module = MODULE_load_from_elasticodbc_path(elasticenlist), + if (enlist_module = MODULE_load_from_elasticodbc_path(opensearch_enlist), NULL == enlist_module) loaded = FALSE; else ret = EnlistInDtc(conn, pTra, method); } if (loaded) - loaded_elasticenlist = TRUE; + loaded_opensearch_enlist = TRUE; RELEASE_NOTIFY_HOOK } else ret = EnlistInDtc(conn, pTra, method); #else ret = EnlistInDtc(conn, pTra, method); - loaded_elasticenlist = TRUE; + loaded_opensearch_enlist = TRUE; #endif /* _MSC_DELAY_LOAD_IMPORT */ return ret; } RETCODE CALL_DtcOnDisconnect(ConnectionClass *conn) { - if (loaded_elasticenlist) + if (loaded_opensearch_enlist) return DtcOnDisconnect(conn); return FALSE; } RETCODE CALL_IsolateDtcConn(ConnectionClass *conn, BOOL continueConnection) { - if (loaded_elasticenlist) + if (loaded_opensearch_enlist) return IsolateDtcConn(conn, continueConnection); return FALSE; } @@ -242,32 +242,32 @@ void *CALL_GetTransactionObject(HRESULT *hres) { BOOL loaded = TRUE; #if defined(_MSC_DELAY_LOAD_IMPORT) - if (!loaded_elasticenlist) { + if (!loaded_opensearch_enlist) { TRY_DLI_HOOK ret = GetTransactionObject(hres); } __except ((GetExceptionCode() & 0xffff) == ERROR_MOD_NOT_FOUND ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { - if (enlist_module = MODULE_load_from_elasticodbc_path(elasticenlist), + if (enlist_module = MODULE_load_from_elasticodbc_path(opensearch_enlist), NULL == enlist_module) loaded = FALSE; else ret = GetTransactionObject(hres); } if (loaded) - loaded_elasticenlist = TRUE; + loaded_opensearch_enlist = TRUE; RELEASE_NOTIFY_HOOK } else ret = GetTransactionObject(hres); #else ret = GetTransactionObject(hres); - loaded_elasticenlist = TRUE; + loaded_opensearch_enlist = TRUE; #endif /* _MSC_DELAY_LOAD_IMPORT */ return ret; } void CALL_ReleaseTransactionObject(void *pObj) { - if (loaded_elasticenlist) + if (loaded_opensearch_enlist) ReleaseTransactionObject(pObj); return; } diff --git a/sql-odbc/src/odfesqlodbc/loadlib.h b/sql-odbc/src/odfesqlodbc/loadlib.h index 718e78140f..b05fa92e1a 100644 --- a/sql-odbc/src/odfesqlodbc/loadlib.h +++ b/sql-odbc/src/odfesqlodbc/loadlib.h @@ -17,7 +17,7 @@ #ifndef __LOADLIB_H__ #define __LOADLIB_H__ -#include "es_odbc.h" +#include "opensearch_odbc.h" #ifdef HAVE_LIBLTDL #include #else @@ -42,7 +42,7 @@ void CALL_ReleaseTransactionObject(void *); void CleanupDelayLoadedDLLs(void); #ifdef WIN32 HMODULE MODULE_load_from_elasticodbc_path(const char *module_name); -void AlreadyLoadedElasticsearchodbc(void); +void AlreadyLoadedOpenSearchodbc(void); #endif /* WIN32 */ #ifdef __cplusplus diff --git a/sql-odbc/src/odfesqlodbc/misc.c b/sql-odbc/src/odfesqlodbc/misc.c index c6a8b606f2..a985330957 100644 --- a/sql-odbc/src/odfesqlodbc/misc.c +++ b/sql-odbc/src/odfesqlodbc/misc.c @@ -15,7 +15,7 @@ */ // clang-format off -#include "es_odbc.h" +#include "opensearch_odbc.h" #include "misc.h" #include @@ -104,7 +104,7 @@ char *make_string(const SQLCHAR *s, SQLINTEGER len, char *buf, size_t bufsize) { else if (SQL_NTS == len) length = strlen((char *)s); else { - MYLOG(ES_DEBUG, "invalid length=" FORMAT_INTEGER "\n", len); + MYLOG(OPENSEARCH_DEBUG, "invalid length=" FORMAT_INTEGER "\n", len); return NULL; } if (buf) { @@ -112,9 +112,9 @@ char *make_string(const SQLCHAR *s, SQLINTEGER len, char *buf, size_t bufsize) { return buf; } - MYLOG(ES_DEBUG, "malloc size=" FORMAT_SIZE_T "\n", length); + MYLOG(OPENSEARCH_DEBUG, "malloc size=" FORMAT_SIZE_T "\n", length); str = malloc(length + 1); - MYLOG(ES_DEBUG, "str=%p\n", str); + MYLOG(OPENSEARCH_DEBUG, "str=%p\n", str); if (!str) return NULL; diff --git a/sql-odbc/src/odfesqlodbc/misc.h b/sql-odbc/src/odfesqlodbc/misc.h index 62b7e7477a..d9bfa2d6ea 100644 --- a/sql-odbc/src/odfesqlodbc/misc.h +++ b/sql-odbc/src/odfesqlodbc/misc.h @@ -31,7 +31,7 @@ size_t strncpy_null(char *dst, const char *src, ssize_t len); size_t strlcat(char *, const char *, size_t); #endif /* HAVE_STRLCAT */ int snprintfcat(char *buf, size_t size, const char *format, ...) - __attribute__((format(ES_PRINTF_ATTRIBUTE, 3, 4))); + __attribute__((format(OPENSEARCH_PRINTF_ATTRIBUTE, 3, 4))); char *make_string(const SQLCHAR *s, SQLINTEGER len, char *buf, size_t bufsize); /* #define GET_SCHEMA_NAME(nspname) (stricmp(nspname, "public") ? nspname : diff --git a/sql-odbc/src/odfesqlodbc/multibyte.c b/sql-odbc/src/odfesqlodbc/multibyte.c index 9199f84a49..94620fba6b 100644 --- a/sql-odbc/src/odfesqlodbc/multibyte.c +++ b/sql-odbc/src/odfesqlodbc/multibyte.c @@ -14,14 +14,16 @@ * */ +#include "multibyte.h" + #include #include #include #include -#include "es_apifunc.h" -#include "es_connection.h" + #include "misc.h" -#include "multibyte.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" #ifndef WIN32 #include #endif @@ -29,12 +31,12 @@ #define TRUE 1 #endif -typedef struct ES_CS { +typedef struct OPENSEARCH_CS { char *name; int code; -} ES_CS; +} OPENSEARCH_CS; -static ES_CS CS_Table[] = { +static OPENSEARCH_CS CS_Table[] = { {"SQL_ASCII", SQL_ASCII}, {"EUC_JP", EUC_JP}, {"EUC_CN", EUC_CN}, @@ -81,11 +83,11 @@ static ES_CS CS_Table[] = { X 0213, since 8.3 */ {"OTHER", OTHER}}; -static ES_CS CS_Alias[] = {{"UNICODE", UTF8}, {"TCVN", WIN1258}, +static OPENSEARCH_CS CS_Alias[] = {{"UNICODE", UTF8}, {"TCVN", WIN1258}, {"ALT", WIN866}, {"WIN", WIN1251}, {"KOI8R", KOI8R}, {"OTHER", OTHER}}; -int es_CS_code(const char *characterset_string) { +int opensearch_CS_code(const char *characterset_string) { int i, c = -1; for (i = 0; CS_Table[i].code != OTHER; i++) { @@ -107,7 +109,7 @@ int es_CS_code(const char *characterset_string) { return (c); } -int es_mb_maxlen(int characterset_code) { +int opensearch_mb_maxlen(int characterset_code) { switch (characterset_code) { case UTF8: return 4; @@ -131,7 +133,7 @@ int es_mb_maxlen(int characterset_code) { } } -static int es_CS_stat(int stat, unsigned int character, int characterset_code) { +static int opensearch_CS_stat(int stat, unsigned int character, int characterset_code) { if (character == 0) stat = 0; switch (characterset_code) { @@ -356,7 +358,8 @@ int encoded_nextchar(encoded_str *encstr) { if (encstr->pos >= 0 && !encstr->encstr[encstr->pos]) return 0; chr = encstr->encstr[++encstr->pos]; - encstr->ccst = es_CS_stat(encstr->ccst, (unsigned int)chr, encstr->ccsc); + encstr->ccst = + opensearch_CS_stat(encstr->ccst, (unsigned int)chr, encstr->ccsc); return chr; } @@ -364,6 +367,7 @@ int encoded_byte_check(encoded_str *encstr, size_t abspos) { int chr; chr = encstr->encstr[encstr->pos = abspos]; - encstr->ccst = es_CS_stat(encstr->ccst, (unsigned int)chr, encstr->ccsc); + encstr->ccst = + opensearch_CS_stat(encstr->ccst, (unsigned int)chr, encstr->ccsc); return chr; } diff --git a/sql-odbc/src/odfesqlodbc/multibyte.h b/sql-odbc/src/odfesqlodbc/multibyte.h index c3251231a7..928fd1812b 100644 --- a/sql-odbc/src/odfesqlodbc/multibyte.h +++ b/sql-odbc/src/odfesqlodbc/multibyte.h @@ -22,7 +22,7 @@ * Multibyte library header * */ -#include "es_odbc.h" +#include "opensearch_odbc.h" #include "qresult.h" /* Elastic client encoding */ @@ -122,11 +122,11 @@ typedef struct { #ifdef __cplusplus extern "C" { #endif -int es_CS_code(const char *stat_string); +int opensearch_CS_code(const char *stat_string); int encoded_nextchar(encoded_str *encstr); int encoded_byte_check(encoded_str *encstr, size_t abspos); const char *derive_locale_encoding(const char *dbencoding); -int es_mb_maxlen(int characterset_code); +int opensearch_mb_maxlen(int characterset_code); #ifdef __cplusplus } #endif diff --git a/sql-odbc/src/odfesqlodbc/mylog.c b/sql-odbc/src/odfesqlodbc/mylog.c index ebd93bf81e..c49f77c05b 100644 --- a/sql-odbc/src/odfesqlodbc/mylog.c +++ b/sql-odbc/src/odfesqlodbc/mylog.c @@ -23,9 +23,9 @@ #include #include "dlg_specific.h" -#include "es_helper.h" -#include "es_odbc.h" +#include "opensearch_odbc.h" #include "misc.h" +#include "opensearch_helper.h" #ifndef WIN32 #include @@ -43,16 +43,16 @@ #ifdef WIN32 #define DIRSEPARATOR "\\" -#define ES_BINARY O_BINARY -#define ES_BINARY_R "rb" -#define ES_BINARY_W "wb" -#define ES_BINARY_A "ab" +#define OPENSEARCH_BINARY O_BINARY +#define OPENSEARCH_BINARY_R "rb" +#define OPENSEARCH_BINARY_W "wb" +#define OPENSEARCH_BINARY_A "ab" #else #define DIRSEPARATOR "/" -#define ES_BINARY 0 -#define ES_BINARY_R "r" -#define ES_BINARY_W "w" -#define ES_BINARY_A "a" +#define OPENSEARCH_BINARY 0 +#define OPENSEARCH_BINARY_R "r" +#define OPENSEARCH_BINARY_W "w" +#define OPENSEARCH_BINARY_A "a" #endif /* WIN32 */ static char *logdir = NULL; @@ -156,7 +156,7 @@ const char *GetExeProgramName() { static void *qlog_cs, *mylog_cs; -static int mylog_on = ES_WARNING, qlog_on = ES_WARNING; +static int mylog_on = OPENSEARCH_WARNING, qlog_on = OPENSEARCH_WARNING; #define INIT_QLOG_CS XPlatformInitializeCriticalSection(&qlog_cs) #define ENTER_QLOG_CS XPlatformEnterCriticalSection(qlog_cs) @@ -231,7 +231,7 @@ void logs_on_off(int cnopen, int mylog_onoff, int qlog_onoff) { else if (getGlobalCommlog() > 0) qlog_on = getGlobalCommlog(); LEAVE_QLOG_CS; - MYLOG(ES_DEBUG, "mylog_on=%d qlog_on=%d\n", mylog_on, qlog_on); + MYLOG(OPENSEARCH_DEBUG, "mylog_on=%d qlog_on=%d\n", mylog_on, qlog_on); } #ifdef WIN32 @@ -255,14 +255,14 @@ static void MLOG_open() { generate_filename(logdir ? logdir : MYLOGDIR, MYLOGFILE, filebuf, sizeof(filebuf)); - MLOGFP = fopen(filebuf, ES_BINARY_A); + MLOGFP = fopen(filebuf, OPENSEARCH_BINARY_A); if (!MLOGFP) { int lasterror = GENERAL_ERRNO; open_error = TRUE; SPRINTF_FIXED(errbuf, "%s open error %d\n", filebuf, lasterror); generate_homefile(MYLOGFILE, filebuf, sizeof(filebuf)); - MLOGFP = fopen(filebuf, ES_BINARY_A); + MLOGFP = fopen(filebuf, OPENSEARCH_BINARY_A); } if (MLOGFP) { if (open_error) @@ -370,10 +370,10 @@ static int qlog_misc(unsigned int option, const char *fmt, va_list args) { if (!QLOGFP) { generate_filename(logdir ? logdir : QLOGDIR, QLOGFILE, filebuf, sizeof(filebuf)); - QLOGFP = fopen(filebuf, ES_BINARY_A); + QLOGFP = fopen(filebuf, OPENSEARCH_BINARY_A); if (!QLOGFP) { generate_homefile(QLOGFILE, filebuf, sizeof(filebuf)); - QLOGFP = fopen(filebuf, ES_BINARY_A); + QLOGFP = fopen(filebuf, OPENSEARCH_BINARY_A); } if (!QLOGFP) qlog_on = 0; @@ -488,7 +488,7 @@ void logInstallerError(int ret, const char *dir) { msg[0] = '\0'; ret = SQLInstallerError(1, &err, msg, sizeof(msg), NULL); if (msg[0] != '\0') - MYLOG(ES_DEBUG, "Dir= %s ErrorMsg = %s\n", dir, msg); + MYLOG(OPENSEARCH_DEBUG, "Dir= %s ErrorMsg = %s\n", dir, msg); } int getLogDir(char *dir, int dirmax) { @@ -530,7 +530,7 @@ void InitializeLogging(void) { mylog_initialize(); qlog_initialize(); start_logging(); - MYLOG(ES_DEBUG, "Log Output Dir: %s\n", logdir); + MYLOG(OPENSEARCH_DEBUG, "Log Output Dir: %s\n", logdir); } void FinalizeLogging(void) { diff --git a/sql-odbc/src/odfesqlodbc/mylog.h b/sql-odbc/src/odfesqlodbc/mylog.h index cb1f13c63c..10de23e96e 100644 --- a/sql-odbc/src/odfesqlodbc/mylog.h +++ b/sql-odbc/src/odfesqlodbc/mylog.h @@ -46,14 +46,14 @@ extern "C" { #endif DLL_DECLARE int mylog(const char *fmt, ...) - __attribute__((format(ES_PRINTF_ATTRIBUTE, 1, 2))); + __attribute__((format(OPENSEARCH_PRINTF_ATTRIBUTE, 1, 2))); DLL_DECLARE int myprintf(const char *fmt, ...) - __attribute__((format(ES_PRINTF_ATTRIBUTE, 1, 2))); + __attribute__((format(OPENSEARCH_PRINTF_ATTRIBUTE, 1, 2))); extern int qlog(const char *fmt, ...) - __attribute__((format(ES_PRINTF_ATTRIBUTE, 1, 2))); + __attribute__((format(OPENSEARCH_PRINTF_ATTRIBUTE, 1, 2))); extern int qprintf(char *fmt, ...) - __attribute__((format(ES_PRINTF_ATTRIBUTE, 1, 2))); + __attribute__((format(OPENSEARCH_PRINTF_ATTRIBUTE, 1, 2))); const char *po_basename(const char *path); @@ -125,17 +125,17 @@ const char *po_basename(const char *path); } while (0) #endif /* __GNUC__ */ -enum ESLogLevel { - // Prefixing with ES_ because C does not support namespaces and we may get a +enum OpenSearchLogLevel { + // Prefixing with OPENSEARCH_ because C does not support namespaces and we may get a // collision, given how common these names are - ES_OFF, - ES_FATAL, - ES_ERROR, - ES_WARNING, - ES_INFO, - ES_DEBUG, - ES_TRACE, - ES_ALL + OPENSEARCH_OFF, + OPENSEARCH_FATAL, + OPENSEARCH_ERROR, + OPENSEARCH_WARNING, + OPENSEARCH_INFO, + OPENSEARCH_DEBUG, + OPENSEARCH_TRACE, + OPENSEARCH_ALL }; int get_qlog(void); diff --git a/sql-odbc/src/odfesqlodbc/odbcapi.c b/sql-odbc/src/odfesqlodbc/odbcapi.c index cdbf714719..6fee977511 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi.c @@ -18,14 +18,14 @@ #include #include "environ.h" -#include "es_apifunc.h" -#include "es_connection.h" -#include "es_driver_connect.h" -#include "es_info.h" -#include "es_odbc.h" -#include "es_statement.h" +#include "opensearch_odbc.h" #include "loadlib.h" #include "misc.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" +#include "opensearch_driver_connect.h" +#include "opensearch_info.h" +#include "opensearch_statement.h" #include "qresult.h" #include "statement.h" @@ -33,7 +33,7 @@ BOOL SC_connection_lost_check(StatementClass *stmt, const char *funcname) { ConnectionClass *conn = SC_get_conn(stmt); char message[64]; - if (NULL != conn->esconn) + if (NULL != conn->opensearchconn) return FALSE; SC_clear_error(stmt); SPRINTF_FIXED(message, "%s unable due to the connection lost", funcname); @@ -47,23 +47,23 @@ RETCODE SQL_API SQLBindCol(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, RETCODE ret; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_BindCol(StatementHandle, ColumnNumber, TargetType, TargetValue, + ret = OPENSEARCHAPI_BindCol(StatementHandle, ColumnNumber, TargetType, TargetValue, BufferLength, StrLen_or_Ind); LEAVE_STMT_CS(stmt); return ret; } RETCODE SQL_API SQLCancel(HSTMT StatementHandle) { - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (!StatementHandle) return SQL_INVALID_HANDLE; if (SC_connection_lost_check((StatementClass *)StatementHandle, __FUNCTION__)) return SQL_ERROR; - return ESAPI_Cancel(StatementHandle); + return OPENSEARCHAPI_Cancel(StatementHandle); } static BOOL theResultIsEmpty(const StatementClass *stmt) { @@ -86,7 +86,7 @@ RETCODE SQL_API SQLColumns(HSTMT StatementHandle, SQLCHAR *CatalogName, *clName = ColumnName; UWORD flag = PODBC_SEARCH_PUBLIC_SCHEMA; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -97,7 +97,7 @@ RETCODE SQL_API SQLColumns(HSTMT StatementHandle, SQLCHAR *CatalogName, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_Columns(StatementHandle, ctName, NameLength1, scName, + ret = OPENSEARCHAPI_Columns(StatementHandle, ctName, NameLength1, scName, NameLength2, tbName, NameLength3, clName, NameLength4, flag, 0, 0); if (SQL_SUCCESS == ret && theResultIsEmpty(stmt)) { @@ -130,7 +130,7 @@ RETCODE SQL_API SQLColumns(HSTMT StatementHandle, SQLCHAR *CatalogName, reexec = TRUE; } if (reexec) { - ret = ESAPI_Columns(StatementHandle, ctName, NameLength1, scName, + ret = OPENSEARCHAPI_Columns(StatementHandle, ctName, NameLength1, scName, NameLength2, tbName, NameLength3, clName, NameLength4, flag, 0, 0); if (newCt) @@ -154,10 +154,10 @@ RETCODE SQL_API SQLConnect(HDBC ConnectionHandle, SQLCHAR *ServerName, RETCODE ret; ConnectionClass *conn = (ConnectionClass *)ConnectionHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_CONN_CS(conn); CC_clear_error(conn); - ret = ESAPI_Connect(ConnectionHandle, ServerName, NameLength1, UserName, + ret = OPENSEARCHAPI_Connect(ConnectionHandle, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3); LEAVE_CONN_CS(conn); return ret; @@ -171,11 +171,11 @@ RETCODE SQL_API SQLDriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *szConnStrIn, RETCODE ret; ConnectionClass *conn = (ConnectionClass *)hdbc; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_CONN_CS(conn); CC_clear_error(conn); ret = - ESAPI_DriverConnect(hdbc, hwnd, szConnStrIn, cbConnStrIn, szConnStrOut, + OPENSEARCHAPI_DriverConnect(hdbc, hwnd, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut, fDriverCompletion); LEAVE_CONN_CS(conn); return ret; @@ -187,10 +187,10 @@ RETCODE SQL_API SQLBrowseConnect(HDBC hdbc, SQLCHAR *szConnStrIn, RETCODE ret; ConnectionClass *conn = (ConnectionClass *)hdbc; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_CONN_CS(conn); CC_clear_error(conn); - ret = ESAPI_BrowseConnect(hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, + ret = OPENSEARCHAPI_BrowseConnect(hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut); LEAVE_CONN_CS(conn); return ret; @@ -203,7 +203,7 @@ RETCODE SQL_API SQLDataSources(HENV EnvironmentHandle, SQLUSMALLINT Direction, SQLSMALLINT *NameLength2) { UNUSED(EnvironmentHandle, Direction, ServerName, BufferLength1, NameLength1, Description, BufferLength2, NameLength2); - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); return SQL_ERROR; } @@ -215,13 +215,13 @@ RETCODE SQL_API SQLDescribeCol(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, RETCODE ret; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_DescribeCol(StatementHandle, ColumnNumber, ColumnName, + ret = OPENSEARCHAPI_DescribeCol(StatementHandle, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable); LEAVE_STMT_CS(stmt); @@ -233,14 +233,14 @@ RETCODE SQL_API SQLDisconnect(HDBC ConnectionHandle) { RETCODE ret; ConnectionClass *conn = (ConnectionClass *)ConnectionHandle; - MYLOG(ES_TRACE, "entering for %p\n", ConnectionHandle); + MYLOG(OPENSEARCH_TRACE, "entering for %p\n", ConnectionHandle); #ifdef _HANDLE_ENLIST_IN_DTC_ if (CC_is_in_global_trans(conn)) CALL_DtcOnDisconnect(conn); #endif /* _HANDLE_ENLIST_IN_DTC_ */ ENTER_CONN_CS(conn); CC_clear_error(conn); - ret = ESAPI_Disconnect(ConnectionHandle); + ret = OPENSEARCHAPI_Disconnect(ConnectionHandle); LEAVE_CONN_CS(conn); return ret; } @@ -264,7 +264,7 @@ RETCODE SQL_API SQLExecDirect(HSTMT StatementHandle, SQLCHAR *StatementText, // Execute statement if statement is ready RETCODE ret = SQL_ERROR; if (!SC_opencheck(stmt, "SQLExecDirect")) - ret = ESAPI_ExecDirect(StatementHandle, StatementText, TextLength, 1); + ret = OPENSEARCHAPI_ExecDirect(StatementHandle, StatementText, TextLength, 1); // Exit critical LEAVE_STMT_CS(stmt); @@ -278,7 +278,7 @@ RETCODE SQL_API SQLExecute(HSTMT StatementHandle) { return SQL_ERROR; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -289,7 +289,7 @@ RETCODE SQL_API SQLExecute(HSTMT StatementHandle) { SC_clear_error(stmt); RETCODE ret = SQL_ERROR; if (!SC_opencheck(stmt, "SQLExecute")) - ret = ESAPI_Execute(StatementHandle); + ret = OPENSEARCHAPI_Execute(StatementHandle); // Exit critical LEAVE_STMT_CS(stmt); @@ -304,13 +304,13 @@ RETCODE SQL_API SQLFetch(HSTMT StatementHandle) { SQLUSMALLINT *rowStatusArray = irdopts->rowStatusArray; SQLULEN *pcRow = irdopts->rowsFetched; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_ExtendedFetch(StatementHandle, SQL_FETCH_NEXT, 0, pcRow, + ret = OPENSEARCHAPI_ExtendedFetch(StatementHandle, SQL_FETCH_NEXT, 0, pcRow, rowStatusArray, 0, ardopts->size_of_rowset); stmt->transition_status = STMT_TRANSITION_FETCH_SCROLL; @@ -323,7 +323,7 @@ RETCODE SQL_API SQLFreeStmt(HSTMT StatementHandle, SQLUSMALLINT Option) { StatementClass *stmt = (StatementClass *)StatementHandle; ConnectionClass *conn = NULL; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (stmt) { if (Option == SQL_DROP) { @@ -334,7 +334,7 @@ RETCODE SQL_API SQLFreeStmt(HSTMT StatementHandle, SQLUSMALLINT Option) { ENTER_STMT_CS(stmt); } - ret = ESAPI_FreeStmt(StatementHandle, Option); + ret = OPENSEARCHAPI_FreeStmt(StatementHandle, Option); if (stmt) { if (Option == SQL_DROP) { @@ -354,10 +354,10 @@ RETCODE SQL_API SQLGetCursorName(HSTMT StatementHandle, SQLCHAR *CursorName, RETCODE ret; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_GetCursorName(StatementHandle, CursorName, BufferLength, + ret = OPENSEARCHAPI_GetCursorName(StatementHandle, CursorName, BufferLength, NameLength); LEAVE_STMT_CS(stmt); return ret; @@ -370,13 +370,13 @@ RETCODE SQL_API SQLGetData(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, RETCODE ret; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_GetData(StatementHandle, ColumnNumber, TargetType, TargetValue, + ret = OPENSEARCHAPI_GetData(StatementHandle, ColumnNumber, TargetType, TargetValue, BufferLength, StrLen_or_Ind); LEAVE_STMT_CS(stmt); return ret; @@ -387,13 +387,13 @@ RETCODE SQL_API SQLGetFunctions(HDBC ConnectionHandle, SQLUSMALLINT FunctionId, RETCODE ret; ConnectionClass *conn = (ConnectionClass *)ConnectionHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_CONN_CS(conn); CC_clear_error(conn); if (FunctionId == SQL_API_ODBC3_ALL_FUNCTIONS) - ret = ESAPI_GetFunctions30(ConnectionHandle, FunctionId, Supported); + ret = OPENSEARCHAPI_GetFunctions30(ConnectionHandle, FunctionId, Supported); else - ret = ESAPI_GetFunctions(ConnectionHandle, FunctionId, Supported); + ret = OPENSEARCHAPI_GetFunctions(ConnectionHandle, FunctionId, Supported); LEAVE_CONN_CS(conn); return ret; @@ -408,8 +408,8 @@ RETCODE SQL_API SQLGetInfo(HDBC ConnectionHandle, SQLUSMALLINT InfoType, ENTER_CONN_CS(conn); CC_clear_error(conn); - MYLOG(ES_TRACE, "entering\n"); - if ((ret = ESAPI_GetInfo(ConnectionHandle, InfoType, InfoValue, + MYLOG(OPENSEARCH_TRACE, "entering\n"); + if ((ret = OPENSEARCHAPI_GetInfo(ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength)) == SQL_ERROR) CC_log_error("SQLGetInfo(30)", "", conn); @@ -422,7 +422,7 @@ RETCODE SQL_API SQLGetTypeInfo(HSTMT StatementHandle, SQLSMALLINT DataType) { RETCODE ret; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check((StatementClass *)StatementHandle, __FUNCTION__)) return SQL_ERROR; @@ -432,7 +432,7 @@ RETCODE SQL_API SQLGetTypeInfo(HSTMT StatementHandle, SQLSMALLINT DataType) { if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_GetTypeInfo(StatementHandle, DataType); + ret = OPENSEARCHAPI_GetTypeInfo(StatementHandle, DataType); LEAVE_STMT_CS(stmt); return ret; } @@ -443,13 +443,13 @@ RETCODE SQL_API SQLNumResultCols(HSTMT StatementHandle, RETCODE ret; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_NumResultCols(StatementHandle, ColumnCount); + ret = OPENSEARCHAPI_NumResultCols(StatementHandle, ColumnCount); LEAVE_STMT_CS(stmt); return ret; } @@ -461,7 +461,7 @@ RETCODE SQL_API SQLParamData(HSTMT StatementHandle, PTR *Value) { return SQL_ERROR; SC_clear_error(stmt); SC_set_error(stmt, STMT_NOT_IMPLEMENTED_ERROR, - "Elasticsearch does not support parameters.", "SQLParamData"); + "OpenSearch does not support parameters.", "SQLParamData"); return SQL_ERROR; } @@ -474,7 +474,7 @@ RETCODE SQL_API SQLPrepare(HSTMT StatementHandle, SQLCHAR *StatementText, CSTR func = "SQLPrepare"; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -487,7 +487,7 @@ RETCODE SQL_API SQLPrepare(HSTMT StatementHandle, SQLCHAR *StatementText, // Prepare statement if statement is ready RETCODE ret = SQL_ERROR; if (!SC_opencheck(stmt, func)) - ret = ESAPI_Prepare(StatementHandle, StatementText, TextLength); + ret = OPENSEARCHAPI_Prepare(StatementHandle, StatementText, TextLength); // Exit critical LEAVE_STMT_CS(stmt); @@ -503,7 +503,7 @@ RETCODE SQL_API SQLPutData(HSTMT StatementHandle, PTR Data, return SQL_ERROR; SC_clear_error(stmt); SC_set_error(stmt, STMT_NOT_IMPLEMENTED_ERROR, - "Elasticsearch does not support parameters.", "SQLPutData"); + "OpenSearch does not support parameters.", "SQLPutData"); return SQL_ERROR; } @@ -511,13 +511,13 @@ RETCODE SQL_API SQLRowCount(HSTMT StatementHandle, SQLLEN *RowCount) { RETCODE ret; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_RowCount(StatementHandle, RowCount); + ret = OPENSEARCHAPI_RowCount(StatementHandle, RowCount); LEAVE_STMT_CS(stmt); return ret; } @@ -528,10 +528,10 @@ RETCODE SQL_API SQLSetCursorName(HSTMT StatementHandle, SQLCHAR *CursorName, RETCODE ret; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_SetCursorName(StatementHandle, CursorName, NameLength); + ret = OPENSEARCHAPI_SetCursorName(StatementHandle, CursorName, NameLength); LEAVE_STMT_CS(stmt); return ret; } @@ -548,7 +548,7 @@ RETCODE SQL_API SQLSetParam(HSTMT StatementHandle, SQLUSMALLINT ParameterNumber, return SQL_ERROR; SC_clear_error(stmt); SC_set_error(stmt, STMT_NOT_IMPLEMENTED_ERROR, - "Elasticsearch does not support parameters.", "SQLSetParam"); + "OpenSearch does not support parameters.", "SQLSetParam"); return SQL_ERROR; } @@ -564,7 +564,7 @@ RETCODE SQL_API SQLSpecialColumns(HSTMT StatementHandle, StatementClass *stmt = (StatementClass *)StatementHandle; SQLCHAR *ctName = CatalogName, *scName = SchemaName, *tbName = TableName; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -573,7 +573,7 @@ RETCODE SQL_API SQLSpecialColumns(HSTMT StatementHandle, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_SpecialColumns(StatementHandle, IdentifierType, ctName, + ret = OPENSEARCHAPI_SpecialColumns(StatementHandle, IdentifierType, ctName, NameLength1, scName, NameLength2, tbName, NameLength3, Scope, Nullable); if (SQL_SUCCESS == ret && theResultIsEmpty(stmt)) { @@ -600,7 +600,7 @@ RETCODE SQL_API SQLSpecialColumns(HSTMT StatementHandle, reexec = TRUE; } if (reexec) { - ret = ESAPI_SpecialColumns(StatementHandle, IdentifierType, ctName, + ret = OPENSEARCHAPI_SpecialColumns(StatementHandle, IdentifierType, ctName, NameLength1, scName, NameLength2, tbName, NameLength3, Scope, Nullable); if (newCt) @@ -625,7 +625,7 @@ RETCODE SQL_API SQLStatistics(HSTMT StatementHandle, SQLCHAR *CatalogName, StatementClass *stmt = (StatementClass *)StatementHandle; SQLCHAR *ctName = CatalogName, *scName = SchemaName, *tbName = TableName; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -634,7 +634,7 @@ RETCODE SQL_API SQLStatistics(HSTMT StatementHandle, SQLCHAR *CatalogName, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_Statistics(StatementHandle, ctName, NameLength1, scName, + ret = OPENSEARCHAPI_Statistics(StatementHandle, ctName, NameLength1, scName, NameLength2, tbName, NameLength3, Unique, Reserved); if (SQL_SUCCESS == ret && theResultIsEmpty(stmt)) { @@ -661,7 +661,7 @@ RETCODE SQL_API SQLStatistics(HSTMT StatementHandle, SQLCHAR *CatalogName, reexec = TRUE; } if (reexec) { - ret = ESAPI_Statistics(StatementHandle, ctName, NameLength1, scName, + ret = OPENSEARCHAPI_Statistics(StatementHandle, ctName, NameLength1, scName, NameLength2, tbName, NameLength3, Unique, Reserved); if (newCt) @@ -687,7 +687,7 @@ RETCODE SQL_API SQLTables(HSTMT StatementHandle, SQLCHAR *CatalogName, SQLCHAR *ctName = CatalogName, *scName = SchemaName, *tbName = TableName; UWORD flag = 0; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -698,7 +698,7 @@ RETCODE SQL_API SQLTables(HSTMT StatementHandle, SQLCHAR *CatalogName, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_Tables(StatementHandle, ctName, NameLength1, scName, + ret = OPENSEARCHAPI_Tables(StatementHandle, ctName, NameLength1, scName, NameLength2, tbName, NameLength3, TableType, NameLength4, flag); if (SQL_SUCCESS == ret && theResultIsEmpty(stmt)) { @@ -725,7 +725,7 @@ RETCODE SQL_API SQLTables(HSTMT StatementHandle, SQLCHAR *CatalogName, reexec = TRUE; } if (reexec) { - ret = ESAPI_Tables(StatementHandle, ctName, NameLength1, scName, + ret = OPENSEARCHAPI_Tables(StatementHandle, ctName, NameLength1, scName, NameLength2, tbName, NameLength3, TableType, NameLength4, flag); if (newCt) @@ -751,7 +751,7 @@ RETCODE SQL_API SQLColumnPrivileges( *tbName = szTableName, *clName = szColumnName; UWORD flag = 0; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -762,7 +762,7 @@ RETCODE SQL_API SQLColumnPrivileges( if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_ColumnPrivileges(hstmt, ctName, cbCatalogName, scName, + ret = OPENSEARCHAPI_ColumnPrivileges(hstmt, ctName, cbCatalogName, scName, cbSchemaName, tbName, cbTableName, clName, cbColumnName, flag); if (SQL_SUCCESS == ret && theResultIsEmpty(stmt)) { @@ -795,7 +795,7 @@ RETCODE SQL_API SQLColumnPrivileges( reexec = TRUE; } if (reexec) { - ret = ESAPI_ColumnPrivileges(hstmt, ctName, cbCatalogName, scName, + ret = OPENSEARCHAPI_ColumnPrivileges(hstmt, ctName, cbCatalogName, scName, cbSchemaName, tbName, cbTableName, clName, cbColumnName, flag); if (newCt) @@ -823,7 +823,7 @@ RETCODE SQL_API SQLDescribeParam(HSTMT hstmt, SQLUSMALLINT ipar, // COLNUM_ERROR translates to 'invalid descriptor index' SC_set_error(stmt, STMT_COLNUM_ERROR, - "Elasticsearch does not support parameters.", "SQLNumParams"); + "OpenSearch does not support parameters.", "SQLNumParams"); return SQL_ERROR; } @@ -838,7 +838,7 @@ RETCODE SQL_API SQLExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, RETCODE ret; StatementClass *stmt = (StatementClass *)hstmt; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -848,14 +848,14 @@ RETCODE SQL_API SQLExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, { SQLULEN retrieved; - ret = ESAPI_ExtendedFetch(hstmt, fFetchType, irow, &retrieved, + ret = OPENSEARCHAPI_ExtendedFetch(hstmt, fFetchType, irow, &retrieved, rgfRowStatus, 0, SC_get_ARDF(stmt)->size_of_rowset_odbc2); if (pcrow) *pcrow = retrieved; } #else - ret = ESAPI_ExtendedFetch(hstmt, fFetchType, irow, pcrow, rgfRowStatus, 0, + ret = OPENSEARCHAPI_ExtendedFetch(hstmt, fFetchType, irow, pcrow, rgfRowStatus, 0, SC_get_ARDF(stmt)->size_of_rowset_odbc2); #endif /* WITH_UNIXODBC */ stmt->transition_status = STMT_TRANSITION_EXTENDED_FETCH; @@ -878,7 +878,7 @@ RETCODE SQL_API SQLForeignKeys( *pktbName = szPkTableName, *fkctName = szFkCatalogName, *fkscName = szFkSchemaName, *fktbName = szFkTableName; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -887,7 +887,7 @@ RETCODE SQL_API SQLForeignKeys( if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_ForeignKeys(hstmt, pkctName, cbPkCatalogName, pkscName, + ret = OPENSEARCHAPI_ForeignKeys(hstmt, pkctName, cbPkCatalogName, pkscName, cbPkSchemaName, pktbName, cbPkTableName, fkctName, cbFkCatalogName, fkscName, cbFkSchemaName, fktbName, cbFkTableName); @@ -934,7 +934,7 @@ RETCODE SQL_API SQLForeignKeys( reexec = TRUE; } if (reexec) { - ret = ESAPI_ForeignKeys(hstmt, pkctName, cbPkCatalogName, pkscName, + ret = OPENSEARCHAPI_ForeignKeys(hstmt, pkctName, cbPkCatalogName, pkscName, cbPkSchemaName, pktbName, cbPkTableName, fkctName, cbFkCatalogName, fkscName, cbFkSchemaName, fktbName, cbFkTableName); @@ -961,13 +961,13 @@ RETCODE SQL_API SQLMoreResults(HSTMT hstmt) { RETCODE ret; StatementClass *stmt = (StatementClass *)hstmt; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_MoreResults(hstmt); + ret = OPENSEARCHAPI_MoreResults(hstmt); LEAVE_STMT_CS(stmt); return ret; } @@ -979,10 +979,10 @@ RETCODE SQL_API SQLNativeSql(HDBC hdbc, SQLCHAR *szSqlStrIn, RETCODE ret; ConnectionClass *conn = (ConnectionClass *)hdbc; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_CONN_CS(conn); CC_clear_error(conn); - ret = ESAPI_NativeSql(hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, + ret = OPENSEARCHAPI_NativeSql(hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr); LEAVE_CONN_CS(conn); return ret; @@ -998,7 +998,7 @@ RETCODE SQL_API SQLNumParams(HSTMT hstmt, SQLSMALLINT *pcpar) { return SQL_ERROR; SC_clear_error(stmt); SC_set_error(stmt, STMT_NOT_IMPLEMENTED_ERROR, - "Elasticsearch does not support parameters.", "SQLNumParams"); + "OpenSearch does not support parameters.", "SQLNumParams"); return SQL_SUCCESS_WITH_INFO; } @@ -1013,7 +1013,7 @@ RETCODE SQL_API SQLPrimaryKeys(HSTMT hstmt, SQLCHAR *szCatalogName, SQLCHAR *ctName = szCatalogName, *scName = szSchemaName, *tbName = szTableName; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -1022,7 +1022,7 @@ RETCODE SQL_API SQLPrimaryKeys(HSTMT hstmt, SQLCHAR *szCatalogName, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_PrimaryKeys(hstmt, ctName, cbCatalogName, scName, + ret = OPENSEARCHAPI_PrimaryKeys(hstmt, ctName, cbCatalogName, scName, cbSchemaName, tbName, cbTableName, 0); if (SQL_SUCCESS == ret && theResultIsEmpty(stmt)) { BOOL ifallupper = TRUE, reexec = FALSE; @@ -1048,7 +1048,7 @@ RETCODE SQL_API SQLPrimaryKeys(HSTMT hstmt, SQLCHAR *szCatalogName, reexec = TRUE; } if (reexec) { - ret = ESAPI_PrimaryKeys(hstmt, ctName, cbCatalogName, scName, + ret = OPENSEARCHAPI_PrimaryKeys(hstmt, ctName, cbCatalogName, scName, cbSchemaName, tbName, cbTableName, 0); if (newCt) free(newCt); @@ -1073,7 +1073,7 @@ RETCODE SQL_API SQLProcedureColumns( *prName = szProcName, *clName = szColumnName; UWORD flag = 0; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -1084,7 +1084,7 @@ RETCODE SQL_API SQLProcedureColumns( if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_ProcedureColumns(hstmt, ctName, cbCatalogName, scName, + ret = OPENSEARCHAPI_ProcedureColumns(hstmt, ctName, cbCatalogName, scName, cbSchemaName, prName, cbProcName, clName, cbColumnName, flag); if (SQL_SUCCESS == ret && theResultIsEmpty(stmt)) { @@ -1117,7 +1117,7 @@ RETCODE SQL_API SQLProcedureColumns( reexec = TRUE; } if (reexec) { - ret = ESAPI_ProcedureColumns(hstmt, ctName, cbCatalogName, scName, + ret = OPENSEARCHAPI_ProcedureColumns(hstmt, ctName, cbCatalogName, scName, cbSchemaName, prName, cbProcName, clName, cbColumnName, flag); if (newCt) @@ -1145,7 +1145,7 @@ RETCODE SQL_API SQLProcedures(HSTMT hstmt, SQLCHAR *szCatalogName, *prName = szProcName; UWORD flag = 0; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -1156,7 +1156,7 @@ RETCODE SQL_API SQLProcedures(HSTMT hstmt, SQLCHAR *szCatalogName, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_Procedures(hstmt, ctName, cbCatalogName, scName, + ret = OPENSEARCHAPI_Procedures(hstmt, ctName, cbCatalogName, scName, cbSchemaName, prName, cbProcName, flag); if (SQL_SUCCESS == ret && theResultIsEmpty(stmt)) { BOOL ifallupper = TRUE, reexec = FALSE; @@ -1182,7 +1182,7 @@ RETCODE SQL_API SQLProcedures(HSTMT hstmt, SQLCHAR *szCatalogName, reexec = TRUE; } if (reexec) { - ret = ESAPI_Procedures(hstmt, ctName, cbCatalogName, scName, + ret = OPENSEARCHAPI_Procedures(hstmt, ctName, cbCatalogName, scName, cbSchemaName, prName, cbProcName, flag); if (newCt) free(newCt); @@ -1223,7 +1223,7 @@ RETCODE SQL_API SQLTablePrivileges(HSTMT hstmt, SQLCHAR *szCatalogName, *tbName = szTableName; UWORD flag = 0; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -1234,7 +1234,7 @@ RETCODE SQL_API SQLTablePrivileges(HSTMT hstmt, SQLCHAR *szCatalogName, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_TablePrivileges(hstmt, ctName, cbCatalogName, scName, + ret = OPENSEARCHAPI_TablePrivileges(hstmt, ctName, cbCatalogName, scName, cbSchemaName, tbName, cbTableName, flag); if (SQL_SUCCESS == ret && theResultIsEmpty(stmt)) { BOOL ifallupper = TRUE, reexec = FALSE; @@ -1260,7 +1260,7 @@ RETCODE SQL_API SQLTablePrivileges(HSTMT hstmt, SQLCHAR *szCatalogName, reexec = TRUE; } if (reexec) { - ret = ESAPI_TablePrivileges(hstmt, ctName, cbCatalogName, scName, + ret = OPENSEARCHAPI_TablePrivileges(hstmt, ctName, cbCatalogName, scName, cbSchemaName, tbName, cbTableName, 0); if (newCt) free(newCt); @@ -1287,7 +1287,7 @@ RETCODE SQL_API SQLBindParameter(HSTMT hstmt, SQLUSMALLINT ipar, return SQL_ERROR; SC_clear_error(stmt); SC_set_error(stmt, STMT_NOT_IMPLEMENTED_ERROR, - "Elasticsearch does not support parameters.", + "OpenSearch does not support parameters.", "SQLBindParameter"); return SQL_ERROR; } @@ -1298,11 +1298,11 @@ RETCODE SQL_API SQLBindParameter(HSTMT hstmt, SQLUSMALLINT ipar, RETCODE SQL_API SQLAllocStmt(SQLHDBC InputHandle, SQLHSTMT *OutputHandle) { RETCODE ret; ConnectionClass *conn; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); conn = (ConnectionClass *)InputHandle; ENTER_CONN_CS(conn); - ret = ESAPI_AllocStmt( + ret = OPENSEARCHAPI_AllocStmt( InputHandle, OutputHandle, PODBC_EXTERNAL_STATEMENT | PODBC_INHERIT_CONNECT_OPTIONS); if (*OutputHandle) @@ -1317,10 +1317,10 @@ RETCODE SQL_API SQLGetConnectOption(HDBC ConnectionHandle, SQLUSMALLINT Option, PTR Value) { RETCODE ret; - MYLOG(ES_TRACE, "entering " FORMAT_UINTEGER "\n", Option); + MYLOG(OPENSEARCH_TRACE, "entering " FORMAT_UINTEGER "\n", Option); ENTER_CONN_CS((ConnectionClass *)ConnectionHandle); CC_clear_error((ConnectionClass *)ConnectionHandle); - ret = ESAPI_GetConnectOption(ConnectionHandle, Option, Value, NULL, 0); + ret = OPENSEARCHAPI_GetConnectOption(ConnectionHandle, Option, Value, NULL, 0); LEAVE_CONN_CS((ConnectionClass *)ConnectionHandle); return ret; } @@ -1331,10 +1331,10 @@ RETCODE SQL_API SQLSetConnectOption(HDBC ConnectionHandle, SQLUSMALLINT Option, RETCODE ret; ConnectionClass *conn = (ConnectionClass *)ConnectionHandle; - MYLOG(ES_TRACE, "entering " FORMAT_INTEGER "\n", Option); + MYLOG(OPENSEARCH_TRACE, "entering " FORMAT_INTEGER "\n", Option); ENTER_CONN_CS(conn); CC_clear_error(conn); - ret = ESAPI_SetConnectOption(ConnectionHandle, Option, Value); + ret = OPENSEARCHAPI_SetConnectOption(ConnectionHandle, Option, Value); LEAVE_CONN_CS(conn); return ret; } @@ -1355,13 +1355,13 @@ SQLRETURN SQL_API SQLColAttributes(SQLHSTMT StatementHandle, RETCODE ret; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_ColAttributes(StatementHandle, ColumnNumber, FieldIdentifier, + ret = OPENSEARCHAPI_ColAttributes(StatementHandle, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength, StringLength, NumericAttribute); LEAVE_STMT_CS(stmt); @@ -1376,24 +1376,24 @@ RETCODE SQL_API SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, RETCODE ret; SQLSMALLINT RecNumber = 1; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (StatementHandle) { ret = - ESAPI_StmtError(StatementHandle, RecNumber, Sqlstate, NativeError, + OPENSEARCHAPI_StmtError(StatementHandle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength, 0); } else if (ConnectionHandle) { - ret = ESAPI_ConnectError(ConnectionHandle, RecNumber, Sqlstate, + ret = OPENSEARCHAPI_ConnectError(ConnectionHandle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength, 0); } else if (EnvironmentHandle) { - ret = ESAPI_EnvError(EnvironmentHandle, RecNumber, Sqlstate, NativeError, + ret = OPENSEARCHAPI_EnvError(EnvironmentHandle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength, 0); } else { ret = SQL_ERROR; } - MYLOG(ES_TRACE, "leaving %d\n", ret); + MYLOG(OPENSEARCH_TRACE, "leaving %d\n", ret); return ret; } #endif /* UNICODE_SUPPORTXX */ diff --git a/sql-odbc/src/odfesqlodbc/odbcapi30.c b/sql-odbc/src/odfesqlodbc/odbcapi30.c index 0cde75ea31..ff020dd84e 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi30.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi30.c @@ -18,10 +18,10 @@ #include #include "environ.h" -#include "es_apifunc.h" -#include "es_connection.h" -#include "es_odbc.h" +#include "opensearch_odbc.h" #include "misc.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "statement.h" /* SQLAllocConnect/SQLAllocEnv/SQLAllocStmt -> SQLAllocHandle */ @@ -30,20 +30,20 @@ RETCODE SQL_API SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, RETCODE ret; ConnectionClass *conn; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); switch (HandleType) { case SQL_HANDLE_ENV: - ret = ESAPI_AllocEnv(OutputHandle); + ret = OPENSEARCHAPI_AllocEnv(OutputHandle); break; case SQL_HANDLE_DBC: ENTER_ENV_CS((EnvironmentClass *)InputHandle); - ret = ESAPI_AllocConnect(InputHandle, OutputHandle); + ret = OPENSEARCHAPI_AllocConnect(InputHandle, OutputHandle); LEAVE_ENV_CS((EnvironmentClass *)InputHandle); break; case SQL_HANDLE_STMT: conn = (ConnectionClass *)InputHandle; ENTER_CONN_CS(conn); - ret = ESAPI_AllocStmt( + ret = OPENSEARCHAPI_AllocStmt( InputHandle, OutputHandle, PODBC_EXTERNAL_STATEMENT | PODBC_INHERIT_CONNECT_OPTIONS); if (*OutputHandle) @@ -53,9 +53,9 @@ RETCODE SQL_API SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, case SQL_HANDLE_DESC: conn = (ConnectionClass *)InputHandle; ENTER_CONN_CS(conn); - ret = ESAPI_AllocDesc(InputHandle, OutputHandle); + ret = OPENSEARCHAPI_AllocDesc(InputHandle, OutputHandle); LEAVE_CONN_CS(conn); - MYLOG(ES_DEBUG, "OutputHandle=%p\n", *OutputHandle); + MYLOG(OPENSEARCH_DEBUG, "OutputHandle=%p\n", *OutputHandle); break; default: ret = SQL_ERROR; @@ -78,7 +78,7 @@ RETCODE SQL_API SQLBindParam(HSTMT StatementHandle, return SQL_ERROR; SC_clear_error(stmt); SC_set_error(stmt, STMT_NOT_IMPLEMENTED_ERROR, - "Elasticsearch does not support parameters.", "SQLBindParam"); + "OpenSearch does not support parameters.", "SQLBindParam"); return SQL_ERROR; } @@ -90,13 +90,13 @@ RETCODE SQL_API SQLCloseCursor(HSTMT StatementHandle) { RETCODE ret; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_FreeStmt(StatementHandle, SQL_CLOSE); + ret = OPENSEARCHAPI_FreeStmt(StatementHandle, SQL_CLOSE); LEAVE_STMT_CS(stmt); return ret; } @@ -118,13 +118,13 @@ SQLRETURN SQL_API SQLColAttribute(SQLHSTMT StatementHandle, RETCODE ret; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_ColAttributes(StatementHandle, ColumnNumber, FieldIdentifier, + ret = OPENSEARCHAPI_ColAttributes(StatementHandle, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength, StringLength, NumericAttribute); LEAVE_STMT_CS(stmt); @@ -137,8 +137,8 @@ RETCODE SQL_API SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle) { RETCODE ret; - MYLOG(ES_TRACE, "entering\n"); - ret = ESAPI_CopyDesc(SourceDescHandle, TargetDescHandle); + MYLOG(OPENSEARCH_TRACE, "entering\n"); + ret = OPENSEARCHAPI_CopyDesc(SourceDescHandle, TargetDescHandle); return ret; } @@ -176,7 +176,7 @@ RETCODE SQL_API SQLFetchScroll(HSTMT StatementHandle, SQLULEN *pcRow = irdopts->rowsFetched; SQLLEN bkmarkoff = 0; - MYLOG(ES_TRACE, "entering %d," FORMAT_LEN "\n", FetchOrientation, + MYLOG(OPENSEARCH_TRACE, "entering %d," FORMAT_LEN "\n", FetchOrientation, FetchOffset); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -187,7 +187,7 @@ RETCODE SQL_API SQLFetchScroll(HSTMT StatementHandle, if (stmt->options.bookmark_ptr) { bkmarkoff = FetchOffset; FetchOffset = *((Int4 *)stmt->options.bookmark_ptr); - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "bookmark=" FORMAT_LEN " FetchOffset = " FORMAT_LEN "\n", FetchOffset, bkmarkoff); } else { @@ -199,14 +199,14 @@ RETCODE SQL_API SQLFetchScroll(HSTMT StatementHandle, if (SQL_SUCCESS == ret) { ARDFields *opts = SC_get_ARDF(stmt); - ret = ESAPI_ExtendedFetch(StatementHandle, FetchOrientation, + ret = OPENSEARCHAPI_ExtendedFetch(StatementHandle, FetchOrientation, FetchOffset, pcRow, rowStatusArray, bkmarkoff, opts->size_of_rowset); stmt->transition_status = STMT_TRANSITION_FETCH_SCROLL; } LEAVE_STMT_CS(stmt); if (ret != SQL_SUCCESS) - MYLOG(ES_TRACE, "leaving return = %d\n", ret); + MYLOG(OPENSEARCH_TRACE, "leaving return = %d\n", ret); return ret; } @@ -216,14 +216,14 @@ RETCODE SQL_API SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) { StatementClass *stmt; ConnectionClass *conn = NULL; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); switch (HandleType) { case SQL_HANDLE_ENV: - ret = ESAPI_FreeEnv(Handle); + ret = OPENSEARCHAPI_FreeEnv(Handle); break; case SQL_HANDLE_DBC: - ret = ESAPI_FreeConnect(Handle); + ret = OPENSEARCHAPI_FreeConnect(Handle); break; case SQL_HANDLE_STMT: stmt = (StatementClass *)Handle; @@ -234,14 +234,14 @@ RETCODE SQL_API SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) { ENTER_CONN_CS(conn); } - ret = ESAPI_FreeStmt(Handle, SQL_DROP); + ret = OPENSEARCHAPI_FreeStmt(Handle, SQL_DROP); if (conn) LEAVE_CONN_CS(conn); break; case SQL_HANDLE_DESC: - ret = ESAPI_FreeDesc(Handle); + ret = OPENSEARCHAPI_FreeDesc(Handle); break; default: ret = SQL_ERROR; @@ -259,8 +259,8 @@ RETCODE SQL_API SQLGetDescField(SQLHDESC DescriptorHandle, SQLINTEGER *StringLength) { RETCODE ret; - MYLOG(ES_TRACE, "entering\n"); - ret = ESAPI_GetDescField(DescriptorHandle, RecNumber, FieldIdentifier, + MYLOG(OPENSEARCH_TRACE, "entering\n"); + ret = OPENSEARCHAPI_GetDescField(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength); return ret; } @@ -274,8 +274,8 @@ RETCODE SQL_API SQLGetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT *Nullable) { UNUSED(DescriptorHandle, RecNumber, Name, BufferLength, StringLength, Type, SubType, Length, Precision, Scale, Nullable); - MYLOG(ES_TRACE, "entering\n"); - MYLOG(ES_DEBUG, "Error not implemented\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); + MYLOG(OPENSEARCH_DEBUG, "Error not implemented\n"); return SQL_ERROR; } @@ -287,10 +287,10 @@ RETCODE SQL_API SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT *StringLength) { RETCODE ret; - MYLOG(ES_TRACE, "entering Handle=(%u,%p) Rec=%d Id=%d info=(%p,%d)\n", + MYLOG(OPENSEARCH_TRACE, "entering Handle=(%u,%p) Rec=%d Id=%d info=(%p,%d)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength); - ret = ESAPI_GetDiagField(HandleType, Handle, RecNumber, DiagIdentifier, + ret = OPENSEARCHAPI_GetDiagField(HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength); return ret; } @@ -303,8 +303,8 @@ RETCODE SQL_API SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT *TextLength) { RETCODE ret; - MYLOG(ES_TRACE, "entering\n"); - ret = ESAPI_GetDiagRec(HandleType, Handle, RecNumber, Sqlstate, NativeError, + MYLOG(OPENSEARCH_TRACE, "entering\n"); + ret = OPENSEARCHAPI_GetDiagRec(HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength); return ret; } @@ -318,7 +318,7 @@ RETCODE SQL_API SQLGetEnvAttr(HENV EnvironmentHandle, SQLINTEGER Attribute, RETCODE ret; EnvironmentClass *env = (EnvironmentClass *)EnvironmentHandle; - MYLOG(ES_TRACE, "entering " FORMAT_INTEGER "\n", Attribute); + MYLOG(OPENSEARCH_TRACE, "entering " FORMAT_INTEGER "\n", Attribute); ENTER_ENV_CS(env); ret = SQL_SUCCESS; switch (Attribute) { @@ -351,10 +351,10 @@ RETCODE SQL_API SQLGetConnectAttr(HDBC ConnectionHandle, SQLINTEGER Attribute, SQLINTEGER *StringLength) { RETCODE ret; - MYLOG(ES_TRACE, "entering " FORMAT_UINTEGER "\n", Attribute); + MYLOG(OPENSEARCH_TRACE, "entering " FORMAT_UINTEGER "\n", Attribute); ENTER_CONN_CS((ConnectionClass *)ConnectionHandle); CC_clear_error((ConnectionClass *)ConnectionHandle); - ret = ESAPI_GetConnectAttr(ConnectionHandle, Attribute, Value, BufferLength, + ret = OPENSEARCHAPI_GetConnectAttr(ConnectionHandle, Attribute, Value, BufferLength, StringLength); LEAVE_CONN_CS((ConnectionClass *)ConnectionHandle); return ret; @@ -367,11 +367,11 @@ RETCODE SQL_API SQLGetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, RETCODE ret; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering Handle=%p " FORMAT_INTEGER "\n", StatementHandle, + MYLOG(OPENSEARCH_TRACE, "entering Handle=%p " FORMAT_INTEGER "\n", StatementHandle, Attribute); ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_GetStmtAttr(StatementHandle, Attribute, Value, BufferLength, + ret = OPENSEARCHAPI_GetStmtAttr(StatementHandle, Attribute, Value, BufferLength, StringLength); LEAVE_STMT_CS(stmt); return ret; @@ -383,11 +383,11 @@ RETCODE SQL_API SQLSetConnectAttr(HDBC ConnectionHandle, SQLINTEGER Attribute, RETCODE ret; ConnectionClass *conn = (ConnectionClass *)ConnectionHandle; - MYLOG(ES_TRACE, "entering " FORMAT_INTEGER "\n", Attribute); + MYLOG(OPENSEARCH_TRACE, "entering " FORMAT_INTEGER "\n", Attribute); ENTER_CONN_CS(conn); CC_clear_error(conn); ret = - ESAPI_SetConnectAttr(ConnectionHandle, Attribute, Value, StringLength); + OPENSEARCHAPI_SetConnectAttr(ConnectionHandle, Attribute, Value, StringLength); LEAVE_CONN_CS(conn); return ret; } @@ -399,9 +399,9 @@ RETCODE SQL_API SQLSetDescField(SQLHDESC DescriptorHandle, SQLINTEGER BufferLength) { RETCODE ret; - MYLOG(ES_TRACE, "entering h=%p rec=%d field=%d val=%p\n", DescriptorHandle, + MYLOG(OPENSEARCH_TRACE, "entering h=%p rec=%d field=%d val=%p\n", DescriptorHandle, RecNumber, FieldIdentifier, Value); - ret = ESAPI_SetDescField(DescriptorHandle, RecNumber, FieldIdentifier, + ret = OPENSEARCHAPI_SetDescField(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength); return ret; } @@ -414,8 +414,8 @@ RETCODE SQL_API SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLLEN *Indicator) { UNUSED(DescriptorHandle, RecNumber, Type, SubType, Length, Precision, Scale, Data, StringLength, Indicator); - MYLOG(ES_TRACE, "entering\n"); - MYLOG(ES_DEBUG, "Error not implemented\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); + MYLOG(OPENSEARCH_DEBUG, "Error not implemented\n"); return SQL_ERROR; } #endif /* UNICODE_SUPPORTXX */ @@ -427,7 +427,7 @@ RETCODE SQL_API SQLSetEnvAttr(HENV EnvironmentHandle, SQLINTEGER Attribute, RETCODE ret; EnvironmentClass *env = (EnvironmentClass *)EnvironmentHandle; - MYLOG(ES_TRACE, "entering att=" FORMAT_INTEGER "," FORMAT_ULEN "\n", + MYLOG(OPENSEARCH_TRACE, "entering att=" FORMAT_INTEGER "," FORMAT_ULEN "\n", Attribute, (SQLULEN)Value); ENTER_ENV_CS(env); switch (Attribute) { @@ -481,11 +481,11 @@ RETCODE SQL_API SQLSetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, StatementClass *stmt = (StatementClass *)StatementHandle; RETCODE ret; - MYLOG(ES_TRACE, "entering Handle=%p " FORMAT_INTEGER "," FORMAT_ULEN "\n", + MYLOG(OPENSEARCH_TRACE, "entering Handle=%p " FORMAT_INTEGER "," FORMAT_ULEN "\n", StatementHandle, Attribute, (SQLULEN)Value); ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_SetStmtAttr(StatementHandle, Attribute, Value, StringLength); + ret = OPENSEARCHAPI_SetStmtAttr(StatementHandle, Attribute, Value, StringLength); LEAVE_STMT_CS(stmt); return ret; } @@ -493,7 +493,7 @@ RETCODE SQL_API SQLSetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, #define SQL_FUNC_ESET(pfExists, uwAPI) \ (*(((UWORD *)(pfExists)) + ((uwAPI) >> 4)) |= (1 << ((uwAPI)&0x000F))) -RETCODE SQL_API ESAPI_GetFunctions30(HDBC hdbc, SQLUSMALLINT fFunction, +RETCODE SQL_API OPENSEARCHAPI_GetFunctions30(HDBC hdbc, SQLUSMALLINT fFunction, SQLUSMALLINT FAR *pfExists) { ConnectionClass *conn = (ConnectionClass *)hdbc; CC_clear_error(conn); diff --git a/sql-odbc/src/odfesqlodbc/odbcapi30w.c b/sql-odbc/src/odfesqlodbc/odbcapi30w.c index b0731eb696..c4a8920ea5 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi30w.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi30w.c @@ -16,13 +16,13 @@ #include #include -#include "es_odbc.h" -#include "unicode_support.h" -#include "es_apifunc.h" -#include "es_connection.h" +#include "opensearch_odbc.h" #include "misc.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "statement.h" +#include "unicode_support.h" RETCODE SQL_API SQLGetStmtAttrW(SQLHSTMT hstmt, SQLINTEGER fAttribute, PTR rgbValue, SQLINTEGER cbValueMax, @@ -30,10 +30,10 @@ RETCODE SQL_API SQLGetStmtAttrW(SQLHSTMT hstmt, SQLINTEGER fAttribute, UNUSED(hstmt, fAttribute, rgbValue, cbValueMax, pcbValue); RETCODE ret; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_STMT_CS((StatementClass *)hstmt); SC_clear_error((StatementClass *)hstmt); - ret = ESAPI_GetStmtAttr(hstmt, fAttribute, rgbValue, cbValueMax, pcbValue); + ret = OPENSEARCHAPI_GetStmtAttr(hstmt, fAttribute, rgbValue, cbValueMax, pcbValue); LEAVE_STMT_CS((StatementClass *)hstmt); return ret; } @@ -43,10 +43,10 @@ RETCODE SQL_API SQLSetStmtAttrW(SQLHSTMT hstmt, SQLINTEGER fAttribute, RETCODE ret; StatementClass *stmt = (StatementClass *)hstmt; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_SetStmtAttr(hstmt, fAttribute, rgbValue, cbValueMax); + ret = OPENSEARCHAPI_SetStmtAttr(hstmt, fAttribute, rgbValue, cbValueMax); LEAVE_STMT_CS(stmt); return ret; } @@ -56,11 +56,11 @@ RETCODE SQL_API SQLGetConnectAttrW(HDBC hdbc, SQLINTEGER fAttribute, SQLINTEGER *pcbValue) { RETCODE ret; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_CONN_CS((ConnectionClass *)hdbc); CC_clear_error((ConnectionClass *)hdbc); ret = - ESAPI_GetConnectAttr(hdbc, fAttribute, rgbValue, cbValueMax, pcbValue); + OPENSEARCHAPI_GetConnectAttr(hdbc, fAttribute, rgbValue, cbValueMax, pcbValue); LEAVE_CONN_CS((ConnectionClass *)hdbc); return ret; } @@ -70,11 +70,11 @@ RETCODE SQL_API SQLSetConnectAttrW(HDBC hdbc, SQLINTEGER fAttribute, RETCODE ret; ConnectionClass *conn = (ConnectionClass *)hdbc; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_CONN_CS(conn); CC_clear_error(conn); CC_set_in_unicode_driver(conn); - ret = ESAPI_SetConnectAttr(hdbc, fAttribute, rgbValue, cbValue); + ret = OPENSEARCHAPI_SetConnectAttr(hdbc, fAttribute, rgbValue, cbValue); LEAVE_CONN_CS(conn); return ret; } @@ -89,7 +89,7 @@ RETCODE SQL_API SQLSetDescFieldW(SQLHDESC DescriptorHandle, char *uval = NULL; BOOL val_alloced = FALSE; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (BufferLength > 0 || SQL_NTS == BufferLength) { switch (FieldIdentifier) { case SQL_DESC_BASE_COLUMN_NAME: @@ -118,7 +118,7 @@ RETCODE SQL_API SQLSetDescFieldW(SQLHDESC DescriptorHandle, vallen = BufferLength; uval = Value; } - ret = ESAPI_SetDescField(DescriptorHandle, RecNumber, FieldIdentifier, uval, + ret = OPENSEARCHAPI_SetDescField(DescriptorHandle, RecNumber, FieldIdentifier, uval, (SQLINTEGER)vallen); if (val_alloced) free(uval); @@ -132,7 +132,7 @@ RETCODE SQL_API SQLGetDescFieldW(SQLHDESC hdesc, SQLSMALLINT iRecord, SQLINTEGER blen = 0, bMax, *pcbV; char *rgbV = NULL, *rgbVt; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); switch (iField) { case SQL_DESC_BASE_COLUMN_NAME: case SQL_DESC_BASE_TABLE_NAME: @@ -154,7 +154,7 @@ RETCODE SQL_API SQLGetDescFieldW(SQLHDESC hdesc, SQLSMALLINT iRecord, break; } rgbV = rgbVt; - ret = ESAPI_GetDescField(hdesc, iRecord, iField, rgbV, bMax, + ret = OPENSEARCHAPI_GetDescField(hdesc, iRecord, iField, rgbV, bMax, pcbV); if (SQL_SUCCESS_WITH_INFO != ret || blen < bMax) break; @@ -178,7 +178,7 @@ RETCODE SQL_API SQLGetDescFieldW(SQLHDESC hdesc, SQLSMALLINT iRecord, rgbV = rgbValue; bMax = cbValueMax; pcbV = pcbValue; - ret = ESAPI_GetDescField(hdesc, iRecord, iField, rgbV, bMax, pcbV); + ret = OPENSEARCHAPI_GetDescField(hdesc, iRecord, iField, rgbV, bMax, pcbV); break; } @@ -194,13 +194,13 @@ RETCODE SQL_API SQLGetDiagRecW(SQLSMALLINT fHandleType, SQLHANDLE handle, SQLSMALLINT buflen, tlen; char qstr_ansi[8], *mtxt = NULL; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); buflen = 0; if (szErrorMsg && cbErrorMsgMax > 0) { buflen = cbErrorMsgMax; mtxt = malloc(buflen); } - ret = ESAPI_GetDiagRec(fHandleType, handle, iRecord, (SQLCHAR *)qstr_ansi, + ret = OPENSEARCHAPI_GetDiagRec(fHandleType, handle, iRecord, (SQLCHAR *)qstr_ansi, pfNativeError, (SQLCHAR *)mtxt, buflen, &tlen); if (SQL_SUCCEEDED(ret)) { if (szSqlState) @@ -247,7 +247,7 @@ SQLRETURN SQL_API SQLColAttributeW(SQLHSTMT hstmt, SQLUSMALLINT iCol, SQLSMALLINT *rgbL, blen = 0, bMax; char *rgbD = NULL, *rgbDt; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -275,7 +275,7 @@ SQLRETURN SQL_API SQLColAttributeW(SQLHSTMT hstmt, SQLUSMALLINT iCol, break; } rgbD = rgbDt; - ret = ESAPI_ColAttributes(hstmt, iCol, iField, rgbD, bMax, rgbL, + ret = OPENSEARCHAPI_ColAttributes(hstmt, iCol, iField, rgbD, bMax, rgbL, pNumAttr); if (SQL_SUCCESS_WITH_INFO != ret || blen < bMax) break; @@ -300,7 +300,7 @@ SQLRETURN SQL_API SQLColAttributeW(SQLHSTMT hstmt, SQLUSMALLINT iCol, rgbD = pCharAttr; bMax = cbCharAttrMax; rgbL = pcbCharAttr; - ret = ESAPI_ColAttributes(hstmt, iCol, iField, rgbD, bMax, rgbL, + ret = OPENSEARCHAPI_ColAttributes(hstmt, iCol, iField, rgbD, bMax, rgbL, pNumAttr); break; } @@ -318,7 +318,7 @@ RETCODE SQL_API SQLGetDiagFieldW(SQLSMALLINT fHandleType, SQLHANDLE handle, SQLSMALLINT *rgbL, blen = 0, bMax; char *rgbD = NULL, *rgbDt; - MYLOG(ES_TRACE, "entering Handle=(%u,%p) Rec=%d Id=%d info=(%p,%d)\n", fHandleType, + MYLOG(OPENSEARCH_TRACE, "entering Handle=(%u,%p) Rec=%d Id=%d info=(%p,%d)\n", fHandleType, handle, iRecord, fDiagField, rgbDiagInfo, cbDiagInfoMax); switch (fDiagField) { case SQL_DIAG_DYNAMIC_FUNCTION: @@ -338,7 +338,7 @@ RETCODE SQL_API SQLGetDiagFieldW(SQLSMALLINT fHandleType, SQLHANDLE handle, return SQL_ERROR; } rgbD = rgbDt; - ret = ESAPI_GetDiagField(fHandleType, handle, iRecord, + ret = OPENSEARCHAPI_GetDiagField(fHandleType, handle, iRecord, fDiagField, rgbD, bMax, rgbL); if (SQL_SUCCESS_WITH_INFO != ret || blen < bMax) break; @@ -367,7 +367,7 @@ RETCODE SQL_API SQLGetDiagFieldW(SQLSMALLINT fHandleType, SQLHANDLE handle, rgbD = rgbDiagInfo; bMax = cbDiagInfoMax; rgbL = pcbDiagInfo; - ret = ESAPI_GetDiagField(fHandleType, handle, iRecord, fDiagField, + ret = OPENSEARCHAPI_GetDiagField(fHandleType, handle, iRecord, fDiagField, rgbD, bMax, rgbL); break; } @@ -384,8 +384,8 @@ RETCODE SQL_API SQLGetDescRecW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT *Nullable) { UNUSED(DescriptorHandle, RecNumber, Name, BufferLength, StringLength, Type, SubType, Length, Precision, Scale, Nullable); - MYLOG(ES_TRACE, "entering\n"); - MYLOG(ES_DEBUG, "Error not implemented\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); + MYLOG(OPENSEARCH_DEBUG, "Error not implemented\n"); return SQL_ERROR; } @@ -397,7 +397,7 @@ RETCODE SQL_API SQLSetDescRecW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLLEN *StringLength, SQLLEN *Indicator) { UNUSED(DescriptorHandle, RecNumber, Type, SubType, Length, Precision, Scale, Data, StringLength, Indicator); - MYLOG(ES_TRACE, "entering\n"); - MYLOG(ES_DEBUG, "Error not implemented\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); + MYLOG(OPENSEARCH_DEBUG, "Error not implemented\n"); return SQL_ERROR; } diff --git a/sql-odbc/src/odfesqlodbc/odbcapiw.c b/sql-odbc/src/odfesqlodbc/odbcapiw.c index 9a7e5d66db..20272c8054 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapiw.c +++ b/sql-odbc/src/odfesqlodbc/odbcapiw.c @@ -17,11 +17,11 @@ #include #include -#include "es_apifunc.h" -#include "es_connection.h" -#include "es_driver_connect.h" -#include "es_info.h" -#include "es_odbc.h" +#include "opensearch_odbc.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" +#include "opensearch_driver_connect.h" +#include "opensearch_info.h" #include "statement.h" #include "unicode_support.h" @@ -40,7 +40,7 @@ RETCODE SQL_API SQLColumnsW(HSTMT StatementHandle, SQLWCHAR *CatalogName, UWORD flag = PODBC_SEARCH_PUBLIC_SCHEMA; ConnInfo *ci; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -58,7 +58,7 @@ RETCODE SQL_API SQLColumnsW(HSTMT StatementHandle, SQLWCHAR *CatalogName, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_Columns(StatementHandle, (SQLCHAR *)ctName, + ret = OPENSEARCHAPI_Columns(StatementHandle, (SQLCHAR *)ctName, (SQLSMALLINT)nmlen1, (SQLCHAR *)scName, (SQLSMALLINT)nmlen2, (SQLCHAR *)tbName, (SQLSMALLINT)nmlen3, (SQLCHAR *)clName, @@ -84,7 +84,7 @@ RETCODE SQL_API SQLConnectW(HDBC ConnectionHandle, SQLWCHAR *ServerName, RETCODE ret; ConnectionClass *conn = (ConnectionClass *)ConnectionHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_CONN_CS(conn); CC_clear_error(conn); CC_set_in_unicode_driver(conn); @@ -92,7 +92,7 @@ RETCODE SQL_API SQLConnectW(HDBC ConnectionHandle, SQLWCHAR *ServerName, usName = ucs2_to_utf8(UserName, NameLength2, &nmlen2, FALSE); auth = ucs2_to_utf8(Authentication, NameLength3, &nmlen3, FALSE); ret = - ESAPI_Connect(ConnectionHandle, (SQLCHAR *)svName, (SQLSMALLINT)nmlen1, + OPENSEARCHAPI_Connect(ConnectionHandle, (SQLCHAR *)svName, (SQLSMALLINT)nmlen1, (SQLCHAR *)usName, (SQLSMALLINT)nmlen2, (SQLCHAR *)auth, (SQLSMALLINT)nmlen3); LEAVE_CONN_CS(conn); @@ -119,7 +119,7 @@ RETCODE SQL_API SQLDriverConnectW(HDBC hdbc, HWND hwnd, SQLWCHAR *szConnStrIn, RETCODE ret; ConnectionClass *conn = (ConnectionClass *)hdbc; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_CONN_CS(conn); CC_clear_error(conn); CC_set_in_unicode_driver(conn); @@ -140,7 +140,7 @@ RETCODE SQL_API SQLDriverConnectW(HDBC hdbc, HWND hwnd, SQLWCHAR *szConnStrIn, } else if (pcbConnStrOut) pCSO = &olen; ret = - ESAPI_DriverConnect(hdbc, hwnd, (SQLCHAR *)szIn, (SQLSMALLINT)inlen, + OPENSEARCHAPI_DriverConnect(hdbc, hwnd, (SQLCHAR *)szIn, (SQLSMALLINT)inlen, (SQLCHAR *)szOut, maxlen, pCSO, fDriverCompletion); if (ret != SQL_ERROR && NULL != pCSO) { SQLLEN outlen = olen; @@ -151,7 +151,7 @@ RETCODE SQL_API SQLDriverConnectW(HDBC hdbc, HWND hwnd, SQLWCHAR *szConnStrIn, utf8_to_ucs2(szOut, maxlen, szConnStrOut, cbConnStrOutMax); if (outlen >= cbConnStrOutMax && NULL != szConnStrOut && NULL != pcbConnStrOut) { - MYLOG(ES_ALL, "cbConnstrOutMax=%d pcb=%p\n", cbConnStrOutMax, + MYLOG(OPENSEARCH_ALL, "cbConnstrOutMax=%d pcb=%p\n", cbConnStrOutMax, pcbConnStrOut); if (SQL_SUCCESS == ret) { CC_set_error(conn, CONN_TRUNCATED, @@ -183,7 +183,7 @@ RETCODE SQL_API SQLBrowseConnectW(HDBC hdbc, SQLWCHAR *szConnStrIn, RETCODE ret; ConnectionClass *conn = (ConnectionClass *)hdbc; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_CONN_CS(conn); CC_clear_error(conn); CC_set_in_unicode_driver(conn); @@ -191,7 +191,7 @@ RETCODE SQL_API SQLBrowseConnectW(HDBC hdbc, SQLWCHAR *szConnStrIn, obuflen = cbConnStrOutMax + 1; szOut = malloc(obuflen); if (szOut) - ret = ESAPI_BrowseConnect(hdbc, (SQLCHAR *)szIn, (SQLSMALLINT)inlen, + ret = OPENSEARCHAPI_BrowseConnect(hdbc, (SQLCHAR *)szIn, (SQLSMALLINT)inlen, (SQLCHAR *)szOut, cbConnStrOutMax, &olen); else { CC_set_error(conn, CONN_NO_MEMORY_ERROR, @@ -218,7 +218,7 @@ RETCODE SQL_API SQLDataSourcesW(HENV EnvironmentHandle, SQLUSMALLINT Direction, SQLSMALLINT *NameLength2) { UNUSED(EnvironmentHandle, Direction, ServerName, BufferLength1, NameLength1, Description, BufferLength2, NameLength2); - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); return SQL_ERROR; } @@ -234,7 +234,7 @@ RETCODE SQL_API SQLDescribeColW(HSTMT StatementHandle, SQLSMALLINT buflen, nmlen = 0; char *clName = NULL, *clNamet = NULL; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -255,7 +255,7 @@ RETCODE SQL_API SQLDescribeColW(HSTMT StatementHandle, break; } clName = clNamet; - ret = ESAPI_DescribeCol(StatementHandle, ColumnNumber, + ret = OPENSEARCHAPI_DescribeCol(StatementHandle, ColumnNumber, (SQLCHAR *)clName, buflen, &nmlen, DataType, ColumnSize, DecimalDigits, Nullable); if (SQL_SUCCESS_WITH_INFO != ret || nmlen < buflen) @@ -301,7 +301,7 @@ RETCODE SQL_API SQLExecDirectW(HSTMT StatementHandle, SQLWCHAR *StatementText, // Execute statement if statement is ready RETCODE ret = SQL_ERROR; if (!SC_opencheck(stmt, "SQLExecDirectW")) - ret = ESAPI_ExecDirect(StatementHandle, (const SQLCHAR *)stxt, + ret = OPENSEARCHAPI_ExecDirect(StatementHandle, (const SQLCHAR *)stxt, (SQLINTEGER)slen, 1); // Exit critical @@ -321,7 +321,7 @@ RETCODE SQL_API SQLGetCursorNameW(HSTMT StatementHandle, SQLWCHAR *CursorName, char *crName = NULL, *crNamet; SQLSMALLINT clen = 0, buflen; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (BufferLength > 0) buflen = BufferLength * 3; else @@ -337,7 +337,7 @@ RETCODE SQL_API SQLGetCursorNameW(HSTMT StatementHandle, SQLWCHAR *CursorName, break; } crName = crNamet; - ret = ESAPI_GetCursorName(StatementHandle, (SQLCHAR *)crName, buflen, + ret = OPENSEARCHAPI_GetCursorName(StatementHandle, (SQLCHAR *)crName, buflen, &clen); if (SQL_SUCCESS_WITH_INFO != ret || clen < buflen) break; @@ -368,8 +368,8 @@ RETCODE SQL_API SQLGetInfoW(HDBC ConnectionHandle, SQLUSMALLINT InfoType, ENTER_CONN_CS(conn); CC_set_in_unicode_driver(conn); CC_clear_error(conn); - MYLOG(ES_TRACE, "entering\n"); - if ((ret = ESAPI_GetInfo(ConnectionHandle, InfoType, InfoValue, + MYLOG(OPENSEARCH_TRACE, "entering\n"); + if ((ret = OPENSEARCHAPI_GetInfo(ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength)) == SQL_ERROR) CC_log_error("SQLGetInfoW", "", conn); @@ -385,7 +385,7 @@ RETCODE SQL_API SQLPrepareW(HSTMT StatementHandle, SQLWCHAR *StatementText, CSTR func = "SQLPrepareW"; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -401,7 +401,7 @@ RETCODE SQL_API SQLPrepareW(HSTMT StatementHandle, SQLWCHAR *StatementText, // Prepare statement if statement is ready RETCODE ret = SQL_ERROR; if (!SC_opencheck(stmt, func)) - ret = ESAPI_Prepare(StatementHandle, (const SQLCHAR *)stxt, + ret = OPENSEARCHAPI_Prepare(StatementHandle, (const SQLCHAR *)stxt, (SQLINTEGER)slen); // Exit critical @@ -420,11 +420,11 @@ RETCODE SQL_API SQLSetCursorNameW(HSTMT StatementHandle, SQLWCHAR *CursorName, char *crName; SQLLEN nlen; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); crName = ucs2_to_utf8(CursorName, NameLength, &nlen, FALSE); ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_SetCursorName(StatementHandle, (SQLCHAR *)crName, + ret = OPENSEARCHAPI_SetCursorName(StatementHandle, (SQLCHAR *)crName, (SQLSMALLINT)nlen); LEAVE_STMT_CS(stmt); if (crName) @@ -445,7 +445,7 @@ RETCODE SQL_API SQLSpecialColumnsW( ConnectionClass *conn; BOOL lower_id; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -459,7 +459,7 @@ RETCODE SQL_API SQLSpecialColumnsW( if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_SpecialColumns( + ret = OPENSEARCHAPI_SpecialColumns( StatementHandle, IdentifierType, (SQLCHAR *)ctName, (SQLSMALLINT)nmlen1, (SQLCHAR *)scName, (SQLSMALLINT)nmlen2, (SQLCHAR *)tbName, (SQLSMALLINT)nmlen3, Scope, Nullable); @@ -486,7 +486,7 @@ RETCODE SQL_API SQLStatisticsW(HSTMT StatementHandle, SQLWCHAR *CatalogName, ConnectionClass *conn; BOOL lower_id; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -500,7 +500,7 @@ RETCODE SQL_API SQLStatisticsW(HSTMT StatementHandle, SQLWCHAR *CatalogName, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_Statistics(StatementHandle, (SQLCHAR *)ctName, + ret = OPENSEARCHAPI_Statistics(StatementHandle, (SQLCHAR *)ctName, (SQLSMALLINT)nmlen1, (SQLCHAR *)scName, (SQLSMALLINT)nmlen2, (SQLCHAR *)tbName, (SQLSMALLINT)nmlen3, Unique, Reserved); @@ -528,7 +528,7 @@ RETCODE SQL_API SQLTablesW(HSTMT StatementHandle, SQLWCHAR *CatalogName, BOOL lower_id; UWORD flag = 0; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -545,7 +545,7 @@ RETCODE SQL_API SQLTablesW(HSTMT StatementHandle, SQLWCHAR *CatalogName, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_Tables( + ret = OPENSEARCHAPI_Tables( StatementHandle, (SQLCHAR *)ctName, (SQLSMALLINT)nmlen1, (SQLCHAR *)scName, (SQLSMALLINT)nmlen2, (SQLCHAR *)tbName, (SQLSMALLINT)nmlen3, (SQLCHAR *)tbType, (SQLSMALLINT)nmlen4, flag); @@ -574,7 +574,7 @@ RETCODE SQL_API SQLColumnPrivilegesW( BOOL lower_id; UWORD flag = 0; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -591,7 +591,7 @@ RETCODE SQL_API SQLColumnPrivilegesW( if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_ColumnPrivileges( + ret = OPENSEARCHAPI_ColumnPrivileges( hstmt, (SQLCHAR *)ctName, (SQLSMALLINT)nmlen1, (SQLCHAR *)scName, (SQLSMALLINT)nmlen2, (SQLCHAR *)tbName, (SQLSMALLINT)nmlen3, (SQLCHAR *)clName, (SQLSMALLINT)nmlen4, flag); @@ -622,7 +622,7 @@ RETCODE SQL_API SQLForeignKeysW( ConnectionClass *conn; BOOL lower_id; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -640,7 +640,7 @@ RETCODE SQL_API SQLForeignKeysW( if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_ForeignKeys( + ret = OPENSEARCHAPI_ForeignKeys( hstmt, (SQLCHAR *)ctName, (SQLSMALLINT)nmlen1, (SQLCHAR *)scName, (SQLSMALLINT)nmlen2, (SQLCHAR *)tbName, (SQLSMALLINT)nmlen3, (SQLCHAR *)fkctName, (SQLSMALLINT)nmlen4, (SQLCHAR *)fkscName, @@ -671,7 +671,7 @@ RETCODE SQL_API SQLNativeSqlW(HDBC hdbc, SQLWCHAR *szSqlStrIn, SQLINTEGER buflen, olen = 0; ConnectionClass *conn = (ConnectionClass *)hdbc; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ENTER_CONN_CS(conn); CC_clear_error(conn); CC_set_in_unicode_driver(conn); @@ -687,7 +687,7 @@ RETCODE SQL_API SQLNativeSqlW(HDBC hdbc, SQLWCHAR *szSqlStrIn, break; } szOut = szOutt; - ret = ESAPI_NativeSql(hdbc, (SQLCHAR *)szIn, (SQLINTEGER)slen, + ret = OPENSEARCHAPI_NativeSql(hdbc, (SQLCHAR *)szIn, (SQLINTEGER)slen, (SQLCHAR *)szOut, buflen, &olen); if (SQL_SUCCESS_WITH_INFO != ret || olen < buflen) break; @@ -724,7 +724,7 @@ RETCODE SQL_API SQLPrimaryKeysW(HSTMT hstmt, SQLWCHAR *szCatalogName, ConnectionClass *conn; BOOL lower_id; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -738,7 +738,7 @@ RETCODE SQL_API SQLPrimaryKeysW(HSTMT hstmt, SQLWCHAR *szCatalogName, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_PrimaryKeys(hstmt, (SQLCHAR *)ctName, (SQLSMALLINT)nmlen1, + ret = OPENSEARCHAPI_PrimaryKeys(hstmt, (SQLCHAR *)ctName, (SQLSMALLINT)nmlen1, (SQLCHAR *)scName, (SQLSMALLINT)nmlen2, (SQLCHAR *)tbName, (SQLSMALLINT)nmlen3, 0); LEAVE_STMT_CS(stmt); @@ -764,7 +764,7 @@ RETCODE SQL_API SQLProcedureColumnsW( BOOL lower_id; UWORD flag = 0; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); conn = SC_get_conn(stmt); lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id); @@ -778,7 +778,7 @@ RETCODE SQL_API SQLProcedureColumnsW( if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_ProcedureColumns( + ret = OPENSEARCHAPI_ProcedureColumns( hstmt, (SQLCHAR *)ctName, (SQLSMALLINT)nmlen1, (SQLCHAR *)scName, (SQLSMALLINT)nmlen2, (SQLCHAR *)prName, (SQLSMALLINT)nmlen3, (SQLCHAR *)clName, (SQLSMALLINT)nmlen4, flag); @@ -807,7 +807,7 @@ RETCODE SQL_API SQLProceduresW(HSTMT hstmt, SQLWCHAR *szCatalogName, BOOL lower_id; UWORD flag = 0; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -823,7 +823,7 @@ RETCODE SQL_API SQLProceduresW(HSTMT hstmt, SQLWCHAR *szCatalogName, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_Procedures(hstmt, (SQLCHAR *)ctName, (SQLSMALLINT)nmlen1, + ret = OPENSEARCHAPI_Procedures(hstmt, (SQLCHAR *)ctName, (SQLSMALLINT)nmlen1, (SQLCHAR *)scName, (SQLSMALLINT)nmlen2, (SQLCHAR *)prName, (SQLSMALLINT)nmlen3, flag); LEAVE_STMT_CS(stmt); @@ -851,7 +851,7 @@ RETCODE SQL_API SQLTablePrivilegesW(HSTMT hstmt, SQLWCHAR *szCatalogName, BOOL lower_id; UWORD flag = 0; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -867,7 +867,7 @@ RETCODE SQL_API SQLTablePrivilegesW(HSTMT hstmt, SQLWCHAR *szCatalogName, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_TablePrivileges( + ret = OPENSEARCHAPI_TablePrivileges( hstmt, (SQLCHAR *)ctName, (SQLSMALLINT)nmlen1, (SQLCHAR *)scName, (SQLSMALLINT)nmlen2, (SQLCHAR *)tbName, (SQLSMALLINT)nmlen3, flag); LEAVE_STMT_CS((StatementClass *)hstmt); @@ -886,7 +886,7 @@ RETCODE SQL_API SQLGetTypeInfoW(SQLHSTMT StatementHandle, RETCODE ret; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -895,7 +895,7 @@ RETCODE SQL_API SQLGetTypeInfoW(SQLHSTMT StatementHandle, if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else - ret = ESAPI_GetTypeInfo(StatementHandle, DataType); + ret = OPENSEARCHAPI_GetTypeInfo(StatementHandle, DataType); LEAVE_STMT_CS(stmt); return ret; } @@ -919,7 +919,7 @@ SQLRETURN SQL_API SQLColAttributesW(SQLHSTMT hstmt, SQLUSMALLINT iCol, SQLSMALLINT *rgbL, blen = 0, bMax; char *rgbD = NULL, *rgbDt; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (SC_connection_lost_check(stmt, __FUNCTION__)) return SQL_ERROR; @@ -947,7 +947,7 @@ SQLRETURN SQL_API SQLColAttributesW(SQLHSTMT hstmt, SQLUSMALLINT iCol, break; } rgbD = rgbDt; - ret = ESAPI_ColAttributes(hstmt, iCol, iField, rgbD, bMax, rgbL, + ret = OPENSEARCHAPI_ColAttributes(hstmt, iCol, iField, rgbD, bMax, rgbL, pNumAttr); if (SQL_SUCCESS_WITH_INFO != ret || blen < bMax) break; @@ -972,7 +972,7 @@ SQLRETURN SQL_API SQLColAttributesW(SQLHSTMT hstmt, SQLUSMALLINT iCol, rgbD = pCharAttr; bMax = cbCharAttrMax; rgbL = pcbCharAttr; - ret = ESAPI_ColAttributes(hstmt, iCol, iField, rgbD, bMax, rgbL, + ret = OPENSEARCHAPI_ColAttributes(hstmt, iCol, iField, rgbD, bMax, rgbL, pNumAttr); break; } @@ -988,8 +988,8 @@ RETCODE SQL_API SQLGetConnectOptionW(HDBC ConnectionHandle, SQLUSMALLINT Option, ENTER_CONN_CS(conn); CC_clear_error(conn); - MYLOG(ES_TRACE, "entering " FORMAT_UINTEGER "\n", Option); - ret = ESAPI_GetConnectOption(ConnectionHandle, Option, Value, NULL, 0); + MYLOG(OPENSEARCH_TRACE, "entering " FORMAT_UINTEGER "\n", Option); + ret = OPENSEARCHAPI_GetConnectOption(ConnectionHandle, Option, Value, NULL, 0); LEAVE_CONN_CS(conn); return ret; } @@ -999,10 +999,10 @@ RETCODE SQL_API SQLSetConnectOptionW(HDBC ConnectionHandle, SQLUSMALLINT Option, ConnectionClass *conn = (ConnectionClass *)ConnectionHandle; RETCODE ret; - MYLOG(ES_TRACE, "entering " FORMAT_INTEGER "\n", Option); + MYLOG(OPENSEARCH_TRACE, "entering " FORMAT_INTEGER "\n", Option); ENTER_CONN_CS(conn); CC_clear_error(conn); - ret = ESAPI_SetConnectOption(ConnectionHandle, Option, Value); + ret = OPENSEARCHAPI_SetConnectOption(ConnectionHandle, Option, Value); LEAVE_CONN_CS(conn); return ret; } @@ -1017,7 +1017,7 @@ RETCODE SQL_API SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLSMALLINT RecNumber = 1; char qstr_ansi[8], *mtxt = NULL; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); buflen = 0; if (MessageText && BufferLength > 0) { buflen = BufferLength; @@ -1025,14 +1025,14 @@ RETCODE SQL_API SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, } if (StatementHandle) { - ret = ESAPI_StmtError(StatementHandle, RecNumber, (SQLCHAR *)qstr_ansi, + ret = OPENSEARCHAPI_StmtError(StatementHandle, RecNumber, (SQLCHAR *)qstr_ansi, NativeError, (SQLCHAR *)mtxt, buflen, &tlen, 0); } else if (ConnectionHandle) { - ret = ESAPI_ConnectError(ConnectionHandle, RecNumber, + ret = OPENSEARCHAPI_ConnectError(ConnectionHandle, RecNumber, (SQLCHAR *)qstr_ansi, NativeError, (SQLCHAR *)mtxt, buflen, &tlen, 0); } else if (EnvironmentHandle) { - ret = ESAPI_EnvError(EnvironmentHandle, RecNumber, (SQLCHAR *)qstr_ansi, + ret = OPENSEARCHAPI_EnvError(EnvironmentHandle, RecNumber, (SQLCHAR *)qstr_ansi, NativeError, (SQLCHAR *)mtxt, buflen, &tlen, 0); } else { ret = SQL_ERROR; diff --git a/sql-odbc/src/odfesqlodbc/es_api30.c b/sql-odbc/src/odfesqlodbc/opensearch_api30.c similarity index 93% rename from sql-odbc/src/odfesqlodbc/es_api30.c rename to sql-odbc/src/odfesqlodbc/opensearch_api30.c index cd2571506d..c1114fcb82 100644 --- a/sql-odbc/src/odfesqlodbc/es_api30.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_api30.c @@ -20,44 +20,44 @@ #include "descriptor.h" #include "dlg_specific.h" #include "environ.h" -#include "es_apifunc.h" -#include "es_connection.h" -#include "es_odbc.h" +#include "opensearch_odbc.h" #include "loadlib.h" #include "misc.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" /* SQLError -> SQLDiagRec */ -RETCODE SQL_API ESAPI_GetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, +RETCODE SQL_API OPENSEARCHAPI_GetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText, SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) { RETCODE ret; - MYLOG(ES_TRACE, "entering type=%d rec=%d\n", HandleType, RecNumber); + MYLOG(OPENSEARCH_TRACE, "entering type=%d rec=%d\n", HandleType, RecNumber); switch (HandleType) { case SQL_HANDLE_ENV: - ret = ESAPI_EnvError(Handle, RecNumber, Sqlstate, NativeError, + ret = OPENSEARCHAPI_EnvError(Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength, 0); break; case SQL_HANDLE_DBC: - ret = ESAPI_ConnectError(Handle, RecNumber, Sqlstate, NativeError, + ret = OPENSEARCHAPI_ConnectError(Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength, 0); break; case SQL_HANDLE_STMT: - ret = ESAPI_StmtError(Handle, RecNumber, Sqlstate, NativeError, + ret = OPENSEARCHAPI_StmtError(Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength, 0); break; case SQL_HANDLE_DESC: - ret = ESAPI_DescError(Handle, RecNumber, Sqlstate, NativeError, + ret = OPENSEARCHAPI_DescError(Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength, 0); break; default: ret = SQL_ERROR; } - MYLOG(ES_TRACE, "leaving %d\n", ret); + MYLOG(OPENSEARCH_TRACE, "leaving %d\n", ret); return ret; } @@ -65,7 +65,7 @@ RETCODE SQL_API ESAPI_GetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, * Minimal implementation. * */ -RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, +RETCODE SQL_API OPENSEARCHAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier, PTR DiagInfoPtr, SQLSMALLINT BufferLength, @@ -78,7 +78,7 @@ RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, ssize_t rtnlen = -1; int rtnctype = SQL_C_CHAR; - MYLOG(ES_TRACE, "entering rec=%d\n", RecNumber); + MYLOG(OPENSEARCH_TRACE, "entering rec=%d\n", RecNumber); switch (HandleType) { case SQL_HANDLE_ENV: switch (DiagIdentifier) { @@ -94,19 +94,19 @@ RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, ret = SQL_SUCCESS_WITH_INFO; break; case SQL_DIAG_MESSAGE_TEXT: - ret = ESAPI_EnvError(Handle, RecNumber, NULL, NULL, + ret = OPENSEARCHAPI_EnvError(Handle, RecNumber, NULL, NULL, DiagInfoPtr, BufferLength, StringLengthPtr, 0); break; case SQL_DIAG_NATIVE: rtnctype = SQL_C_LONG; - ret = ESAPI_EnvError(Handle, RecNumber, NULL, + ret = OPENSEARCHAPI_EnvError(Handle, RecNumber, NULL, (SQLINTEGER *)DiagInfoPtr, NULL, 0, NULL, 0); break; case SQL_DIAG_NUMBER: rtnctype = SQL_C_LONG; - ret = ESAPI_EnvError(Handle, RecNumber, NULL, NULL, NULL, 0, + ret = OPENSEARCHAPI_EnvError(Handle, RecNumber, NULL, NULL, NULL, 0, NULL, 0); if (SQL_SUCCEEDED(ret)) { *((SQLINTEGER *)DiagInfoPtr) = 1; @@ -114,7 +114,7 @@ RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, break; case SQL_DIAG_SQLSTATE: rtnlen = 5; - ret = ESAPI_EnvError(Handle, RecNumber, DiagInfoPtr, NULL, + ret = OPENSEARCHAPI_EnvError(Handle, RecNumber, DiagInfoPtr, NULL, NULL, 0, NULL, 0); if (SQL_SUCCESS_WITH_INFO == ret) ret = SQL_SUCCESS; @@ -153,19 +153,19 @@ RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, ret = SQL_SUCCESS_WITH_INFO; break; case SQL_DIAG_MESSAGE_TEXT: - ret = ESAPI_ConnectError(Handle, RecNumber, NULL, NULL, + ret = OPENSEARCHAPI_ConnectError(Handle, RecNumber, NULL, NULL, DiagInfoPtr, BufferLength, StringLengthPtr, 0); break; case SQL_DIAG_NATIVE: rtnctype = SQL_C_LONG; - ret = ESAPI_ConnectError(Handle, RecNumber, NULL, + ret = OPENSEARCHAPI_ConnectError(Handle, RecNumber, NULL, (SQLINTEGER *)DiagInfoPtr, NULL, 0, NULL, 0); break; case SQL_DIAG_NUMBER: rtnctype = SQL_C_LONG; - ret = ESAPI_ConnectError(Handle, RecNumber, NULL, NULL, + ret = OPENSEARCHAPI_ConnectError(Handle, RecNumber, NULL, NULL, NULL, 0, NULL, 0); if (SQL_SUCCEEDED(ret)) { *((SQLINTEGER *)DiagInfoPtr) = 1; @@ -173,7 +173,7 @@ RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, break; case SQL_DIAG_SQLSTATE: rtnlen = 5; - ret = ESAPI_ConnectError(Handle, RecNumber, DiagInfoPtr, + ret = OPENSEARCHAPI_ConnectError(Handle, RecNumber, DiagInfoPtr, NULL, NULL, 0, NULL, 0); if (SQL_SUCCESS_WITH_INFO == ret) ret = SQL_SUCCESS; @@ -212,13 +212,13 @@ RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, ret = SQL_SUCCESS_WITH_INFO; break; case SQL_DIAG_MESSAGE_TEXT: - ret = ESAPI_StmtError(Handle, RecNumber, NULL, NULL, + ret = OPENSEARCHAPI_StmtError(Handle, RecNumber, NULL, NULL, DiagInfoPtr, BufferLength, StringLengthPtr, 0); break; case SQL_DIAG_NATIVE: rtnctype = SQL_C_LONG; - ret = ESAPI_StmtError(Handle, RecNumber, NULL, + ret = OPENSEARCHAPI_StmtError(Handle, RecNumber, NULL, (SQLINTEGER *)DiagInfoPtr, NULL, 0, NULL, 0); break; @@ -227,16 +227,16 @@ RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, *((SQLINTEGER *)DiagInfoPtr) = 0; ret = SQL_NO_DATA_FOUND; stmt = (StatementClass *)Handle; - rtn = ESAPI_StmtError(Handle, -1, NULL, NULL, NULL, 0, + rtn = OPENSEARCHAPI_StmtError(Handle, -1, NULL, NULL, NULL, 0, &pcbErrm, 0); switch (rtn) { case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO: ret = SQL_SUCCESS; - if (pcbErrm > 0 && stmt->eserror) + if (pcbErrm > 0 && stmt->opensearch_error) *((SQLINTEGER *)DiagInfoPtr) = - (pcbErrm - 1) / stmt->eserror->recsize + 1; + (pcbErrm - 1) / stmt->opensearch_error->recsize + 1; break; default: break; @@ -244,7 +244,7 @@ RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, break; case SQL_DIAG_SQLSTATE: rtnlen = 5; - ret = ESAPI_StmtError(Handle, RecNumber, DiagInfoPtr, NULL, + ret = OPENSEARCHAPI_StmtError(Handle, RecNumber, DiagInfoPtr, NULL, NULL, 0, NULL, 0); if (SQL_SUCCESS_WITH_INFO == ret) ret = SQL_SUCCESS; @@ -265,7 +265,7 @@ RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, rc = QR_get_num_total_tuples(res) - res->dl_count; } *((SQLLEN *)DiagInfoPtr) = rc; - MYLOG(ES_ALL, "rc=" FORMAT_LEN "\n", rc); + MYLOG(OPENSEARCH_ALL, "rc=" FORMAT_LEN "\n", rc); ret = SQL_SUCCESS; break; case SQL_DIAG_ROW_COUNT: @@ -317,7 +317,7 @@ RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, break; case SQL_DIAG_SQLSTATE: rtnlen = 5; - ret = ESAPI_DescError(Handle, RecNumber, DiagInfoPtr, NULL, + ret = OPENSEARCHAPI_DescError(Handle, RecNumber, DiagInfoPtr, NULL, NULL, 0, NULL, 0); if (SQL_SUCCESS_WITH_INFO == ret) ret = SQL_SUCCESS; @@ -351,12 +351,12 @@ RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, if (StringLengthPtr) *StringLengthPtr = (SQLSMALLINT)rtnlen; } - MYLOG(ES_TRACE, "leaving %d\n", ret); + MYLOG(OPENSEARCH_TRACE, "leaving %d\n", ret); return ret; } /* SQLGetConnectOption -> SQLGetconnectAttr */ -RETCODE SQL_API ESAPI_GetConnectAttr(HDBC ConnectionHandle, +RETCODE SQL_API OPENSEARCHAPI_GetConnectAttr(HDBC ConnectionHandle, SQLINTEGER Attribute, PTR Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength) { @@ -364,7 +364,7 @@ RETCODE SQL_API ESAPI_GetConnectAttr(HDBC ConnectionHandle, RETCODE ret = SQL_SUCCESS; SQLINTEGER len = 4; - MYLOG(ES_TRACE, "entering " FORMAT_INTEGER "\n", Attribute); + MYLOG(OPENSEARCH_TRACE, "entering " FORMAT_INTEGER "\n", Attribute); switch (Attribute) { case SQL_ATTR_ASYNC_ENABLE: *((SQLINTEGER *)Value) = SQL_ASYNC_ENABLE_OFF; @@ -388,7 +388,7 @@ RETCODE SQL_API ESAPI_GetConnectAttr(HDBC ConnectionHandle, *((SQLINTEGER *)Value) = conn->connInfo.drivers.loglevel; break; default: - ret = ESAPI_GetConnectOption(ConnectionHandle, (UWORD)Attribute, + ret = OPENSEARCHAPI_GetConnectOption(ConnectionHandle, (UWORD)Attribute, Value, &len, BufferLength); } if (StringLength) @@ -636,13 +636,13 @@ static RETCODE SQL_API APDSetField(DescriptorClass *desc, SQLSMALLINT RecNumber, break; } if (RecNumber <= 0) { - MYLOG(ES_ALL, "RecN=%d allocated=%d\n", RecNumber, opts->allocated); + MYLOG(OPENSEARCH_ALL, "RecN=%d allocated=%d\n", RecNumber, opts->allocated); DC_set_error(desc, DESC_BAD_PARAMETER_NUMBER_ERROR, "bad parameter number"); return SQL_ERROR; } if (RecNumber > opts->allocated) { - MYLOG(ES_ALL, "RecN=%d allocated=%d\n", RecNumber, opts->allocated); + MYLOG(OPENSEARCH_ALL, "RecN=%d allocated=%d\n", RecNumber, opts->allocated); parameter_bindings_set(opts, RecNumber, TRUE); /* DC_set_error(desc, DESC_BAD_PARAMETER_NUMBER_ERROR, "bad parameter number"); @@ -801,7 +801,7 @@ static RETCODE SQL_API IPDSetField(DescriptorClass *desc, SQLSMALLINT RecNumber, break; } if (RecNumber <= 0 || RecNumber > ipdopts->allocated) { - MYLOG(ES_ALL, "RecN=%d allocated=%d\n", RecNumber, ipdopts->allocated); + MYLOG(OPENSEARCH_ALL, "RecN=%d allocated=%d\n", RecNumber, ipdopts->allocated); DC_set_error(desc, DESC_BAD_PARAMETER_NUMBER_ERROR, "bad parameter number"); return SQL_ERROR; @@ -1073,7 +1073,7 @@ static RETCODE SQL_API APDGetField(DescriptorClass *desc, SQLSMALLINT RecNumber, break; default: if (RecNumber <= 0 || RecNumber > opts->allocated) { - MYLOG(ES_ALL, "RecN=%d allocated=%d\n", RecNumber, + MYLOG(OPENSEARCH_ALL, "RecN=%d allocated=%d\n", RecNumber, opts->allocated); DC_set_error(desc, DESC_BAD_PARAMETER_NUMBER_ERROR, "bad parameter number"); @@ -1281,7 +1281,7 @@ static RETCODE SQL_API IRDGetField(DescriptorClass *desc, SQLSMALLINT RecNumber, StatementClass *stmt; stmt = opts->stmt; - ret = ESAPI_ColAttributes(stmt, RecNumber, FieldIdentifier, Value, + ret = OPENSEARCHAPI_ColAttributes(stmt, RecNumber, FieldIdentifier, Value, (SQLSMALLINT)BufferLength, &pcbL, &ival); len = pcbL; } @@ -1330,7 +1330,7 @@ static RETCODE SQL_API IPDGetField(DescriptorClass *desc, SQLSMALLINT RecNumber, break; default: if (RecNumber <= 0 || RecNumber > ipdopts->allocated) { - MYLOG(ES_ALL, "RecN=%d allocated=%d\n", RecNumber, + MYLOG(OPENSEARCH_ALL, "RecN=%d allocated=%d\n", RecNumber, ipdopts->allocated); DC_set_error(desc, DESC_BAD_PARAMETER_NUMBER_ERROR, "bad parameter number"); @@ -1455,15 +1455,15 @@ static RETCODE SQL_API IPDGetField(DescriptorClass *desc, SQLSMALLINT RecNumber, } /* SQLGetStmtOption -> SQLGetStmtAttr */ -RETCODE SQL_API ESAPI_GetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, +RETCODE SQL_API OPENSEARCHAPI_GetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, PTR Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength) { - CSTR func = "ESAPI_GetStmtAttr"; + CSTR func = "OPENSEARCHAPI_GetStmtAttr"; StatementClass *stmt = (StatementClass *)StatementHandle; RETCODE ret = SQL_SUCCESS; SQLINTEGER len = 0; - MYLOG(ES_TRACE, "entering Handle=%p " FORMAT_INTEGER "\n", StatementHandle, + MYLOG(OPENSEARCH_TRACE, "entering Handle=%p " FORMAT_INTEGER "\n", StatementHandle, Attribute); switch (Attribute) { case SQL_ATTR_FETCH_BOOKMARK_PTR: /* 16 */ @@ -1549,7 +1549,7 @@ RETCODE SQL_API ESAPI_GetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, "Unsupported statement option (Get)", func); return SQL_ERROR; default: - ret = ESAPI_GetStmtOption(StatementHandle, (SQLSMALLINT)Attribute, + ret = OPENSEARCHAPI_GetStmtOption(StatementHandle, (SQLSMALLINT)Attribute, Value, &len, BufferLength); } if (ret == SQL_SUCCESS && StringLength) @@ -1558,17 +1558,17 @@ RETCODE SQL_API ESAPI_GetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, } /* SQLSetConnectOption -> SQLSetConnectAttr */ -RETCODE SQL_API ESAPI_SetConnectAttr(HDBC ConnectionHandle, +RETCODE SQL_API OPENSEARCHAPI_SetConnectAttr(HDBC ConnectionHandle, SQLINTEGER Attribute, PTR Value, SQLINTEGER StringLength) { UNUSED(StringLength); - CSTR func = "ESAPI_SetConnectAttr"; + CSTR func = "OPENSEARCHAPI_SetConnectAttr"; ConnectionClass *conn = (ConnectionClass *)ConnectionHandle; RETCODE ret = SQL_SUCCESS; BOOL unsupported = FALSE; int newValue; - MYLOG(ES_TRACE, "entering for %p: " FORMAT_INTEGER " %p\n", + MYLOG(OPENSEARCH_TRACE, "entering for %p: " FORMAT_INTEGER " %p\n", ConnectionHandle, Attribute, Value); switch (Attribute) { case SQL_ATTR_METADATA_ID: @@ -1576,11 +1576,11 @@ RETCODE SQL_API ESAPI_SetConnectAttr(HDBC ConnectionHandle, break; case SQL_ATTR_ANSI_APP: if (SQL_AA_FALSE != CAST_PTR(SQLINTEGER, Value)) { - MYLOG(ES_DEBUG, "the application is ansi\n"); + MYLOG(OPENSEARCH_DEBUG, "the application is ansi\n"); if (CC_is_in_unicode_driver(conn)) /* the driver is unicode */ CC_set_in_ansi_app(conn); /* but the app is ansi */ } else { - MYLOG(ES_DEBUG, "the application is unicode\n"); + MYLOG(OPENSEARCH_DEBUG, "the application is unicode\n"); } /*return SQL_ERROR;*/ return SQL_SUCCESS; @@ -1602,10 +1602,10 @@ RETCODE SQL_API ESAPI_SetConnectAttr(HDBC ConnectionHandle, logs_on_off(-1, conn->connInfo.drivers.loglevel, 0); conn->connInfo.drivers.loglevel = (char)newValue; logs_on_off(1, conn->connInfo.drivers.loglevel, 0); - MYLOG(ES_DEBUG, "debug => %d\n", + MYLOG(OPENSEARCH_DEBUG, "debug => %d\n", conn->connInfo.drivers.loglevel); } else if (newValue == 0 && conn->connInfo.drivers.loglevel > 0) { - MYLOG(ES_DEBUG, "debug => %d\n", newValue); + MYLOG(OPENSEARCH_DEBUG, "debug => %d\n", newValue); logs_on_off(-1, conn->connInfo.drivers.loglevel, 0); conn->connInfo.drivers.loglevel = (char)newValue; logs_on_off(1, 0, 0); @@ -1617,10 +1617,10 @@ RETCODE SQL_API ESAPI_SetConnectAttr(HDBC ConnectionHandle, logs_on_off(-1, 0, conn->connInfo.drivers.loglevel); conn->connInfo.drivers.loglevel = (char)newValue; logs_on_off(1, 0, conn->connInfo.drivers.loglevel); - MYLOG(ES_DEBUG, "commlog => %d\n", + MYLOG(OPENSEARCH_DEBUG, "commlog => %d\n", conn->connInfo.drivers.loglevel); } else if (newValue == 0 && conn->connInfo.drivers.loglevel > 0) { - MYLOG(ES_DEBUG, "commlog => %d\n", newValue); + MYLOG(OPENSEARCH_DEBUG, "commlog => %d\n", newValue); logs_on_off(-1, 0, conn->connInfo.drivers.loglevel); conn->connInfo.drivers.loglevel = (char)newValue; logs_on_off(1, 0, 0); @@ -1628,7 +1628,7 @@ RETCODE SQL_API ESAPI_SetConnectAttr(HDBC ConnectionHandle, break; default: if (Attribute < 65536) - ret = ESAPI_SetConnectOption( + ret = OPENSEARCHAPI_SetConnectOption( ConnectionHandle, (SQLUSMALLINT)Attribute, (SQLLEN)Value); else unsupported = TRUE; @@ -1645,16 +1645,16 @@ RETCODE SQL_API ESAPI_SetConnectAttr(HDBC ConnectionHandle, } /* new function */ -RETCODE SQL_API ESAPI_GetDescField(SQLHDESC DescriptorHandle, +RETCODE SQL_API OPENSEARCHAPI_GetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, PTR Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength) { - CSTR func = "ESAPI_GetDescField"; + CSTR func = "OPENSEARCHAPI_GetDescField"; RETCODE ret = SQL_SUCCESS; DescriptorClass *desc = (DescriptorClass *)DescriptorHandle; - MYLOG(ES_TRACE, + MYLOG(OPENSEARCH_TRACE, "entering h=%p rec=" FORMAT_SMALLI " field=" FORMAT_SMALLI " blen=" FORMAT_INTEGER "\n", DescriptorHandle, RecNumber, FieldIdentifier, BufferLength); @@ -1704,15 +1704,15 @@ RETCODE SQL_API ESAPI_GetDescField(SQLHDESC DescriptorHandle, } /* new function */ -RETCODE SQL_API ESAPI_SetDescField(SQLHDESC DescriptorHandle, +RETCODE SQL_API OPENSEARCHAPI_SetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, PTR Value, SQLINTEGER BufferLength) { - CSTR func = "ESAPI_SetDescField"; + CSTR func = "OPENSEARCHAPI_SetDescField"; RETCODE ret = SQL_SUCCESS; DescriptorClass *desc = (DescriptorClass *)DescriptorHandle; - MYLOG(ES_TRACE, + MYLOG(OPENSEARCH_TRACE, "entering h=%p(%d) rec=" FORMAT_SMALLI " field=" FORMAT_SMALLI " val=%p," FORMAT_INTEGER "\n", DescriptorHandle, DC_get_desc_type(desc), RecNumber, FieldIdentifier, @@ -1764,14 +1764,14 @@ RETCODE SQL_API ESAPI_SetDescField(SQLHDESC DescriptorHandle, } /* SQLSet(Param/Scroll/Stmt)Option -> SQLSetStmtAttr */ -RETCODE SQL_API ESAPI_SetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, +RETCODE SQL_API OPENSEARCHAPI_SetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, PTR Value, SQLINTEGER StringLength) { UNUSED(StringLength); RETCODE ret = SQL_SUCCESS; - CSTR func = "ESAPI_SetStmtAttr"; + CSTR func = "OPENSEARCHAPI_SetStmtAttr"; StatementClass *stmt = (StatementClass *)StatementHandle; - MYLOG(ES_TRACE, + MYLOG(OPENSEARCH_TRACE, "entering Handle=%p " FORMAT_INTEGER "," FORMAT_ULEN "(%p)\n", StatementHandle, Attribute, (SQLULEN)Value, Value); switch (Attribute) { @@ -1804,7 +1804,7 @@ RETCODE SQL_API ESAPI_SetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, stmt->ard = &(stmt->ardi); } else { stmt->ard = (DescriptorClass *)Value; - MYLOG(ES_ALL, "set ard=%p\n", stmt->ard); + MYLOG(OPENSEARCH_ALL, "set ard=%p\n", stmt->ard); } break; case SQL_ATTR_APP_PARAM_DESC: /* 10011 */ @@ -1851,7 +1851,7 @@ RETCODE SQL_API ESAPI_SetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, SC_get_ARDF(stmt)->size_of_rowset = CAST_UPTR(SQLULEN, Value); break; default: - return ESAPI_SetStmtOption(StatementHandle, (SQLUSMALLINT)Attribute, + return OPENSEARCHAPI_SetStmtOption(StatementHandle, (SQLUSMALLINT)Attribute, (SQLULEN)Value); } return ret; diff --git a/sql-odbc/src/odfesqlodbc/es_apifunc.h b/sql-odbc/src/odfesqlodbc/opensearch_apifunc.h similarity index 70% rename from sql-odbc/src/odfesqlodbc/es_apifunc.h rename to sql-odbc/src/odfesqlodbc/opensearch_apifunc.h index 8a248abf4a..f5219ad99f 100644 --- a/sql-odbc/src/odfesqlodbc/es_apifunc.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_apifunc.h @@ -14,12 +14,13 @@ * */ -#ifndef _ES_API_FUNC_H__ -#define _ES_API_FUNC_H__ +#ifndef _OPENSEARCH_API_FUNC_H__ +#define _OPENSEARCH_API_FUNC_H__ #include #include -#include "es_odbc.h" + +#include "opensearch_odbc.h" #ifdef __cplusplus extern "C" { @@ -31,167 +32,167 @@ extern "C" { #define PODBC_SEARCH_BY_IDS (1L << 2) #define PODBC_SHOW_OID_COLUMN (1L << 3) #define PODBC_ROW_VERSIONING (1L << 4) -/* Internal flags for ESAPI_AllocStmt functions */ +/* Internal flags for OPENSEARCHAPI_AllocStmt functions */ #define PODBC_EXTERNAL_STATEMENT 1L /* visible to the driver manager */ #define PODBC_INHERIT_CONNECT_OPTIONS (1L << 1) -/* Internal flags for ESAPI_Exec... functions */ +/* Internal flags for OPENSEARCHAPI_Exec... functions */ /* Flags for the error handling */ #define PODBC_ALLOW_PARTIAL_EXTRACT 1L /* #define PODBC_ERROR_CLEAR (1L << 1) no longer used */ -RETCODE SQL_API ESAPI_AllocConnect(HENV EnvironmentHandle, +RETCODE SQL_API OPENSEARCHAPI_AllocConnect(HENV EnvironmentHandle, HDBC *ConnectionHandle); -RETCODE SQL_API ESAPI_AllocEnv(HENV *EnvironmentHandle); -RETCODE SQL_API ESAPI_AllocStmt(HDBC ConnectionHandle, HSTMT *StatementHandle, +RETCODE SQL_API OPENSEARCHAPI_AllocEnv(HENV *EnvironmentHandle); +RETCODE SQL_API OPENSEARCHAPI_AllocStmt(HDBC ConnectionHandle, HSTMT *StatementHandle, UDWORD flag); -RETCODE SQL_API ESAPI_BindCol(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, +RETCODE SQL_API OPENSEARCHAPI_BindCol(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, PTR TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind); -RETCODE SQL_API ESAPI_Connect(HDBC ConnectionHandle, const SQLCHAR *ServerName, +RETCODE SQL_API OPENSEARCHAPI_Connect(HDBC ConnectionHandle, const SQLCHAR *ServerName, SQLSMALLINT NameLength1, const SQLCHAR *UserName, SQLSMALLINT NameLength2, const SQLCHAR *Authentication, SQLSMALLINT NameLength3); -RETCODE SQL_API ESAPI_BrowseConnect(HDBC hdbc, const SQLCHAR *szConnStrIn, +RETCODE SQL_API OPENSEARCHAPI_BrowseConnect(HDBC hdbc, const SQLCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn, SQLCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT *pcbConnStrOut); -RETCODE SQL_API ESAPI_DescribeCol( +RETCODE SQL_API OPENSEARCHAPI_DescribeCol( HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName, SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType, SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable); -RETCODE SQL_API ESAPI_Disconnect(HDBC ConnectionHandle); +RETCODE SQL_API OPENSEARCHAPI_Disconnect(HDBC ConnectionHandle); /* Helper functions for Error handling */ -RETCODE SQL_API ESAPI_EnvError(HENV EnvironmentHandle, SQLSMALLINT RecNumber, +RETCODE SQL_API OPENSEARCHAPI_EnvError(HENV EnvironmentHandle, SQLSMALLINT RecNumber, SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText, SQLSMALLINT BufferLength, SQLSMALLINT *TextLength, UWORD flag); -RETCODE SQL_API ESAPI_ConnectError(HDBC ConnectionHandle, SQLSMALLINT RecNumber, +RETCODE SQL_API OPENSEARCHAPI_ConnectError(HDBC ConnectionHandle, SQLSMALLINT RecNumber, SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText, SQLSMALLINT BufferLength, SQLSMALLINT *TextLength, UWORD flag); -RETCODE SQL_API ESAPI_StmtError(HSTMT StatementHandle, SQLSMALLINT RecNumber, +RETCODE SQL_API OPENSEARCHAPI_StmtError(HSTMT StatementHandle, SQLSMALLINT RecNumber, SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText, SQLSMALLINT BufferLength, SQLSMALLINT *TextLength, UWORD flag); -RETCODE SQL_API ESAPI_ExecDirect(HSTMT StatementHandle, +RETCODE SQL_API OPENSEARCHAPI_ExecDirect(HSTMT StatementHandle, const SQLCHAR *StatementText, SQLINTEGER TextLength, BOOL commit); -RETCODE SQL_API ESAPI_Execute(HSTMT StatementHandle); -RETCODE SQL_API ESAPI_Fetch(HSTMT StatementHandle); -RETCODE SQL_API ESAPI_FreeConnect(HDBC ConnectionHandle); -RETCODE SQL_API ESAPI_FreeEnv(HENV EnvironmentHandle); -RETCODE SQL_API ESAPI_FreeStmt(HSTMT StatementHandle, SQLUSMALLINT Option); -RETCODE SQL_API ESAPI_GetConnectOption(HDBC ConnectionHandle, +RETCODE SQL_API OPENSEARCHAPI_Execute(HSTMT StatementHandle); +RETCODE SQL_API OPENSEARCHAPI_Fetch(HSTMT StatementHandle); +RETCODE SQL_API OPENSEARCHAPI_FreeConnect(HDBC ConnectionHandle); +RETCODE SQL_API OPENSEARCHAPI_FreeEnv(HENV EnvironmentHandle); +RETCODE SQL_API OPENSEARCHAPI_FreeStmt(HSTMT StatementHandle, SQLUSMALLINT Option); +RETCODE SQL_API OPENSEARCHAPI_GetConnectOption(HDBC ConnectionHandle, SQLUSMALLINT Option, PTR Value, SQLINTEGER *StringLength, SQLINTEGER BufferLength); -RETCODE SQL_API ESAPI_GetCursorName(HSTMT StatementHandle, SQLCHAR *CursorName, +RETCODE SQL_API OPENSEARCHAPI_GetCursorName(HSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT BufferLength, SQLSMALLINT *NameLength); -RETCODE SQL_API ESAPI_GetData(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, +RETCODE SQL_API OPENSEARCHAPI_GetData(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, PTR TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind); -RETCODE SQL_API ESAPI_GetFunctions(HDBC ConnectionHandle, +RETCODE SQL_API OPENSEARCHAPI_GetFunctions(HDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported); -RETCODE SQL_API ESAPI_GetFunctions30(HDBC ConnectionHandle, +RETCODE SQL_API OPENSEARCHAPI_GetFunctions30(HDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported); -RETCODE SQL_API ESAPI_GetInfo(HDBC ConnectionHandle, SQLUSMALLINT InfoType, +RETCODE SQL_API OPENSEARCHAPI_GetInfo(HDBC ConnectionHandle, SQLUSMALLINT InfoType, PTR InfoValue, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength); -RETCODE SQL_API ESAPI_GetStmtOption(HSTMT StatementHandle, SQLUSMALLINT Option, +RETCODE SQL_API OPENSEARCHAPI_GetStmtOption(HSTMT StatementHandle, SQLUSMALLINT Option, PTR Value, SQLINTEGER *StringLength, SQLINTEGER BufferLength); -RETCODE SQL_API ESAPI_NumResultCols(HSTMT StatementHandle, +RETCODE SQL_API OPENSEARCHAPI_NumResultCols(HSTMT StatementHandle, SQLSMALLINT *ColumnCount); -RETCODE SQL_API ESAPI_RowCount(HSTMT StatementHandle, SQLLEN *RowCount); -RETCODE SQL_API ESAPI_SetConnectOption(HDBC ConnectionHandle, +RETCODE SQL_API OPENSEARCHAPI_RowCount(HSTMT StatementHandle, SQLLEN *RowCount); +RETCODE SQL_API OPENSEARCHAPI_SetConnectOption(HDBC ConnectionHandle, SQLUSMALLINT Option, SQLULEN Value); -RETCODE SQL_API ESAPI_SetCursorName(HSTMT StatementHandle, +RETCODE SQL_API OPENSEARCHAPI_SetCursorName(HSTMT StatementHandle, const SQLCHAR *CursorName, SQLSMALLINT NameLength); -RETCODE SQL_API ESAPI_SetStmtOption(HSTMT StatementHandle, SQLUSMALLINT Option, +RETCODE SQL_API OPENSEARCHAPI_SetStmtOption(HSTMT StatementHandle, SQLUSMALLINT Option, SQLULEN Value); RETCODE SQL_API -ESAPI_SpecialColumns(HSTMT StatementHandle, SQLUSMALLINT IdentifierType, +OPENSEARCHAPI_SpecialColumns(HSTMT StatementHandle, SQLUSMALLINT IdentifierType, const SQLCHAR *CatalogName, SQLSMALLINT NameLength1, const SQLCHAR *SchemaName, SQLSMALLINT NameLength2, const SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Scope, SQLUSMALLINT Nullable); -RETCODE SQL_API ESAPI_Statistics( +RETCODE SQL_API OPENSEARCHAPI_Statistics( HSTMT StatementHandle, const SQLCHAR *CatalogName, SQLSMALLINT NameLength1, const SQLCHAR *SchemaName, SQLSMALLINT NameLength2, const SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved); -RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, +RETCODE SQL_API OPENSEARCHAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, PTR rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc, SQLLEN *pfDesc); -RETCODE SQL_API ESAPI_Prepare(HSTMT hstmt, const SQLCHAR *szSqlStr, +RETCODE SQL_API OPENSEARCHAPI_Prepare(HSTMT hstmt, const SQLCHAR *szSqlStr, SQLINTEGER cbSqlStr); -RETCODE SQL_API ESAPI_ColumnPrivileges( +RETCODE SQL_API OPENSEARCHAPI_ColumnPrivileges( HSTMT hstmt, const SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, const SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, const SQLCHAR *szTableName, SQLSMALLINT cbTableName, const SQLCHAR *szColumnName, SQLSMALLINT cbColumnName, UWORD flag); -RETCODE SQL_API ESAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, +RETCODE SQL_API OPENSEARCHAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, SQLLEN irow, SQLULEN *pcrow, SQLUSMALLINT *rgfRowStatus, SQLLEN FetchOffset, SQLLEN rowsetSize); -RETCODE SQL_API ESAPI_ForeignKeys( +RETCODE SQL_API OPENSEARCHAPI_ForeignKeys( HSTMT hstmt, const SQLCHAR *szPkCatalogName, SQLSMALLINT cbPkCatalogName, const SQLCHAR *szPkSchemaName, SQLSMALLINT cbPkSchemaName, const SQLCHAR *szPkTableName, SQLSMALLINT cbPkTableName, const SQLCHAR *szFkCatalogName, SQLSMALLINT cbFkCatalogName, const SQLCHAR *szFkSchemaName, SQLSMALLINT cbFkSchemaName, const SQLCHAR *szFkTableName, SQLSMALLINT cbFkTableName); -RETCODE SQL_API ESAPI_MoreResults(HSTMT hstmt); -RETCODE SQL_API ESAPI_NativeSql(HDBC hdbc, const SQLCHAR *szSqlStrIn, +RETCODE SQL_API OPENSEARCHAPI_MoreResults(HSTMT hstmt); +RETCODE SQL_API OPENSEARCHAPI_NativeSql(HDBC hdbc, const SQLCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR *szSqlStr, SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr); -RETCODE SQL_API ESAPI_NumParams(HSTMT hstmt, SQLSMALLINT *pcpar); -RETCODE SQL_API ESAPI_PrimaryKeys(HSTMT hstmt, const SQLCHAR *szCatalogName, +RETCODE SQL_API OPENSEARCHAPI_NumParams(HSTMT hstmt, SQLSMALLINT *pcpar); +RETCODE SQL_API OPENSEARCHAPI_PrimaryKeys(HSTMT hstmt, const SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, const SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, const SQLCHAR *szTableName, SQLSMALLINT cbTableName, OID reloid); -RETCODE SQL_API ESAPI_ProcedureColumns( +RETCODE SQL_API OPENSEARCHAPI_ProcedureColumns( HSTMT hstmt, const SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, const SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, const SQLCHAR *szProcName, SQLSMALLINT cbProcName, const SQLCHAR *szColumnName, SQLSMALLINT cbColumnName, UWORD flag); -RETCODE SQL_API ESAPI_Procedures(HSTMT hstmt, const SQLCHAR *szCatalogName, +RETCODE SQL_API OPENSEARCHAPI_Procedures(HSTMT hstmt, const SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, const SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, const SQLCHAR *szProcName, SQLSMALLINT cbProcName, UWORD flag); -RETCODE SQL_API ESAPI_TablePrivileges(HSTMT hstmt, const SQLCHAR *szCatalogName, +RETCODE SQL_API OPENSEARCHAPI_TablePrivileges(HSTMT hstmt, const SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, const SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, const SQLCHAR *szTableName, SQLSMALLINT cbTableName, UWORD flag); -RETCODE SQL_API ESAPI_GetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, +RETCODE SQL_API OPENSEARCHAPI_GetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText, SQLSMALLINT BufferLength, SQLSMALLINT *TextLength); -RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, +RETCODE SQL_API OPENSEARCHAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier, PTR DiagInfoPtr, SQLSMALLINT BufferLength, SQLSMALLINT *StringLengthPtr); -RETCODE SQL_API ESAPI_GetConnectAttr(HDBC ConnectionHandle, +RETCODE SQL_API OPENSEARCHAPI_GetConnectAttr(HDBC ConnectionHandle, SQLINTEGER Attribute, PTR Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength); -RETCODE SQL_API ESAPI_GetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, +RETCODE SQL_API OPENSEARCHAPI_GetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, PTR Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength); @@ -212,26 +213,26 @@ enum { SQL_ATTR_ESOPT_WCSDEBUG = 65548, SQL_ATTR_ESOPT_MSJET = 65549 }; -RETCODE SQL_API ESAPI_SetConnectAttr(HDBC ConnectionHandle, +RETCODE SQL_API OPENSEARCHAPI_SetConnectAttr(HDBC ConnectionHandle, SQLINTEGER Attribute, PTR Value, SQLINTEGER StringLength); -RETCODE SQL_API ESAPI_SetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, +RETCODE SQL_API OPENSEARCHAPI_SetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, PTR Value, SQLINTEGER StringLength); -RETCODE SQL_API ESAPI_AllocDesc(HDBC ConnectionHandle, +RETCODE SQL_API OPENSEARCHAPI_AllocDesc(HDBC ConnectionHandle, SQLHDESC *DescriptorHandle); -RETCODE SQL_API ESAPI_FreeDesc(SQLHDESC DescriptorHandle); -RETCODE SQL_API ESAPI_CopyDesc(SQLHDESC SourceDescHandle, +RETCODE SQL_API OPENSEARCHAPI_FreeDesc(SQLHDESC DescriptorHandle); +RETCODE SQL_API OPENSEARCHAPI_CopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle); -RETCODE SQL_API ESAPI_SetDescField(SQLHDESC DescriptorHandle, +RETCODE SQL_API OPENSEARCHAPI_SetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, PTR Value, SQLINTEGER BufferLength); -RETCODE SQL_API ESAPI_GetDescField(SQLHDESC DescriptorHandle, +RETCODE SQL_API OPENSEARCHAPI_GetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, PTR Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength); -RETCODE SQL_API ESAPI_DescError(SQLHDESC DescriptorHandle, +RETCODE SQL_API OPENSEARCHAPI_DescError(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText, SQLSMALLINT BufferLength, @@ -240,4 +241,4 @@ RETCODE SQL_API ESAPI_DescError(SQLHDESC DescriptorHandle, #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* define_ES_API_FUNC_H__ */ +#endif /* define_OPENSEARCH_API_FUNC_H__ */ diff --git a/sql-odbc/src/odfesqlodbc/es_communication.cpp b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp similarity index 81% rename from sql-odbc/src/odfesqlodbc/es_communication.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_communication.cpp index e40f170c79..f9cde1b5dc 100644 --- a/sql-odbc/src/odfesqlodbc/es_communication.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp @@ -14,12 +14,12 @@ * */ -#include "es_communication.h" +#include "opensearch_communication.h" // odfesqlodbc needs to be included before mylog, otherwise mylog will generate // compiler warnings // clang-format off -#include "es_odbc.h" +#include "opensearch_odbc.h" #include "mylog.h" #include #include @@ -39,11 +39,11 @@ static const std::string PLUGIN_ENDPOINT_FORMAT_JSON = static const std::string OPENDISTRO_SQL_PLUGIN_NAME = "opendistro-sql"; static const std::string ALLOCATION_TAG = "AWS_SIGV4_AUTH"; static const std::string SERVICE_NAME = "es"; -static const std::string ESODBC_PROFILE_NAME = "elasticsearchodbc"; +static const std::string ESODBC_PROFILE_NAME = "opensearchodbc"; static const std::string ERROR_MSG_PREFIX = - "[Open Distro For Elasticsearch][SQL ODBC Driver][SQL Plugin] "; + "[OpenSearch][SQL ODBC Driver][SQL Plugin] "; static const std::string JSON_SCHEMA = - "{" // This was generated from the example elasticsearch data + "{" // This was generated from the example OpenSearch data "\"type\": \"object\"," "\"properties\": {" "\"schema\": {" @@ -69,7 +69,7 @@ static const std::string JSON_SCHEMA = "\"required\": [\"schema\", \"total\", \"datarows\", \"size\", \"status\"]" "}"; static const std::string CURSOR_JSON_SCHEMA = - "{" // This was generated from the example elasticsearch data + "{" // This was generated from the example OpenSearch data "\"type\": \"object\"," "\"properties\": {" "\"cursor\": { \"type\": \"string\" }," @@ -109,7 +109,7 @@ static const std::string ERROR_RESPONSE_SCHEMA = R"EOF( } )EOF"; -void ESCommunication::AwsHttpResponseToString( +void OpenSearchCommunication::AwsHttpResponseToString( std::shared_ptr< Aws::Http::HttpResponse > response, std::string& output) { // This function has some unconventional stream operations because we need // performance over readability here. Equivalent code done in conventional @@ -131,49 +131,51 @@ void ESCommunication::AwsHttpResponseToString( output.assign(buf.data(), avail); } -void ESCommunication::PrepareCursorResult(ESResult& es_result) { +void OpenSearchCommunication::PrepareCursorResult(OpenSearchResult& opensearch_result) { // Prepare document and validate result try { - LogMsg(ES_DEBUG, "Parsing result JSON with cursor."); - es_result.es_result_doc.parse(es_result.result_json, + LogMsg(OPENSEARCH_DEBUG, "Parsing result JSON with cursor."); + opensearch_result.opensearch_result_doc.parse( + opensearch_result.result_json, CURSOR_JSON_SCHEMA); } catch (const rabbit::parse_error& e) { // The exception rabbit gives is quite useless - providing the json // will aid debugging for users std::string str = "Exception obtained '" + std::string(e.what()) + "' when parsing json string '" - + es_result.result_json + "'."; + + opensearch_result.result_json + "'."; throw std::runtime_error(str.c_str()); } } -std::shared_ptr< ErrorDetails > ESCommunication::ParseErrorResponse( - ESResult& es_result) { +std::shared_ptr< ErrorDetails > OpenSearchCommunication::ParseErrorResponse( + OpenSearchResult& opensearch_result) { // Prepare document and validate schema try { - LogMsg(ES_DEBUG, "Parsing error response (with schema validation)"); - es_result.es_result_doc.parse(es_result.result_json, + LogMsg(OPENSEARCH_DEBUG, "Parsing error response (with schema validation)"); + opensearch_result.opensearch_result_doc.parse( + opensearch_result.result_json, ERROR_RESPONSE_SCHEMA); auto error_details = std::make_shared< ErrorDetails >(); error_details->reason = - es_result.es_result_doc["error"]["reason"].as_string(); + opensearch_result.opensearch_result_doc["error"]["reason"].as_string(); error_details->details = - es_result.es_result_doc["error"]["details"].as_string(); + opensearch_result.opensearch_result_doc["error"]["details"].as_string(); error_details->source_type = - es_result.es_result_doc["error"]["type"].as_string(); + opensearch_result.opensearch_result_doc["error"]["type"].as_string(); return error_details; } catch (const rabbit::parse_error& e) { // The exception rabbit gives is quite useless - providing the json // will aid debugging for users std::string str = "Exception obtained '" + std::string(e.what()) + "' when parsing json string '" - + es_result.result_json + "'."; + + opensearch_result.result_json + "'."; throw std::runtime_error(str.c_str()); } } -void ESCommunication::SetErrorDetails(std::string reason, std::string message, +void OpenSearchCommunication::SetErrorDetails(std::string reason, std::string message, ConnErrorType error_type) { // Prepare document and validate schema auto error_details = std::make_shared< ErrorDetails >(); @@ -184,28 +186,29 @@ void ESCommunication::SetErrorDetails(std::string reason, std::string message, m_error_details = error_details; } -void ESCommunication::SetErrorDetails(ErrorDetails details) { +void OpenSearchCommunication::SetErrorDetails(ErrorDetails details) { // Prepare document and validate schema auto error_details = std::make_shared< ErrorDetails >(details); m_error_details = error_details; } -void ESCommunication::GetJsonSchema(ESResult& es_result) { +void OpenSearchCommunication::GetJsonSchema(OpenSearchResult& opensearch_result) { // Prepare document and validate schema try { - LogMsg(ES_DEBUG, "Parsing result JSON with schema."); - es_result.es_result_doc.parse(es_result.result_json, JSON_SCHEMA); + LogMsg(OPENSEARCH_DEBUG, "Parsing result JSON with schema."); + opensearch_result.opensearch_result_doc.parse( + opensearch_result.result_json, JSON_SCHEMA); } catch (const rabbit::parse_error& e) { // The exception rabbit gives is quite useless - providing the json // will aid debugging for users std::string str = "Exception obtained '" + std::string(e.what()) + "' when parsing json string '" - + es_result.result_json + "'."; + + opensearch_result.result_json + "'."; throw std::runtime_error(str.c_str()); } } -ESCommunication::ESCommunication() +OpenSearchCommunication::OpenSearchCommunication() #ifdef __APPLE__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wreorder" @@ -221,16 +224,16 @@ ESCommunication::ESCommunication() #pragma clang diagnostic pop #endif // __APPLE__ { - LogMsg(ES_ALL, "Initializing Aws API."); + LogMsg(OPENSEARCH_ALL, "Initializing Aws API."); Aws::InitAPI(m_options); } -ESCommunication::~ESCommunication() { - LogMsg(ES_ALL, "Shutting down Aws API."); +OpenSearchCommunication::~OpenSearchCommunication() { + LogMsg(OPENSEARCH_ALL, "Shutting down Aws API."); Aws::ShutdownAPI(m_options); } -std::string ESCommunication::GetErrorMessage() { +std::string OpenSearchCommunication::GetErrorMessage() { // TODO #35 - Check if they expect NULL or "" when there is no error. if (m_error_details) { m_error_details->details = std::regex_replace( @@ -243,11 +246,11 @@ std::string ESCommunication::GetErrorMessage() { } } -ConnErrorType ESCommunication::GetErrorType() { +ConnErrorType OpenSearchCommunication::GetErrorType() { return m_error_type; } -bool ESCommunication::ConnectionOptions(runtime_options& rt_opts, +bool OpenSearchCommunication::ConnectionOptions(runtime_options& rt_opts, bool use_defaults, int expand_dbname, unsigned int option_count) { (void)(expand_dbname); @@ -257,12 +260,12 @@ bool ESCommunication::ConnectionOptions(runtime_options& rt_opts, return CheckConnectionOptions(); } -bool ESCommunication::ConnectionOptions2() { +bool OpenSearchCommunication::ConnectionOptions2() { return true; } -bool ESCommunication::ConnectDBStart() { - LogMsg(ES_ALL, "Starting DB connection."); +bool OpenSearchCommunication::ConnectDBStart() { + LogMsg(OPENSEARCH_ALL, "Starting DB connection."); m_status = ConnStatusType::CONNECTION_BAD; if (!m_valid_connection_options) { // TODO: get error message from CheckConnectionOptions @@ -270,7 +273,7 @@ bool ESCommunication::ConnectDBStart() { "Invalid connection options, unable to connect to DB."; SetErrorDetails("Invalid connection options", m_error_message, ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); DropDBConnection(); return false; } @@ -280,22 +283,22 @@ bool ESCommunication::ConnectDBStart() { m_error_message = "Failed to establish connection to DB."; SetErrorDetails("Connection error", m_error_message, ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); DropDBConnection(); return false; } - LogMsg(ES_DEBUG, "Connection established."); + LogMsg(OPENSEARCH_DEBUG, "Connection established."); m_status = ConnStatusType::CONNECTION_OK; return true; } -ConnStatusType ESCommunication::GetConnectionStatus() { +ConnStatusType OpenSearchCommunication::GetConnectionStatus() { return m_status; } -void ESCommunication::DropDBConnection() { - LogMsg(ES_ALL, "Dropping DB connection."); +void OpenSearchCommunication::DropDBConnection() { + LogMsg(OPENSEARCH_ALL, "Dropping DB connection."); if (m_http_client) { m_http_client.reset(); } @@ -304,8 +307,8 @@ void ESCommunication::DropDBConnection() { StopResultRetrieval(); } -bool ESCommunication::CheckConnectionOptions() { - LogMsg(ES_ALL, "Verifying connection options."); +bool OpenSearchCommunication::CheckConnectionOptions() { + LogMsg(OPENSEARCH_ALL, "Verifying connection options."); m_error_message = ""; if (m_rt_opts.auth.auth_type != AUTHTYPE_NONE && m_rt_opts.auth.auth_type != AUTHTYPE_IAM) { @@ -330,17 +333,17 @@ bool ESCommunication::CheckConnectionOptions() { } if (m_error_message != "") { - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); m_valid_connection_options = false; return false; } else { - LogMsg(ES_DEBUG, "Required connection option are valid."); + LogMsg(OPENSEARCH_DEBUG, "Required connection option are valid."); m_valid_connection_options = true; } return m_valid_connection_options; } -void ESCommunication::InitializeConnection() { +void OpenSearchCommunication::InitializeConnection() { Aws::Client::ClientConfiguration config; config.scheme = (m_rt_opts.crypt.use_ssl ? Aws::Http::Scheme::HTTPS : Aws::Http::Scheme::HTTP); @@ -358,7 +361,8 @@ void ESCommunication::InitializeConnection() { m_http_client = Aws::Http::CreateHttpClient(config); } -std::shared_ptr< Aws::Http::HttpResponse > ESCommunication::IssueRequest( +std::shared_ptr< Aws::Http::HttpResponse > +OpenSearchCommunication::IssueRequest( const std::string& endpoint, const Aws::Http::HttpMethod request_type, const std::string& content_type, const std::string& query, const std::string& fetch_size, const std::string& cursor) { @@ -418,7 +422,7 @@ std::shared_ptr< Aws::Http::HttpResponse > ESCommunication::IssueRequest( return m_http_client->MakeRequest(request); } -bool ESCommunication::IsSQLPluginInstalled(const std::string& plugin_response) { +bool OpenSearchCommunication::IsSQLPluginInstalled(const std::string& plugin_response) { try { rabbit::document doc; doc.parse(plugin_response); @@ -430,7 +434,7 @@ bool ESCommunication::IsSQLPluginInstalled(const std::string& plugin_response) { if (!plugin_name.compare(OPENDISTRO_SQL_PLUGIN_NAME)) { std::string sql_plugin_version = it.at("version").as_string(); - LogMsg(ES_INFO, std::string("Found SQL plugin version '" + LogMsg(OPENSEARCH_INFO, std::string("Found SQL plugin version '" + sql_plugin_version + "'.") .c_str()); return true; @@ -468,20 +472,20 @@ bool ESCommunication::IsSQLPluginInstalled(const std::string& plugin_response) { ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); } - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return false; } -bool ESCommunication::EstablishConnection() { +bool OpenSearchCommunication::EstablishConnection() { // Generate HttpClient Connection class if it does not exist - LogMsg(ES_ALL, "Attempting to establish DB connection."); + LogMsg(OPENSEARCH_ALL, "Attempting to establish DB connection."); if (!m_http_client) { InitializeConnection(); } - // Check whether SQL plugin has been installed on the Elasticsearch server. + // Check whether SQL plugin has been installed on the OpenSearch server. // This is required for executing driver queries with the server. - LogMsg(ES_ALL, "Checking for SQL plugin"); + LogMsg(OPENSEARCH_ALL, "Checking for SQL plugin"); std::shared_ptr< Aws::Http::HttpResponse > response = IssueRequest(PLUGIN_ENDPOINT_FORMAT_JSON, Aws::Http::HttpMethod::HTTP_GET, "", "", ""); @@ -518,24 +522,24 @@ bool ESCommunication::EstablishConnection() { } } } - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return false; } -std::vector< std::string > ESCommunication::GetColumnsWithSelectQuery( +std::vector< std::string > OpenSearchCommunication::GetColumnsWithSelectQuery( const std::string table_name) { std::vector< std::string > list_of_column; if (table_name.empty()) { m_error_type = ConnErrorType::CONN_ERROR_INVALID_NULL_PTR; m_error_message = "Query is NULL"; - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return list_of_column; } // Prepare query std::string query = "SELECT * FROM " + table_name + " LIMIT 0"; std::string msg = "Attempting to execute a query \"" + query + "\""; - LogMsg(ES_DEBUG, msg.c_str()); + LogMsg(OPENSEARCH_DEBUG, msg.c_str()); // Issue request std::shared_ptr< Aws::Http::HttpResponse > response = @@ -549,12 +553,12 @@ std::vector< std::string > ESCommunication::GetColumnsWithSelectQuery( "Received NULL response."; SetErrorDetails("HTTP client error", m_error_message, ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return list_of_column; } // Convert body from Aws IOStream to string - std::unique_ptr< ESResult > result = std::make_unique< ESResult >(); + std::unique_ptr< OpenSearchResult > result = std::make_unique< OpenSearchResult >(); AwsHttpResponseToString(response, result->result_json); // If response was not valid, set error @@ -573,13 +577,13 @@ std::vector< std::string > ESCommunication::GetColumnsWithSelectQuery( } SetErrorDetails("Connection error", m_error_message, ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return list_of_column; } GetJsonSchema(*result); - rabbit::array schema_array = result->es_result_doc["schema"]; + rabbit::array schema_array = result->opensearch_result_doc["schema"]; for (rabbit::array::iterator it = schema_array.begin(); it != schema_array.end(); ++it) { std::string column_name = it->at("name").as_string(); @@ -589,19 +593,19 @@ std::vector< std::string > ESCommunication::GetColumnsWithSelectQuery( return list_of_column; } -int ESCommunication::ExecDirect(const char* query, const char* fetch_size_) { +int OpenSearchCommunication::ExecDirect(const char* query, const char* fetch_size_) { m_error_details.reset(); if (!query) { m_error_message = "Query is NULL"; SetErrorDetails("Execution error", m_error_message, ConnErrorType::CONN_ERROR_INVALID_NULL_PTR); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return -1; } else if (!m_http_client) { m_error_message = "Unable to connect. Please try connecting again."; SetErrorDetails("Execution error", m_error_message, ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return -1; } @@ -609,7 +613,7 @@ int ESCommunication::ExecDirect(const char* query, const char* fetch_size_) { std::string statement(query); std::string fetch_size(fetch_size_); std::string msg = "Attempting to execute a query \"" + statement + "\""; - LogMsg(ES_DEBUG, msg.c_str()); + LogMsg(OPENSEARCH_DEBUG, msg.c_str()); // Issue request std::shared_ptr< Aws::Http::HttpResponse > response = @@ -623,12 +627,12 @@ int ESCommunication::ExecDirect(const char* query, const char* fetch_size_) { "Received NULL response."; SetErrorDetails("Execution error", m_error_message, ConnErrorType::CONN_ERROR_QUERY_SYNTAX); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return -1; } // Convert body from Aws IOStream to string - std::unique_ptr< ESResult > result = std::make_unique< ESResult >(); + std::unique_ptr< OpenSearchResult > result = std::make_unique< OpenSearchResult >(); AwsHttpResponseToString(response, result->result_json); // If response was not valid, set error @@ -646,13 +650,13 @@ int ESCommunication::ExecDirect(const char* query, const char* fetch_size_) { m_error_message += " Response error: '" + result->result_json + "'."; } - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return -1; } // Add to result queue and return try { - ConstructESResult(*result); + ConstructOpenSearchResult(*result); } catch (std::runtime_error& e) { m_error_message = "Received runtime exception: " + std::string(e.what()); @@ -661,7 +665,7 @@ int ESCommunication::ExecDirect(const char* query, const char* fetch_size_) { } SetErrorDetails("Execution error", m_error_message, ConnErrorType::CONN_ERROR_QUERY_SYNTAX); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return -1; } @@ -683,7 +687,7 @@ int ESCommunication::ExecDirect(const char* query, const char* fetch_size_) { return 0; } -void ESCommunication::SendCursorQueries(std::string cursor) { +void OpenSearchCommunication::SendCursorQueries(std::string cursor) { if (cursor.empty()) { return; } @@ -700,17 +704,17 @@ void ESCommunication::SendCursorQueries(std::string cursor) { "Received NULL response."; SetErrorDetails("Cursor error", m_error_message, ConnErrorType::CONN_ERROR_QUERY_SYNTAX); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return; } - std::unique_ptr< ESResult > result = std::make_unique< ESResult >(); + std::unique_ptr< OpenSearchResult > result = std::make_unique< OpenSearchResult >(); AwsHttpResponseToString(response, result->result_json); PrepareCursorResult(*result); - if (result->es_result_doc.has("cursor")) { - cursor = result->es_result_doc["cursor"].as_string(); - result->cursor = result->es_result_doc["cursor"].as_string(); + if (result->opensearch_result_doc.has("cursor")) { + cursor = result->opensearch_result_doc["cursor"].as_string(); + result->cursor = result->opensearch_result_doc["cursor"].as_string(); } else { SendCloseCursorRequest(cursor); cursor.clear(); @@ -729,7 +733,7 @@ void ESCommunication::SendCursorQueries(std::string cursor) { "Received runtime exception: " + std::string(e.what()); SetErrorDetails("Cursor error", m_error_message, ConnErrorType::CONN_ERROR_QUERY_SYNTAX); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); } if (!m_is_retrieving) { @@ -739,7 +743,7 @@ void ESCommunication::SendCursorQueries(std::string cursor) { } } -void ESCommunication::SendCloseCursorRequest(const std::string& cursor) { +void OpenSearchCommunication::SendCloseCursorRequest(const std::string& cursor) { std::shared_ptr< Aws::Http::HttpResponse > response = IssueRequest(SQL_ENDPOINT_CLOSE_CURSOR, Aws::Http::HttpMethod::HTTP_POST, ctype, "", "", cursor); @@ -749,18 +753,18 @@ void ESCommunication::SendCloseCursorRequest(const std::string& cursor) { "Received NULL response."; SetErrorDetails("Cursor error", m_error_message, ConnErrorType::CONN_ERROR_QUERY_SYNTAX); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); } } -void ESCommunication::StopResultRetrieval() { +void OpenSearchCommunication::StopResultRetrieval() { m_is_retrieving = false; m_result_queue.clear(); } -void ESCommunication::ConstructESResult(ESResult& result) { +void OpenSearchCommunication::ConstructOpenSearchResult(OpenSearchResult& result) { GetJsonSchema(result); - rabbit::array schema_array = result.es_result_doc["schema"]; + rabbit::array schema_array = result.opensearch_result_doc["schema"]; for (rabbit::array::iterator it = schema_array.begin(); it != schema_array.end(); ++it) { std::string column_name = it->at("name").as_string(); @@ -776,14 +780,14 @@ void ESCommunication::ConstructESResult(ESResult& result) { result.column_info.push_back(col_info); } - if (result.es_result_doc.has("cursor")) { - result.cursor = result.es_result_doc["cursor"].as_string(); + if (result.opensearch_result_doc.has("cursor")) { + result.cursor = result.opensearch_result_doc["cursor"].as_string(); } result.command_type = "SELECT"; result.num_fields = (uint16_t)schema_array.size(); } -inline void ESCommunication::LogMsg(ESLogLevel level, const char* msg) { +inline void OpenSearchCommunication::LogMsg(OpenSearchLogLevel level, const char* msg) { #if WIN32 #pragma warning(push) #pragma warning(disable : 4551) @@ -796,8 +800,8 @@ inline void ESCommunication::LogMsg(ESLogLevel level, const char* msg) { #endif // WIN32 } -ESResult* ESCommunication::PopResult() { - ESResult* result = NULL; +OpenSearchResult* OpenSearchCommunication::PopResult() { + OpenSearchResult* result = NULL; while (!m_result_queue.pop(QUEUE_TIMEOUT, result) && m_is_retrieving) { } @@ -805,24 +809,24 @@ ESResult* ESCommunication::PopResult() { } // TODO #36 - Send query to database to get encoding -std::string ESCommunication::GetClientEncoding() { +std::string OpenSearchCommunication::GetClientEncoding() { return m_client_encoding; } // TODO #36 - Send query to database to set encoding -bool ESCommunication::SetClientEncoding(std::string& encoding) { +bool OpenSearchCommunication::SetClientEncoding(std::string& encoding) { if (std::find(m_supported_client_encodings.begin(), m_supported_client_encodings.end(), encoding) != m_supported_client_encodings.end()) { m_client_encoding = encoding; return true; } - LogMsg(ES_ERROR, + LogMsg(OPENSEARCH_ERROR, std::string("Failed to find encoding " + encoding).c_str()); return false; } -std::string ESCommunication::GetServerVersion() { +std::string OpenSearchCommunication::GetServerVersion() { if (!m_http_client) { InitializeConnection(); } @@ -836,7 +840,7 @@ std::string ESCommunication::GetServerVersion() { "Received NULL response."; SetErrorDetails("Connection error", m_error_message, ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return ""; } @@ -855,30 +859,30 @@ std::string ESCommunication::GetServerVersion() { + std::string(e.what()); SetErrorDetails("Connection error", m_error_message, ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); } catch (const rabbit::parse_error& e) { m_error_message = "Error parsing main endpoint response: " + std::string(e.what()); SetErrorDetails("Connection error", m_error_message, ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); } catch (const std::exception& e) { m_error_message = "Error parsing main endpoint response: " + std::string(e.what()); SetErrorDetails("Connection error", m_error_message, ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); } catch (...) { - LogMsg(ES_ERROR, + LogMsg(OPENSEARCH_ERROR, "Unknown exception thrown when parsing main endpoint " "response."); } } - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return ""; } -std::string ESCommunication::GetClusterName() { +std::string OpenSearchCommunication::GetClusterName() { if (!m_http_client) { InitializeConnection(); } @@ -892,7 +896,7 @@ std::string ESCommunication::GetClusterName() { "Received NULL response."; SetErrorDetails("Connection error", m_error_message, ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return ""; } @@ -911,25 +915,25 @@ std::string ESCommunication::GetClusterName() { + std::string(e.what()); SetErrorDetails("Connection error", m_error_message, ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); } catch (const rabbit::parse_error& e) { m_error_message = "Error parsing main endpoint response: " + std::string(e.what()); SetErrorDetails("Connection error", m_error_message, ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); } catch (const std::exception& e) { m_error_message = "Error parsing main endpoint response: " + std::string(e.what()); SetErrorDetails("Connection error", m_error_message, ConnErrorType::CONN_ERROR_COMM_LINK_FAILURE); - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); } catch (...) { - LogMsg(ES_ERROR, + LogMsg(OPENSEARCH_ERROR, "Unknown exception thrown when parsing main endpoint " "response."); } } - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return ""; } diff --git a/sql-odbc/src/odfesqlodbc/es_communication.h b/sql-odbc/src/odfesqlodbc/opensearch_communication.h similarity index 84% rename from sql-odbc/src/odfesqlodbc/es_communication.h rename to sql-odbc/src/odfesqlodbc/opensearch_communication.h index f910d0aec7..27602b92e5 100644 --- a/sql-odbc/src/odfesqlodbc/es_communication.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.h @@ -14,16 +14,16 @@ * */ -#ifndef ES_COMMUNICATION -#define ES_COMMUNICATION +#ifndef OPENSEARCH_COMMUNICATION +#define OPENSEARCH_COMMUNICATION // clang-format off #include #include #include #include -#include "es_types.h" -#include "es_result_queue.h" +#include "opensearch_types.h" +#include "opensearch_result_queue.h" //Keep rabbit at top otherwise it gives build error because of some variable names like max, min #ifdef __APPLE__ @@ -44,10 +44,10 @@ #include // clang-format on -class ESCommunication { +class OpenSearchCommunication { public: - ESCommunication(); - ~ESCommunication(); + OpenSearchCommunication(); + ~OpenSearchCommunication(); // Create function for factory std::string GetErrorMessage(); @@ -58,10 +58,10 @@ class ESCommunication { bool ConnectDBStart(); ConnStatusType GetConnectionStatus(); void DropDBConnection(); - void LogMsg(ESLogLevel level, const char* msg); + void LogMsg(OpenSearchLogLevel level, const char* msg); int ExecDirect(const char* query, const char* fetch_size_); void SendCursorQueries(std::string cursor); - ESResult* PopResult(); + OpenSearchResult* PopResult(); std::string GetClientEncoding(); bool SetClientEncoding(std::string& encoding); bool IsSQLPluginInstalled(const std::string& plugin_response); @@ -83,10 +83,11 @@ class ESCommunication { void InitializeConnection(); bool CheckConnectionOptions(); bool EstablishConnection(); - void ConstructESResult(ESResult& result); - void GetJsonSchema(ESResult& es_result); - void PrepareCursorResult(ESResult& es_result); - std::shared_ptr< ErrorDetails > ParseErrorResponse(ESResult& es_result); + void ConstructOpenSearchResult(OpenSearchResult& result); + void GetJsonSchema(OpenSearchResult& opensearch_result); + void PrepareCursorResult(OpenSearchResult& opensearch_result); + std::shared_ptr< ErrorDetails > ParseErrorResponse( + OpenSearchResult& opensearch_result); void SetErrorDetails(std::string reason, std::string message, ConnErrorType error_type); void SetErrorDetails(ErrorDetails details); @@ -100,7 +101,7 @@ class ESCommunication { std::shared_ptr< ErrorDetails > m_error_details; bool m_valid_connection_options; bool m_is_retrieving; - ESResultQueue m_result_queue; + OpenSearchResultQueue m_result_queue; runtime_options m_rt_opts; std::string m_client_encoding; Aws::SDKOptions m_options; diff --git a/sql-odbc/src/odfesqlodbc/es_connection.cpp b/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp similarity index 75% rename from sql-odbc/src/odfesqlodbc/es_connection.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_connection.cpp index fb13d3131f..48d7736e26 100644 --- a/sql-odbc/src/odfesqlodbc/es_connection.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp @@ -19,7 +19,7 @@ #define _WIN32_WINNT 0x0400 #endif /* _WIN32_WINNT */ -#include "es_connection.h" +#include "opensearch_connection.h" #include #include @@ -39,10 +39,10 @@ #include "dlg_specific.h" #include "environ.h" -#include "es_apifunc.h" -#include "es_helper.h" #include "loadlib.h" #include "multibyte.h" +#include "opensearch_apifunc.h" +#include "opensearch_helper.h" #include "qresult.h" #include "statement.h" @@ -59,8 +59,8 @@ char CC_connect(ConnectionClass *self) { if (self == NULL) return 0; - // Attempt to connect to ES - int conn_code = LIBES_connect(self); + // Attempt to connect to OpenSearch + int conn_code = LIBOPENSEARCH_connect(self); if (conn_code <= 0) return static_cast< char >(conn_code); @@ -89,7 +89,7 @@ char CC_connect(ConnectionClass *self) { return 1; } -int LIBES_connect(ConnectionClass *self) { +int LIBOPENSEARCH_connect(ConnectionClass *self) { if (self == NULL) return 0; @@ -111,18 +111,18 @@ int LIBES_connect(ConnectionClass *self) { rt_opts.crypt.verify_server = (self->connInfo.verify_server == 1); rt_opts.crypt.use_ssl = (self->connInfo.use_ssl == 1); - void *esconn = ESConnectDBParams(rt_opts, FALSE, OPTION_COUNT); - if (esconn == NULL) { - std::string err = GetErrorMsg(esconn); + void *opensearchconn = OpenSearchConnectDBParams(rt_opts, FALSE, OPTION_COUNT); + if (opensearchconn == NULL) { + std::string err = GetErrorMsg(opensearchconn); CC_set_error(self, CONN_OPENDB_ERROR, - (err.empty()) ? "ESConnectDBParams error" : err.c_str(), - "LIBES_connect"); + (err.empty()) ? "OpenSearchConnectDBParams error" : err.c_str(), + "LIBOPENSEARCH_connect"); return 0; } // Check connection status - if (ESStatus(esconn) != CONNECTION_OK) { - std::string msg = GetErrorMsg(esconn); + if (OpenSearchStatus(opensearchconn) != CONNECTION_OK) { + std::string msg = GetErrorMsg(opensearchconn); char error_message_out[ERROR_BUFF_SIZE] = ""; if (!msg.empty()) SPRINTF_FIXED(error_message_out, "Connection error: %s", @@ -131,19 +131,19 @@ int LIBES_connect(ConnectionClass *self) { STRCPY_FIXED(error_message_out, "Connection error: No message available."); CC_set_error(self, CONN_OPENDB_ERROR, error_message_out, - "LIBES_connect"); - ESDisconnect(esconn); + "LIBOPENSEARCH_connect"); + OpenSearchDisconnect(opensearchconn); return 0; } // Set server version - std::string server_version = GetServerVersion(esconn); - STRCPY_FIXED(self->es_version, server_version.c_str()); + std::string server_version = GetServerVersion(opensearchconn); + STRCPY_FIXED(self->opensearch_version, server_version.c_str()); - std::string cluster_name = GetClusterName(esconn); + std::string cluster_name = GetClusterName(opensearchconn); STRCPY_FIXED(self->cluster_name, cluster_name.c_str()); - self->esconn = (void *)esconn; + self->opensearchconn = (void *)opensearchconn; return 1; } @@ -177,9 +177,9 @@ int CC_send_client_encoding(ConnectionClass *self, const char *encoding) { // Update client encoding std::string des_db_encoding(encoding); - std::string cur_db_encoding = ESGetClientEncoding(self->esconn); + std::string cur_db_encoding = OpenSearchGetClientEncoding(self->opensearchconn); if (des_db_encoding != cur_db_encoding) { - if (!ESSetClientEncoding(self->esconn, des_db_encoding)) { + if (!OpenSearchSetClientEncoding(self->opensearchconn, des_db_encoding)) { return SQL_ERROR; } } @@ -187,20 +187,20 @@ int CC_send_client_encoding(ConnectionClass *self, const char *encoding) { // Update connection class to reflect updated client encoding char *prev_encoding = self->original_client_encoding; self->original_client_encoding = strdup(des_db_encoding.c_str()); - self->ccsc = static_cast< short >(es_CS_code(des_db_encoding.c_str())); - self->mb_maxbyte_per_char = static_cast< short >(es_mb_maxlen(self->ccsc)); + self->ccsc = static_cast< short >(opensearch_CS_code(des_db_encoding.c_str())); + self->mb_maxbyte_per_char = static_cast< short >(opensearch_mb_maxlen(self->ccsc)); if (prev_encoding != NULL) free(prev_encoding); return SQL_SUCCESS; } -void CC_initialize_es_version(ConnectionClass *self) { - STRCPY_FIXED(self->es_version, "7.4"); - self->es_version_major = 7; - self->es_version_minor = 4; +void CC_initialize_opensearch_version(ConnectionClass *self) { + STRCPY_FIXED(self->opensearch_version, "7.4"); + self->opensearch_version_major = 7; + self->opensearch_version_minor = 4; } -void LIBES_disconnect(void *conn) { - ESDisconnect(conn); +void LIBOPENSEARCH_disconnect(void *conn) { + OpenSearchDisconnect(conn); } diff --git a/sql-odbc/src/odfesqlodbc/es_connection.h b/sql-odbc/src/odfesqlodbc/opensearch_connection.h similarity index 92% rename from sql-odbc/src/odfesqlodbc/es_connection.h rename to sql-odbc/src/odfesqlodbc/opensearch_connection.h index b523a126f7..4a233b97e6 100644 --- a/sql-odbc/src/odfesqlodbc/es_connection.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_connection.h @@ -14,17 +14,17 @@ * */ -#ifndef __ESCONNECTION_H__ -#define __ESCONNECTION_H__ +#ifndef __OPENSEARCHCONNECTION_H__ +#define __OPENSEARCHCONNECTION_H__ #include #include #include #include "descriptor.h" -#include "es_helper.h" -#include "es_odbc.h" -#include "es_utility.h" +#include "opensearch_helper.h" +#include "opensearch_odbc.h" +#include "opensearch_utility.h" #ifdef __cplusplus extern "C" { @@ -188,15 +188,15 @@ typedef enum { * 3rd parameter: minor version number */ #define SERVER_VERSION_GT(conn, major, minor) \ - ((conn)->es_version_major > major \ - || ((conn)->es_version_major == major \ - && (conn)->es_version_minor > minor)) + ((conn)->opensearch_version_major > major \ + || ((conn)->opensearch_version_major == major \ + && (conn)->opensearch_version_minor > minor)) #define SERVER_VERSION_GE(conn, major, minor) \ - ((conn)->es_version_major > major \ - || ((conn)->es_version_major == major \ - && (conn)->es_version_minor >= minor)) + ((conn)->opensearch_version_major > major \ + || ((conn)->opensearch_version_major == major \ + && (conn)->opensearch_version_minor >= minor)) #define SERVER_VERSION_EQ(conn, major, minor) \ - ((conn)->es_version_major == major && (conn)->es_version_minor == minor) + ((conn)->opensearch_version_major == major && (conn)->opensearch_version_minor == minor) #define STRING_AFTER_DOT(string) (strchr(#string, '.') + 1) /* @@ -205,21 +205,21 @@ typedef enum { * Note: Never pass a variable as the second parameter. * It must be a decimal constant of the form %d.%d . */ -#define ES_VERSION_GT(conn, ver) \ +#define OPENSEARCH_VERSION_GT(conn, ver) \ (SERVER_VERSION_GT(conn, (int)ver, atoi(STRING_AFTER_DOT(ver)))) -#define ES_VERSION_GE(conn, ver) \ +#define OPENSEARCH_VERSION_GE(conn, ver) \ (SERVER_VERSION_GE(conn, (int)ver, atoi(STRING_AFTER_DOT(ver)))) -#define ES_VERSION_EQ(conn, ver) \ +#define OPENSEARCH_VERSION_EQ(conn, ver) \ (SERVER_VERSION_EQ(conn, (int)ver, atoi(STRING_AFTER_DOT(ver)))) -#define ES_VERSION_LE(conn, ver) (!ES_VERSION_GT(conn, ver)) -#define ES_VERSION_LT(conn, ver) (!ES_VERSION_GE(conn, ver)) +#define OPENSEARCH_VERSION_LE(conn, ver) (!OPENSEARCH_VERSION_GT(conn, ver)) +#define OPENSEARCH_VERSION_LT(conn, ver) (!OPENSEARCH_VERSION_GE(conn, ver)) /* This is used to store cached table information in the connection */ struct col_info { Int2 refcnt; QResultClass *result; - esNAME schema_name; - esNAME table_name; + opensearchNAME schema_name; + opensearchNAME table_name; OID table_oid; int table_info; time_t acc_time; @@ -271,7 +271,7 @@ struct ConnectionClass_ { StatementClass **stmts; Int2 num_stmts; Int2 ncursors; - void *esconn; + void *opensearchconn; Int4 lobj_type; Int2 coli_allocated; Int2 ntables; @@ -283,11 +283,11 @@ struct ConnectionClass_ { char transact_status; /* Is a transaction is currently * in progress */ char cluster_name[MAX_INFO_STRING]; - char es_version[MAX_INFO_STRING]; /* Version of Elasticsearch driver + char opensearch_version[MAX_INFO_STRING]; /* Version of OpenSearch driver * we're connected to - * DJP 25-1-2001 */ - Int2 es_version_major; - Int2 es_version_minor; + Int2 opensearch_version_major; + Int2 opensearch_version_minor; char ms_jet; char unicode; char result_uncommitted; @@ -320,8 +320,8 @@ struct ConnectionClass_ { SQLUINTEGER default_isolation; /* server's default isolation initially unkown */ DescriptorClass **descs; - esNAME schemaIns; - esNAME tableIns; + opensearchNAME schemaIns; + opensearchNAME tableIns; SQLULEN stmt_timeout_in_effect; void *cs; void *slock; @@ -405,15 +405,15 @@ char *identifierEscape(const SQLCHAR *src, SQLLEN srclen, const ConnectionClass *conn, char *buf, size_t bufsize, BOOL double_quote); int findIdentifier(const UCHAR *str, int ccsc, const UCHAR **next_token); -int eatTableIdentifiers(const UCHAR *str, int ccsc, esNAME *table, - esNAME *schema); +int eatTableIdentifiers(const UCHAR *str, int ccsc, opensearchNAME *table, + opensearchNAME *schema); char CC_connect(ConnectionClass *self); -int LIBES_connect(ConnectionClass *self); -void LIBES_disconnect(void *conn); +int LIBOPENSEARCH_connect(ConnectionClass *self); +void LIBOPENSEARCH_disconnect(void *conn); int CC_send_client_encoding(ConnectionClass *self, const char *encoding); void CC_set_locale_encoding(ConnectionClass *self, const char *encoding); -void CC_initialize_es_version(ConnectionClass *self); +void CC_initialize_opensearch_version(ConnectionClass *self); const char *CurrCat(const ConnectionClass *self); const char *CurrCatString(const ConnectionClass *self); @@ -469,4 +469,4 @@ enum { SVPOPT_RDONLY = 1L, SVPOPT_REDUCE_ROUNDTRIP = (1L << 1) }; #ifdef __cplusplus } #endif -#endif /* __ESCONNECTION_H__ */ +#endif /* __OPENSEARCHCONNECTION_H__ */ diff --git a/sql-odbc/src/odfesqlodbc/es_driver_connect.cpp b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp similarity index 95% rename from sql-odbc/src/odfesqlodbc/es_driver_connect.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp index cb91984f7c..ee127c400f 100644 --- a/sql-odbc/src/odfesqlodbc/es_driver_connect.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp @@ -14,12 +14,12 @@ * */ -#include "es_driver_connect.h" +#include "opensearch_driver_connect.h" #include #include -#include "es_odbc.h" +#include "opensearch_odbc.h" #include "misc.h" #ifndef WIN32 @@ -41,7 +41,7 @@ #include "dlg_specific.h" #include "drvconn.h" -#include "es_apifunc.h" +#include "opensearch_apifunc.h" static RETCODE CheckDriverComplete(const SQLUSMALLINT driver_completion, const HWND hwnd, ConnInfo *ci, @@ -82,7 +82,7 @@ static RETCODE GetRequirementsAndConnect(const SQLUSMALLINT driver_completion, // user can always hit Cancel to get out) if (paramRequired(ci, reqs)) { CC_set_error(conn, CONN_OPENDB_ERROR, "Please supply password", - "ESAPI_DriverConnect->GetRequirements"); + "OPENSEARCHAPI_DriverConnect->GetRequirements"); return SQL_ERROR; } ret_val = CC_connect(conn); @@ -209,12 +209,12 @@ static SQLRETURN SetupConnString(const SQLCHAR *conn_str_in, return SQL_SUCCESS; } -RETCODE ESAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, +RETCODE OPENSEARCHAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, SQLSMALLINT conn_str_in_len, SQLCHAR *conn_str_out, SQLSMALLINT conn_str_out_len, SQLSMALLINT *pcb_conn_str_out, SQLUSMALLINT driver_completion) { - CSTR func = "ESAPI_DriverConnect"; + CSTR func = "OPENSEARCHAPI_DriverConnect"; ConnectionClass *conn = (ConnectionClass *)hdbc; if (!conn) { @@ -231,8 +231,8 @@ RETCODE ESAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, return return_code; } - // Initialize es_version - CC_initialize_es_version(conn); + // Initialize opensearch_version + CC_initialize_opensearch_version(conn); int reqs = 0; int retval = 0; diff --git a/sql-odbc/src/odfesqlodbc/es_driver_connect.h b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.h similarity index 79% rename from sql-odbc/src/odfesqlodbc/es_driver_connect.h rename to sql-odbc/src/odfesqlodbc/opensearch_driver_connect.h index be6bb2d6ca..4296b29d2b 100644 --- a/sql-odbc/src/odfesqlodbc/es_driver_connect.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.h @@ -14,15 +14,15 @@ * */ -#ifndef __ES_DRIVER_CONNECT_H__ -#define __ES_DRIVER_CONNECT_H__ -#include "es_connection.h" +#ifndef __OPENSEARCH_DRIVER_CONNECT_H__ +#define __OPENSEARCH_DRIVER_CONNECT_H__ +#include "opensearch_connection.h" // C Interface #ifdef __cplusplus extern "C" { #endif -RETCODE ESAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, +RETCODE OPENSEARCHAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, SQLSMALLINT conn_str_in_len, SQLCHAR *conn_str_out, SQLSMALLINT conn_str_out_len, SQLSMALLINT *pcb_conn_str_out, @@ -31,4 +31,4 @@ RETCODE ESAPI_DriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *conn_str_in, } #endif -#endif /* __ES_DRIVER_CONNECT_H__ */ +#endif /* __OPENSEARCH_DRIVER_CONNECT_H__ */ diff --git a/sql-odbc/src/odfesqlodbc/es_helper.cpp b/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp similarity index 64% rename from sql-odbc/src/odfesqlodbc/es_helper.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_helper.cpp index 529ebfe958..0b029e83c2 100644 --- a/sql-odbc/src/odfesqlodbc/es_helper.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp @@ -14,18 +14,18 @@ * */ -#include "es_helper.h" +#include "opensearch_helper.h" #include #include #include -#include "es_communication.h" +#include "opensearch_communication.h" -void* ESConnectDBParams(runtime_options& rt_opts, int expand_dbname, +void* OpenSearchConnectDBParams(runtime_options& rt_opts, int expand_dbname, unsigned int option_count) { // Initialize Connection - ESCommunication* conn = static_cast< ESCommunication* >(InitializeESConn()); + OpenSearchCommunication* conn = static_cast< OpenSearchCommunication* >(InitializeOpenSearchConn()); if (!conn) return NULL; @@ -46,81 +46,85 @@ void* ESConnectDBParams(runtime_options& rt_opts, int expand_dbname, return conn; } -ConnStatusType ESStatus(void* es_conn) { - return es_conn - ? static_cast< ESCommunication* >(es_conn)->GetConnectionStatus() +ConnStatusType OpenSearchStatus(void* opensearch_conn) { + return opensearch_conn + ? static_cast< OpenSearchCommunication* >(opensearch_conn)->GetConnectionStatus() : ConnStatusType::CONNECTION_BAD; } -std::string GetErrorMsg(void* es_conn) { - return es_conn ? static_cast< ESCommunication* >(es_conn)->GetErrorMessage() +std::string GetErrorMsg(void* opensearch_conn) { + return opensearch_conn + ? static_cast< OpenSearchCommunication* >(opensearch_conn)->GetErrorMessage() : NULL; } -ConnErrorType GetErrorType(void* es_conn) { - return es_conn ? static_cast< ESCommunication* >(es_conn)->GetErrorType() +ConnErrorType GetErrorType(void* opensearch_conn) { + return opensearch_conn + ? static_cast< OpenSearchCommunication* >(opensearch_conn)->GetErrorType() : ConnErrorType::CONN_ERROR_SUCCESS; } -std::string GetServerVersion(void* es_conn) { - return es_conn - ? static_cast< ESCommunication* >(es_conn)->GetServerVersion() +std::string GetServerVersion(void* opensearch_conn) { + return opensearch_conn + ? static_cast< OpenSearchCommunication* >(opensearch_conn)->GetServerVersion() : ""; } -std::string GetClusterName(void* es_conn) { - return es_conn ? static_cast< ESCommunication* >(es_conn)->GetClusterName() +std::string GetClusterName(void* opensearch_conn) { + return opensearch_conn + ? static_cast< OpenSearchCommunication* >(opensearch_conn)->GetClusterName() : ""; } -void* InitializeESConn() { - return new ESCommunication(); +void* InitializeOpenSearchConn() { + return new OpenSearchCommunication(); } -int ESExecDirect(void* es_conn, const char* statement, const char* fetch_size) { - return (es_conn && statement) - ? static_cast< ESCommunication* >(es_conn)->ExecDirect( +int OpenSearchExecDirect(void* opensearch_conn, const char* statement, const char* fetch_size) { + return (opensearch_conn && statement) + ? static_cast< OpenSearchCommunication* >(opensearch_conn)->ExecDirect( statement, fetch_size) : -1; } -void ESSendCursorQueries(void* es_conn, const char* cursor) { - static_cast< ESCommunication* >(es_conn)->SendCursorQueries(cursor); +void OpenSearchSendCursorQueries(void* opensearch_conn, const char* cursor) { + static_cast< OpenSearchCommunication* >(opensearch_conn)->SendCursorQueries(cursor); } -ESResult* ESGetResult(void* es_conn) { - return es_conn ? static_cast< ESCommunication* >(es_conn)->PopResult() +OpenSearchResult* OpenSearchGetResult(void* opensearch_conn) { + return opensearch_conn + ? static_cast< OpenSearchCommunication* >(opensearch_conn)->PopResult() : NULL; } -std::string ESGetClientEncoding(void* es_conn) { - return es_conn - ? static_cast< ESCommunication* >(es_conn)->GetClientEncoding() +std::string OpenSearchGetClientEncoding(void* opensearch_conn) { + return opensearch_conn + ? static_cast< OpenSearchCommunication* >(opensearch_conn)->GetClientEncoding() : ""; } -bool ESSetClientEncoding(void* es_conn, std::string& encoding) { - return es_conn - ? static_cast< ESCommunication* >(es_conn)->SetClientEncoding( +bool OpenSearchSetClientEncoding(void* opensearch_conn, std::string& encoding) { + return opensearch_conn + ? static_cast< OpenSearchCommunication* >(opensearch_conn)->SetClientEncoding( encoding) : false; } -void ESDisconnect(void* es_conn) { - delete static_cast< ESCommunication* >(es_conn); +void OpenSearchDisconnect(void* opensearch_conn) { + delete static_cast< OpenSearchCommunication* >(opensearch_conn); } -void ESClearResult(ESResult* es_result) { - delete es_result; +void OpenSearchClearResult(OpenSearchResult* opensearch_result) { + delete opensearch_result; } -void ESStopRetrieval(void* es_conn) { - static_cast< ESCommunication* >(es_conn)->StopResultRetrieval(); +void OpenSearchStopRetrieval(void* opensearch_conn) { + static_cast< OpenSearchCommunication* >(opensearch_conn)->StopResultRetrieval(); } -std::vector< std::string > ESGetColumnsWithSelectQuery( - void* es_conn, const std::string table_name) { - return static_cast< ESCommunication* >(es_conn)->GetColumnsWithSelectQuery( +std::vector< std::string > OpenSearchGetColumnsWithSelectQuery( + void* opensearch_conn, const std::string table_name) { + return static_cast< OpenSearchCommunication* >(opensearch_conn)->GetColumnsWithSelectQuery( table_name); } @@ -160,7 +164,7 @@ class CriticalSectionHelper { #pragma warning(disable : 4551) // MYLOG complains 'function call missing // argument list' on Windows, which is isn't #endif - MYLOG(ES_ERROR, "%s\n", + MYLOG(OPENSEARCH_ERROR, "%s\n", "CRITICAL WARNING: ExitCritical section called when lock " "count was already 0!"); #ifdef WIN32 @@ -178,7 +182,7 @@ class CriticalSectionHelper { #pragma warning(disable : 4551) // MYLOG complains 'function call missing // argument list' on Windows, which is isn't #endif - MYLOG(ES_ERROR, "%s\n", + MYLOG(OPENSEARCH_ERROR, "%s\n", "CRITICAL WARNING: ExitCritical section called by thread " "that does not own the lock!"); #ifdef WIN32 diff --git a/sql-odbc/src/odfesqlodbc/opensearch_helper.h b/sql-odbc/src/odfesqlodbc/opensearch_helper.h new file mode 100644 index 0000000000..5f0c3f81ac --- /dev/null +++ b/sql-odbc/src/odfesqlodbc/opensearch_helper.h @@ -0,0 +1,55 @@ +/* + * Copyright <2019> Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + * + */ + +#ifndef __OPENSEARCH_HELPER_H__ +#define __OPENSEARCH_HELPER_H__ + +#include "opensearch_types.h" + +#ifdef __cplusplus +// C++ interface +std::string OpenSearchGetClientEncoding(void* opensearch_conn); +bool OpenSearchSetClientEncoding(void* opensearch_conn, std::string& encoding); +OpenSearchResult* OpenSearchGetResult(void* opensearch_conn); +void OpenSearchClearResult(OpenSearchResult* opensearch_result); +void* OpenSearchConnectDBParams(runtime_options& rt_opts, int expand_dbname, + unsigned int option_count); +std::string GetServerVersion(void* opensearch_conn); +std::string GetClusterName(void* opensearch_conn); +std::string GetErrorMsg(void* opensearch_conn); +ConnErrorType GetErrorType(void* opensearch_conn); +std::vector< std::string > OpenSearchGetColumnsWithSelectQuery( + void* opensearch_conn, const std::string table_name); + +// C Interface +extern "C" { +#endif +void XPlatformInitializeCriticalSection(void** critical_section_helper); +void XPlatformEnterCriticalSection(void* critical_section_helper); +void XPlatformLeaveCriticalSection(void* critical_section_helper); +void XPlatformDeleteCriticalSection(void** critical_section_helper); +ConnStatusType OpenSearchStatus(void* opensearch_conn); +int OpenSearchExecDirect(void* opensearch_conn, const char* statement, const char* fetch_size); +void OpenSearchSendCursorQueries(void* opensearch_conn, const char* cursor); +void OpenSearchDisconnect(void* opensearch_conn); +void OpenSearchStopRetrieval(void* opensearch_conn); +#ifdef __cplusplus +} +#endif + +void* InitializeOpenSearchConn(); + +#endif // __OPENSEARCH_HELPER_H__ diff --git a/sql-odbc/src/odfesqlodbc/es_info.cpp b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp similarity index 82% rename from sql-odbc/src/odfesqlodbc/es_info.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_info.cpp index 648a0d967f..ecab2bc961 100644 --- a/sql-odbc/src/odfesqlodbc/es_info.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp @@ -13,7 +13,7 @@ * permissions and limitations under the License. * */ -#include "es_info.h" +#include "opensearch_info.h" #include #include @@ -25,14 +25,14 @@ #include #include -// TODO #324 (SQL Plugin)- Update if Elasticsearch extends support for multiple +// TODO #324 (SQL Plugin)- Update if OpenSearch extends support for multiple // tables #define DEFAULT_TYPE_STR \ { 'k', 'e', 'y', 'w', 'o', 'r', 'd', '\0' } #define DEFAULT_TYPE_INT (SQL_WVARCHAR) #define EMPTY_VARCHAR \ { '\0' } -#define ES_UNINITIALIZED (-2) +#define OPENSEARCH_UNINITIALIZED (-2) #define COLUMN_TEMPLATE_COUNT 18 #define TABLE_TEMPLATE_COUNT 5 @@ -71,39 +71,40 @@ #define MAXIMUM_SCALE "MAXIMUM_SCALE" #define INTERVAL_PRECISION "INTERVAL_PRECISION" -const std::unordered_map< int, std::vector< int > > sql_es_type_map = { - {SQL_BIT, {ES_TYPE_BOOL}}, - {SQL_TINYINT, {ES_TYPE_INT1}}, - {SQL_SMALLINT, {ES_TYPE_INT2}}, - {SQL_INTEGER, {ES_TYPE_INT4}}, - {SQL_BIGINT, {ES_TYPE_INT8}}, - {SQL_REAL, {ES_TYPE_HALF_FLOAT, ES_TYPE_FLOAT4}}, - {SQL_DOUBLE, {ES_TYPE_FLOAT8, ES_TYPE_SCALED_FLOAT}}, +const std::unordered_map< int, std::vector< int > > sql_opensearch_type_map = { + {SQL_BIT, {OPENSEARCH_TYPE_BOOL}}, + {SQL_TINYINT, {OPENSEARCH_TYPE_INT1}}, + {SQL_SMALLINT, {OPENSEARCH_TYPE_INT2}}, + {SQL_INTEGER, {OPENSEARCH_TYPE_INT4}}, + {SQL_BIGINT, {OPENSEARCH_TYPE_INT8}}, + {SQL_REAL, {OPENSEARCH_TYPE_HALF_FLOAT, OPENSEARCH_TYPE_FLOAT4}}, + {SQL_DOUBLE, {OPENSEARCH_TYPE_FLOAT8, OPENSEARCH_TYPE_SCALED_FLOAT}}, {SQL_WVARCHAR, - {ES_TYPE_KEYWORD, ES_TYPE_TEXT, ES_TYPE_NESTED, ES_TYPE_OBJECT}}, - {SQL_TYPE_TIMESTAMP, {ES_TYPE_DATETIME}}}; + {OPENSEARCH_TYPE_KEYWORD, OPENSEARCH_TYPE_TEXT, OPENSEARCH_TYPE_NESTED, + OPENSEARCH_TYPE_OBJECT}}, + {SQL_TYPE_TIMESTAMP, {OPENSEARCH_TYPE_DATETIME}}}; const std::unordered_map< std::string, int > data_name_data_type_map = { - {ES_TYPE_NAME_BOOLEAN, SQL_BIT}, - {ES_TYPE_NAME_BYTE, SQL_TINYINT}, - {ES_TYPE_NAME_SHORT, SQL_SMALLINT}, - {ES_TYPE_NAME_INTEGER, SQL_INTEGER}, - {ES_TYPE_NAME_LONG, SQL_BIGINT}, - {ES_TYPE_NAME_HALF_FLOAT, SQL_REAL}, - {ES_TYPE_NAME_FLOAT, SQL_REAL}, - {ES_TYPE_NAME_DOUBLE, SQL_DOUBLE}, - {ES_TYPE_NAME_SCALED_FLOAT, SQL_DOUBLE}, - {ES_TYPE_NAME_KEYWORD, SQL_WVARCHAR}, - {ES_TYPE_NAME_TEXT, SQL_WVARCHAR}, - {ES_TYPE_NAME_DATE, SQL_TYPE_TIMESTAMP}, - {ES_TYPE_NAME_OBJECT, SQL_WVARCHAR}, - {ES_TYPE_NAME_NESTED, SQL_WVARCHAR}}; + {OPENSEARCH_TYPE_NAME_BOOLEAN, SQL_BIT}, + {OPENSEARCH_TYPE_NAME_BYTE, SQL_TINYINT}, + {OPENSEARCH_TYPE_NAME_SHORT, SQL_SMALLINT}, + {OPENSEARCH_TYPE_NAME_INTEGER, SQL_INTEGER}, + {OPENSEARCH_TYPE_NAME_LONG, SQL_BIGINT}, + {OPENSEARCH_TYPE_NAME_HALF_FLOAT, SQL_REAL}, + {OPENSEARCH_TYPE_NAME_FLOAT, SQL_REAL}, + {OPENSEARCH_TYPE_NAME_DOUBLE, SQL_DOUBLE}, + {OPENSEARCH_TYPE_NAME_SCALED_FLOAT, SQL_DOUBLE}, + {OPENSEARCH_TYPE_NAME_KEYWORD, SQL_WVARCHAR}, + {OPENSEARCH_TYPE_NAME_TEXT, SQL_WVARCHAR}, + {OPENSEARCH_TYPE_NAME_DATE, SQL_TYPE_TIMESTAMP}, + {OPENSEARCH_TYPE_NAME_OBJECT, SQL_WVARCHAR}, + {OPENSEARCH_TYPE_NAME_NESTED, SQL_WVARCHAR}}; // Boilerplate code for easy column bind handling class BindTemplate { public: BindTemplate(const bool can_be_null, const SQLUSMALLINT ordinal) - : m_len(ES_UNINITIALIZED), m_ordinal(ordinal) { + : m_len(OPENSEARCH_UNINITIALIZED), m_ordinal(ordinal) { if (!can_be_null) throw std::runtime_error( "Do not use this constructor for values that can be NULL. A " @@ -111,23 +112,23 @@ class BindTemplate { "supplied default value must be used if value can be NULL."); } BindTemplate(const bool can_be_null, const SQLUSMALLINT ordinal, const Int2) - : m_len(ES_UNINITIALIZED), m_ordinal(ordinal) { + : m_len(OPENSEARCH_UNINITIALIZED), m_ordinal(ordinal) { (void)(can_be_null); } BindTemplate(const bool can_be_null, const SQLUSMALLINT ordinal, const Int4) - : m_len(ES_UNINITIALIZED), m_ordinal(ordinal) { + : m_len(OPENSEARCH_UNINITIALIZED), m_ordinal(ordinal) { (void)(can_be_null); } BindTemplate(const bool can_be_null, const SQLUSMALLINT ordinal, const std::vector< SQLCHAR > &) - : m_len(ES_UNINITIALIZED), m_ordinal(ordinal) { + : m_len(OPENSEARCH_UNINITIALIZED), m_ordinal(ordinal) { (void)(can_be_null); } virtual ~BindTemplate() { } SQLPOINTER GetData() { - if (m_len == ES_UNINITIALIZED) + if (m_len == OPENSEARCH_UNINITIALIZED) throw std::runtime_error( "Length is uninitialized - Fetch must be executed before data " "is retreived."); @@ -135,7 +136,7 @@ class BindTemplate { } void BindColumn(StatementClass *stmt) { - RETCODE err = ESAPI_BindCol(stmt, m_ordinal, GetType(), + RETCODE err = OPENSEARCHAPI_BindCol(stmt, m_ordinal, GetType(), GetDataForBind(), GetSize(), &m_len); if (!SQL_SUCCEEDED(err)) { std::string error_msg = @@ -380,18 +381,18 @@ void CleanUp(StatementClass *stmt, StatementClass *sub_stmt, SC_set_current_col(stmt, -1); if (sub_stmt) - ESAPI_FreeStmt(sub_stmt, SQL_DROP); + OPENSEARCHAPI_FreeStmt(sub_stmt, SQL_DROP); } void ExecuteQuery(ConnectionClass *conn, HSTMT *stmt, const std::string &query) { // Prepare statement - if (!SQL_SUCCEEDED(ESAPI_AllocStmt(conn, stmt, 0))) { + if (!SQL_SUCCEEDED(OPENSEARCHAPI_AllocStmt(conn, stmt, 0))) { throw std::runtime_error("Failed to allocate memory for statement."); } // Execute query - if (!SQL_SUCCEEDED(ESAPI_ExecDirect( + if (!SQL_SUCCEEDED(OPENSEARCHAPI_ExecDirect( *stmt, reinterpret_cast< const SQLCHAR * >(query.c_str()), SQL_NTS, 1))) { std::string error_msg = "Failed to execute query '" + query + "'."; @@ -455,20 +456,22 @@ void AssignTableBindTemplates(bind_vector &tabs) { void SetupTableQResInfo(QResultClass *res, EnvironmentClass *env) { if (EN_is_odbc3(env)) { QR_set_field_info_v(res, TABLES_CATALOG_NAME, TABLE_CAT, - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, TABLES_SCHEMA_NAME, TABLE_SCHEM, - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); } else { QR_set_field_info_v(res, TABLES_CATALOG_NAME, TABLE_QUALIFIER, - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, TABLES_SCHEMA_NAME, TABLE_OWNER, - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); } - QR_set_field_info_v(res, TABLES_TABLE_NAME, TABLE_NAME, ES_TYPE_VARCHAR, + QR_set_field_info_v(res, TABLES_TABLE_NAME, TABLE_NAME, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, TABLES_TABLE_TYPE, TABLE_TYPE, ES_TYPE_VARCHAR, + QR_set_field_info_v(res, TABLES_TABLE_TYPE, TABLE_TYPE, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, TABLES_REMARKS, REMARKS, ES_TYPE_VARCHAR, + QR_set_field_info_v(res, TABLES_REMARKS, REMARKS, OPENSEARCH_TYPE_VARCHAR, INFO_VARCHAR_SIZE); } @@ -521,7 +524,7 @@ void SetTableTuples(QResultClass *res, const TableResultSet res_type, if (res_type == TableResultSet::All) { RETCODE result = SQL_NO_DATA_FOUND; int ordinal_position = 0; - while (SQL_SUCCEEDED(result = ESAPI_Fetch(tbl_stmt))) { + while (SQL_SUCCEEDED(result = OPENSEARCHAPI_Fetch(tbl_stmt))) { if (bind_tbl[TABLES_TABLE_TYPE]->AsString() == "BASE TABLE") { std::string table("TABLE"); bind_tbl[TABLES_TABLE_TYPE]->UpdateData((void *)table.c_str(), @@ -551,7 +554,7 @@ void SetTableTuples(QResultClass *res, const TableResultSet res_type, // Loop through all data RETCODE result = SQL_NO_DATA_FOUND; - while (SQL_SUCCEEDED(result = ESAPI_Fetch(tbl_stmt))) { + while (SQL_SUCCEEDED(result = OPENSEARCHAPI_Fetch(tbl_stmt))) { // Replace BASE TABLE with TABLE for Excel & Power BI SQLTables call if (bind_tbl[TABLES_TABLE_TYPE]->AsString() == "BASE TABLE") { std::string table("TABLE"); @@ -571,7 +574,7 @@ void SetTableTuples(QResultClass *res, const TableResultSet res_type, // Special cases - only need single grab for this one else { RETCODE result; - if (!SQL_SUCCEEDED(result = ESAPI_Fetch(tbl_stmt))) { + if (!SQL_SUCCEEDED(result = OPENSEARCHAPI_Fetch(tbl_stmt))) { SC_full_error_copy(stmt, tbl_stmt, FALSE); throw std::runtime_error( std::string("Failed to fetch data after query. Error code :" @@ -614,35 +617,47 @@ void AssignColumnBindTemplates(bind_vector &cols); void SetupColumnQResInfo(QResultClass *res, EnvironmentClass *unused) { (void)(unused); - QR_set_field_info_v(res, COLUMNS_CATALOG_NAME, TABLE_CAT, ES_TYPE_VARCHAR, + QR_set_field_info_v(res, COLUMNS_CATALOG_NAME, TABLE_CAT, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, COLUMNS_SCHEMA_NAME, TABLE_SCHEM, ES_TYPE_VARCHAR, + QR_set_field_info_v(res, COLUMNS_SCHEMA_NAME, TABLE_SCHEM, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, COLUMNS_TABLE_NAME, TABLE_NAME, ES_TYPE_VARCHAR, + QR_set_field_info_v(res, COLUMNS_TABLE_NAME, TABLE_NAME, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, COLUMNS_COLUMN_NAME, COLUMN_NAME, ES_TYPE_VARCHAR, + QR_set_field_info_v(res, COLUMNS_COLUMN_NAME, COLUMN_NAME, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, COLUMNS_DATA_TYPE, DATA_TYPE, ES_TYPE_INT2, 2); - QR_set_field_info_v(res, COLUMNS_TYPE_NAME, TYPE_NAME, ES_TYPE_VARCHAR, + QR_set_field_info_v(res, COLUMNS_DATA_TYPE, DATA_TYPE, OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, COLUMNS_TYPE_NAME, TYPE_NAME, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, COLUMNS_PRECISION, COLUMN_SIZE, ES_TYPE_INT4, 4); - QR_set_field_info_v(res, COLUMNS_LENGTH, BUFFER_LENGTH, ES_TYPE_INT4, 4); - QR_set_field_info_v(res, COLUMNS_SCALE, DECIMAL_DIGITS, ES_TYPE_INT2, 2); - QR_set_field_info_v(res, COLUMNS_RADIX, NUM_PREC_RADIX, ES_TYPE_INT2, 2); - QR_set_field_info_v(res, COLUMNS_NULLABLE, NULLABLE, ES_TYPE_INT2, 2); - QR_set_field_info_v(res, COLUMNS_REMARKS, REMARKS, ES_TYPE_VARCHAR, + QR_set_field_info_v(res, COLUMNS_PRECISION, COLUMN_SIZE, + OPENSEARCH_TYPE_INT4, 4); + QR_set_field_info_v(res, COLUMNS_LENGTH, BUFFER_LENGTH, + OPENSEARCH_TYPE_INT4, 4); + QR_set_field_info_v(res, COLUMNS_SCALE, DECIMAL_DIGITS, + OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, COLUMNS_RADIX, NUM_PREC_RADIX, + OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, COLUMNS_NULLABLE, NULLABLE, OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, COLUMNS_REMARKS, REMARKS, OPENSEARCH_TYPE_VARCHAR, INFO_VARCHAR_SIZE); - QR_set_field_info_v(res, COLUMNS_COLUMN_DEF, COLUMN_DEF, ES_TYPE_VARCHAR, + QR_set_field_info_v(res, COLUMNS_COLUMN_DEF, COLUMN_DEF, + OPENSEARCH_TYPE_VARCHAR, INFO_VARCHAR_SIZE); - QR_set_field_info_v(res, COLUMNS_SQL_DATA_TYPE, SQL_DATA_TYPE, ES_TYPE_INT2, + QR_set_field_info_v(res, COLUMNS_SQL_DATA_TYPE, SQL_DATA_TYPE, + OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, COLUMNS_SQL_DATETIME_SUB, SQL_DATETIME_SUB, - ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, COLUMNS_CHAR_OCTET_LENGTH, CHAR_OCTET_LENGTH, - ES_TYPE_INT4, 4); + OPENSEARCH_TYPE_INT4, 4); QR_set_field_info_v(res, COLUMNS_ORDINAL_POSITION, ORDINAL_POSITION, - ES_TYPE_INT4, 4); - QR_set_field_info_v(res, COLUMNS_IS_NULLABLE, IS_NULLABLE, ES_TYPE_VARCHAR, + OPENSEARCH_TYPE_INT4, 4); + QR_set_field_info_v(res, COLUMNS_IS_NULLABLE, IS_NULLABLE, + OPENSEARCH_TYPE_VARCHAR, INFO_VARCHAR_SIZE); } @@ -714,12 +729,12 @@ void GetCatalogData(const std::string &query, StatementClass *stmt, } RETCODE SQL_API -ESAPI_Tables(HSTMT hstmt, const SQLCHAR *catalog_name_sql, +OPENSEARCHAPI_Tables(HSTMT hstmt, const SQLCHAR *catalog_name_sql, const SQLSMALLINT catalog_name_sz, const SQLCHAR *schema_name_sql, const SQLSMALLINT schema_name_sz, const SQLCHAR *table_name_sql, const SQLSMALLINT table_name_sz, const SQLCHAR *table_type_sql, const SQLSMALLINT table_type_sz, const UWORD flag) { - CSTR func = "ESAPI_Tables"; + CSTR func = "OPENSEARCHAPI_Tables"; StatementClass *stmt = (StatementClass *)hstmt; StatementClass *tbl_stmt = NULL; RETCODE result = SQL_ERROR; @@ -799,7 +814,7 @@ ESAPI_Tables(HSTMT hstmt, const SQLCHAR *catalog_name_sql, } RETCODE SQL_API -ESAPI_Columns(HSTMT hstmt, const SQLCHAR *catalog_name_sql, +OPENSEARCHAPI_Columns(HSTMT hstmt, const SQLCHAR *catalog_name_sql, const SQLSMALLINT catalog_name_sz, const SQLCHAR *schema_name_sql, const SQLSMALLINT schema_name_sz, const SQLCHAR *table_name_sql, const SQLSMALLINT table_name_sz, const SQLCHAR *column_name_sql, @@ -808,7 +823,7 @@ ESAPI_Columns(HSTMT hstmt, const SQLCHAR *catalog_name_sql, (void)(reloid); (void)(attnum); - CSTR func = "ESAPI_Columns"; + CSTR func = "OPENSEARCHAPI_Columns"; // Declare outside of try so we can clean them up properly if an exception // occurs @@ -841,7 +856,7 @@ ESAPI_Columns(HSTMT hstmt, const SQLCHAR *catalog_name_sql, if (table_valid) { ConnectionClass *conn = SC_get_conn(stmt); list_of_columns = - ESGetColumnsWithSelectQuery(conn->esconn, table_name); + OpenSearchGetColumnsWithSelectQuery(conn->opensearchconn, table_name); } // TODO #324 (SQL Plugin)- evaluate catalog & schema support @@ -878,40 +893,46 @@ void CleanUp_GetTypeInfo(StatementClass *stmt, const RETCODE ret = SQL_ERROR) { } void SetupTypeQResInfo(QResultClass *res) { - QR_set_field_info_v(res, GETTYPE_TYPE_NAME, TYPE_NAME, ES_TYPE_VARCHAR, + QR_set_field_info_v(res, GETTYPE_TYPE_NAME, TYPE_NAME, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, GETTYPE_DATA_TYPE, DATA_TYPE, ES_TYPE_INT2, 2); - QR_set_field_info_v(res, GETTYPE_COLUMN_SIZE, PRECISION, ES_TYPE_INT4, 4); + QR_set_field_info_v(res, GETTYPE_DATA_TYPE, DATA_TYPE, OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, GETTYPE_COLUMN_SIZE, PRECISION, + OPENSEARCH_TYPE_INT4, 4); QR_set_field_info_v(res, GETTYPE_LITERAL_PREFIX, LITERAL_PREFIX, - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, GETTYPE_LITERAL_SUFFIX, LITERAL_SUFFIX, - ES_TYPE_VARCHAR, MAX_INFO_STRING); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); QR_set_field_info_v(res, GETTYPE_CREATE_PARAMS, CREATE_PARAMS, - ES_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, GETTYPE_NULLABLE, NULLABLE, ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); + QR_set_field_info_v(res, GETTYPE_NULLABLE, NULLABLE, OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, GETTYPE_CASE_SENSITIVE, CASE_SENSITIVE, - ES_TYPE_INT2, 2); - QR_set_field_info_v(res, GETTYPE_SEARCHABLE, SEARCHABLE, ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_INT2, 2); + QR_set_field_info_v(res, GETTYPE_SEARCHABLE, SEARCHABLE, + OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, GETTYPE_UNSIGNED_ATTRIBUTE, UNSIGNED_ATTRIBUTE, - ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, GETTYPE_FIXED_PREC_SCALE, FIXED_PREC_SCALE, - ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, GETTYPE_AUTO_UNIQUE_VALUE, AUTO_INCREMENT, - ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, GETTYPE_LOCAL_TYPE_NAME, LOCAL_TYPE_NAME, - ES_TYPE_VARCHAR, MAX_INFO_STRING); - QR_set_field_info_v(res, GETTYPE_MINIMUM_SCALE, MINIMUM_SCALE, ES_TYPE_INT2, + OPENSEARCH_TYPE_VARCHAR, MAX_INFO_STRING); + QR_set_field_info_v(res, GETTYPE_MINIMUM_SCALE, MINIMUM_SCALE, + OPENSEARCH_TYPE_INT2, 2); - QR_set_field_info_v(res, GETTYPE_MAXIMUM_SCALE, MAXIMUM_SCALE, ES_TYPE_INT2, + QR_set_field_info_v(res, GETTYPE_MAXIMUM_SCALE, MAXIMUM_SCALE, + OPENSEARCH_TYPE_INT2, 2); - QR_set_field_info_v(res, GETTYPE_SQL_DATA_TYPE, SQL_DATA_TYPE, ES_TYPE_INT2, + QR_set_field_info_v(res, GETTYPE_SQL_DATA_TYPE, SQL_DATA_TYPE, + OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, GETTYPE_SQL_DATETIME_SUB, SQL_DATETIME_SUB, - ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_INT2, 2); QR_set_field_info_v(res, GETTYPE_NUM_PREC_RADIX, NUM_PREC_RADIX, - ES_TYPE_INT4, 4); + OPENSEARCH_TYPE_INT4, 4); QR_set_field_info_v(res, GETTYPE_INTERVAL_PRECISION, INTERVAL_PRECISION, - ES_TYPE_INT2, 2); + OPENSEARCH_TYPE_INT2, 2); } RETCODE SetTypeResult(ConnectionClass *conn, StatementClass *stmt, @@ -926,18 +947,18 @@ RETCODE SetTypeResult(ConnectionClass *conn, StatementClass *stmt, } set_tuplefield_string(&tuple[GETTYPE_TYPE_NAME], - estype_attr_to_name(conn, esType, -1, FALSE)); + opensearchtype_attr_to_name(conn, esType, -1, FALSE)); set_tuplefield_int2(&tuple[GETTYPE_NULLABLE], - estype_nullable(conn, esType)); + opensearchtype_nullable(conn, esType)); set_tuplefield_int2(&tuple[GETTYPE_DATA_TYPE], static_cast< short >(sqlType)); set_tuplefield_int2(&tuple[GETTYPE_CASE_SENSITIVE], - estype_case_sensitive(conn, esType)); + opensearchtype_case_sensitive(conn, esType)); set_tuplefield_int2(&tuple[GETTYPE_SEARCHABLE], - estype_searchable(conn, esType)); + opensearchtype_searchable(conn, esType)); set_tuplefield_int2(&tuple[GETTYPE_FIXED_PREC_SCALE], - estype_money(conn, esType)); + opensearchtype_money(conn, esType)); // Localized data-source dependent data type name (always NULL) set_tuplefield_null(&tuple[GETTYPE_LOCAL_TYPE_NAME]); @@ -945,35 +966,37 @@ RETCODE SetTypeResult(ConnectionClass *conn, StatementClass *stmt, // These values can be NULL set_nullfield_int4( &tuple[GETTYPE_COLUMN_SIZE], - estype_attr_column_size(conn, esType, ES_ATP_UNSET, ES_ADT_UNSET, - ES_UNKNOWNS_UNSET)); + opensearchtype_attr_column_size( + conn, esType, OPENSEARCH_ATP_UNSET, + OPENSEARCH_ADT_UNSET, OPENSEARCH_UNKNOWNS_UNSET)); set_nullfield_string(&tuple[GETTYPE_LITERAL_PREFIX], - estype_literal_prefix(conn, esType)); + opensearchtype_literal_prefix(conn, esType)); set_nullfield_string(&tuple[GETTYPE_LITERAL_SUFFIX], - estype_literal_suffix(conn, esType)); + opensearchtype_literal_suffix(conn, esType)); set_nullfield_string(&tuple[GETTYPE_CREATE_PARAMS], - estype_create_params(conn, esType)); + opensearchtype_create_params(conn, esType)); set_nullfield_int2(&tuple[GETTYPE_UNSIGNED_ATTRIBUTE], - estype_unsigned(conn, esType)); + opensearchtype_unsigned(conn, esType)); set_nullfield_int2(&tuple[GETTYPE_AUTO_UNIQUE_VALUE], - estype_auto_increment(conn, esType)); + opensearchtype_auto_increment(conn, esType)); set_nullfield_int2(&tuple[GETTYPE_MINIMUM_SCALE], - estype_min_decimal_digits(conn, esType)); + opensearchtype_min_decimal_digits(conn, esType)); set_nullfield_int2(&tuple[GETTYPE_MAXIMUM_SCALE], - estype_max_decimal_digits(conn, esType)); + opensearchtype_max_decimal_digits(conn, esType)); set_tuplefield_int2(&tuple[GETTYPE_SQL_DATA_TYPE], static_cast< short >(sqlType)); set_nullfield_int2(&tuple[GETTYPE_SQL_DATETIME_SUB], - estype_attr_to_datetime_sub(conn, esType, ES_ATP_UNSET)); + opensearchtype_attr_to_datetime_sub( + conn, esType, OPENSEARCH_ATP_UNSET)); set_nullfield_int4(&tuple[GETTYPE_NUM_PREC_RADIX], - estype_radix(conn, esType)); + opensearchtype_radix(conn, esType)); set_nullfield_int4(&tuple[GETTYPE_INTERVAL_PRECISION], 0); return SQL_SUCCESS; } -RETCODE SQL_API ESAPI_GetTypeInfo(HSTMT hstmt, SQLSMALLINT fSqlType) { - CSTR func = "ESAPI_GetTypeInfo"; +RETCODE SQL_API OPENSEARCHAPI_GetTypeInfo(HSTMT hstmt, SQLSMALLINT fSqlType) { + CSTR func = "OPENSEARCHAPI_GetTypeInfo"; StatementClass *stmt = (StatementClass *)hstmt; ConnectionClass *conn; conn = SC_get_conn(stmt); @@ -1003,16 +1026,17 @@ RETCODE SQL_API ESAPI_GetTypeInfo(HSTMT hstmt, SQLSMALLINT fSqlType) { if (fSqlType == SQL_ALL_TYPES) { for (std::pair< int, std::vector< int > > sqlType : - sql_es_type_map) { - for (auto const &esType : sqlType.second) { + sql_opensearch_type_map) { + for (auto const &openSearchType : sqlType.second) { result = - SetTypeResult(conn, stmt, res, esType, sqlType.first); + SetTypeResult(conn, stmt, res, openSearchType, sqlType.first); } } } else { - if (sql_es_type_map.count(fSqlType) > 0) { - for (auto esType : sql_es_type_map.at(fSqlType)) { - result = SetTypeResult(conn, stmt, res, esType, fSqlType); + if (sql_opensearch_type_map.count(fSqlType) > 0) { + for (auto openSearchType : + sql_opensearch_type_map.at(fSqlType)) { + result = SetTypeResult(conn, stmt, res, openSearchType, fSqlType); } } } diff --git a/sql-odbc/src/odfesqlodbc/es_info.h b/sql-odbc/src/odfesqlodbc/opensearch_info.h similarity index 78% rename from sql-odbc/src/odfesqlodbc/es_info.h rename to sql-odbc/src/odfesqlodbc/opensearch_info.h index 17db5847cc..999dc035dc 100644 --- a/sql-odbc/src/odfesqlodbc/es_info.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_info.h @@ -14,10 +14,10 @@ * */ -#ifndef __ES_INFO_H__ -#define __ES_INFO_H__ -#include "es_helper.h" -#include "es_odbc.h" +#ifndef __OPENSEARCH_INFO_H__ +#define __OPENSEARCH_INFO_H__ +#include "opensearch_helper.h" +#include "opensearch_odbc.h" #include "unicode_support.h" #ifndef WIN32 @@ -28,11 +28,11 @@ #include "catfunc.h" #include "dlg_specific.h" #include "environ.h" -#include "es_apifunc.h" -#include "es_connection.h" -#include "es_types.h" #include "misc.h" #include "multibyte.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" +#include "opensearch_types.h" #include "qresult.h" #include "statement.h" #include "tuple.h" @@ -41,7 +41,7 @@ #ifdef __cplusplus extern "C" { #endif -RETCODE SQL_API ESAPI_Tables(HSTMT hstmt, const SQLCHAR* catalog_name_sql, +RETCODE SQL_API OPENSEARCHAPI_Tables(HSTMT hstmt, const SQLCHAR* catalog_name_sql, const SQLSMALLINT catalog_name_sz, const SQLCHAR* schema_name_sql, const SQLSMALLINT schema_name_sz, @@ -50,16 +50,16 @@ RETCODE SQL_API ESAPI_Tables(HSTMT hstmt, const SQLCHAR* catalog_name_sql, const SQLCHAR* table_type_sql, const SQLSMALLINT table_type_sz, const UWORD flag); RETCODE SQL_API -ESAPI_Columns(HSTMT hstmt, const SQLCHAR* catalog_name_sql, +OPENSEARCHAPI_Columns(HSTMT hstmt, const SQLCHAR* catalog_name_sql, const SQLSMALLINT catalog_name_sz, const SQLCHAR* schema_name_sql, const SQLSMALLINT schema_name_sz, const SQLCHAR* table_name_sql, const SQLSMALLINT table_name_sz, const SQLCHAR* column_name_sql, const SQLSMALLINT column_name_sz, const UWORD flag, const OID reloid, const Int2 attnum); -RETCODE SQL_API ESAPI_GetTypeInfo(HSTMT hstmt, SQLSMALLINT fSqlType); +RETCODE SQL_API OPENSEARCHAPI_GetTypeInfo(HSTMT hstmt, SQLSMALLINT fSqlType); #ifdef __cplusplus } #endif -#endif /* __ES_INFO_H__ */ +#endif /* __OPENSEARCH_INFO_H__ */ diff --git a/sql-odbc/src/odfesqlodbc/es_odbc.c b/sql-odbc/src/odfesqlodbc/opensearch_odbc.c similarity index 96% rename from sql-odbc/src/odfesqlodbc/es_odbc.c rename to sql-odbc/src/odfesqlodbc/opensearch_odbc.c index 40ec6a4e08..ec3aab0e4a 100644 --- a/sql-odbc/src/odfesqlodbc/es_odbc.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_odbc.c @@ -20,9 +20,10 @@ #endif /* _DEBUG */ #endif /* WIN32 */ #include + #include "dlg_specific.h" #include "environ.h" -#include "es_odbc.h" +#include "opensearch_odbc.h" #include "misc.h" #ifdef WIN32 @@ -108,14 +109,14 @@ BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) { else if (strnicmp(exename, "sqlservr", 8) == 0) exeesm = 3; initialize_global_cs(); - MYLOG(ES_DEBUG, "exe name=%s\n", exename); + MYLOG(OPENSEARCH_DEBUG, "exe name=%s\n", exename); break; case DLL_THREAD_ATTACH: break; case DLL_PROCESS_DETACH: - MYLOG(ES_DEBUG, "DETACHING %s\n", DRIVER_FILE_NAME); + MYLOG(OPENSEARCH_DEBUG, "DETACHING %s\n", DRIVER_FILE_NAME); CleanupDelayLoadedDLLs(); /* my(q)log is unavailable from here */ finalize_global_cs(); diff --git a/sql-odbc/src/odfesqlodbc/es_odbc.h b/sql-odbc/src/odfesqlodbc/opensearch_odbc.h similarity index 93% rename from sql-odbc/src/odfesqlodbc/es_odbc.h rename to sql-odbc/src/odfesqlodbc/opensearch_odbc.h index d5dff8e683..fb68577eb8 100644 --- a/sql-odbc/src/odfesqlodbc/es_odbc.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_odbc.h @@ -14,8 +14,8 @@ * */ -#ifndef __ESODBC_H__ -#define __ESODBC_H__ +#ifndef __OPENSEARCHODBC_H__ +#define __OPENSEARCHODBC_H__ #include /* #define __MS_REPORTS_ANSI_CHAR__ */ @@ -54,15 +54,15 @@ void unused_vargs(int cnt, ...); #if defined(__GNUC__) || defined(__IBMC__) #if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 404 -#define ES_PRINTF_ATTRIBUTE gnu_printf +#define OPENSEARCH_PRINTF_ATTRIBUTE gnu_printf #else -#define ES_PRINTF_ATTRIBUTE printf +#define OPENSEARCH_PRINTF_ATTRIBUTE printf #endif -#define es_attribute_printf(f, a) \ - __attribute__((format(ES_PRINTF_ATTRIBUTE, f, a))) +#define opensearch_attribute_printf(f, a) \ + __attribute__((format(OPENSEARCH_PRINTF_ATTRIBUTE, f, a))) #else #define __attribute__(x) -#define es_attribute_printf(f, a) +#define opensearch_attribute_printf(f, a) #endif /* __GNUC__ || __IBMC__ */ #ifdef _MEMORY_DEBUG_ @@ -324,10 +324,10 @@ extern int posix_snprintf(char *buf, size_t size, const char *format, ...); /* Driver stuff */ -#define DRIVERNAME "Elasticsearch ODBC" +#define DRIVERNAME "OpenSearch ODBC" -#define DBMS_NAME_UNICODE "Elasticsearch Unicode" -#define DBMS_NAME_ANSI "Elasticsearch ANSI" +#define DBMS_NAME_UNICODE "OpenSearch Unicode" +#define DBMS_NAME_ANSI "OpenSearch ANSI" #define DRIVER_ODBC_VER "03.51" @@ -362,7 +362,7 @@ SQLULEN ucs2strlen(const SQLWCHAR *); #endif /* DBMS_NAME */ #ifndef DBMS_NAME -#define DBMS_NAME "Elasticsearch Legacy" +#define DBMS_NAME "OpenSearch Legacy" #endif /* DBMS_NAME */ #ifdef WIN32 #ifdef UNICODE_SUPPORT @@ -391,8 +391,8 @@ BOOL isSqlServr(void); #define ODBC_ESCAPE_END '}' #define DOLLAR_QUOTE '$' #define LITERAL_EXT 'E' -#define ES_CARRIAGE_RETURN '\r' -#define ES_LINEFEED '\n' +#define OPENSEARCH_CARRIAGE_RETURN '\r' +#define OPENSEARCH_LINEFEED '\n' /* Limits */ #define MAXESPATH 1024 @@ -465,10 +465,10 @@ typedef struct IPDFields_ IPDFields; typedef struct col_info COL_INFO; typedef struct lo_arg LO_ARG; -/* esNAME type define */ +/* opensearchNAME type define */ typedef struct { char *name; -} esNAME; +} opensearchNAME; #define GET_NAME(the_name) ((the_name).name) #define SAFE_NAME(the_name) ((the_name).name ? (the_name).name : NULL_STRING) #define PRINT_NAME(the_name) ((the_name).name ? (the_name).name : PRINT_NULL) @@ -526,10 +526,10 @@ typedef struct { #define NAMECMP(name1, name2) (strcmp(SAFE_NAME(name1), SAFE_NAME(name2))) #define NAMEICMP(name1, name2) (stricmp(SAFE_NAME(name1), SAFE_NAME(name2))) -/* esNAME define end */ +/* opensearchNAME define end */ typedef struct GlobalValues_ { - esNAME drivername; + opensearchNAME drivername; char output_dir[LARGE_REGISTRY_LEN]; int loglevel; } GLOBAL_VALUES; @@ -568,20 +568,20 @@ typedef struct { char sqlstate[6]; SQLLEN diag_row_count; char __error_message[40]; -} ES_ErrorInfo; -ES_ErrorInfo *ER_Constructor(SDWORD errornumber, const char *errormsg); -ES_ErrorInfo *ER_Dup(const ES_ErrorInfo *from); -void ER_Destructor(ES_ErrorInfo *); -RETCODE SQL_API ER_ReturnError(ES_ErrorInfo *, SQLSMALLINT, UCHAR *, +} OpenSearch_ErrorInfo; +OpenSearch_ErrorInfo *ER_Constructor(SDWORD errornumber, const char *errormsg); +OpenSearch_ErrorInfo *ER_Dup(const OpenSearch_ErrorInfo *from); +void ER_Destructor(OpenSearch_ErrorInfo *); +RETCODE SQL_API ER_ReturnError(OpenSearch_ErrorInfo *, SQLSMALLINT, UCHAR *, SQLINTEGER *, UCHAR *, SQLSMALLINT, SQLSMALLINT *, UWORD); void logs_on_off(int cnopen, int, int); -#define ES_TYPE_LO_UNDEFINED \ +#define OPENSEARCH_TYPE_LO_UNDEFINED \ (-999) /* hack until permanent \ \ * type available */ -#define ES_TYPE_LO_NAME "lo" +#define OPENSEARCH_TYPE_LO_NAME "lo" #define CTID_ATTNUM (-1) /* the attnum of ctid */ #define OID_ATTNUM (-2) /* the attnum of oid */ #define XMIN_ATTNUM (-3) /* the attnum of xmin */ @@ -597,12 +597,12 @@ void logs_on_off(int cnopen, int, int); 254 /* varchar field size \ \ * used in info.c */ -#define ES_NUMERIC_MAX_PRECISION 1000 -#define ES_NUMERIC_MAX_SCALE 1000 +#define OPENSEARCH_NUMERIC_MAX_PRECISION 1000 +#define OPENSEARCH_NUMERIC_MAX_SCALE 1000 /* Sufficient digits to recover original float values */ -#define ES_REAL_DIGITS 9 -#define ES_DOUBLE_DIGITS 17 +#define OPENSEARCH_REAL_DIGITS 9 +#define OPENSEARCH_DOUBLE_DIGITS 17 #define INFO_INQUIRY_LEN \ 8192 /* this seems sufficiently big for \ \ @@ -626,7 +626,7 @@ typedef struct { // Authentication char authtype[MEDIUM_REGISTRY_LEN]; char username[MEDIUM_REGISTRY_LEN]; - esNAME password; + opensearchNAME password; char region[MEDIUM_REGISTRY_LEN]; // Encryption @@ -676,4 +676,4 @@ enum { #include "mylog.h" -#endif /* __ESODBC_H__ */ +#endif /* __OPENSEARCHODBC_H__ */ diff --git a/sql-odbc/src/odfesqlodbc/es_odbc.rc b/sql-odbc/src/odfesqlodbc/opensearch_odbc.rc similarity index 94% rename from sql-odbc/src/odfesqlodbc/es_odbc.rc rename to sql-odbc/src/odfesqlodbc/opensearch_odbc.rc index 6bf66d9af1..d2e2c0c931 100644 --- a/sql-odbc/src/odfesqlodbc/es_odbc.rc +++ b/sql-odbc/src/odfesqlodbc/opensearch_odbc.rc @@ -64,7 +64,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US DLG_CONFIG DIALOGEX 65, 43, 275, 250 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Elasticsearch ODBC Driver DSN Setup" +CAPTION "OpenSearch ODBC Driver DSN Setup" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN LTEXT "Data Source Name",IDC_DSNAMETEXT,23,7,77,12,NOT WS_GROUP @@ -164,8 +164,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION ES_DRVFILE_VERSION - PRODUCTVERSION ES_DRVFILE_VERSION + FILEVERSION OPENSEARCH_DRVFILE_VERSION + PRODUCTVERSION OPENSEARCH_DRVFILE_VERSION FILEFLAGSMASK 0x3L #ifdef _DEBUG FILEFLAGS 0x9L @@ -180,16 +180,16 @@ BEGIN BEGIN BLOCK "040904e4" BEGIN - VALUE "Comments", "Elasticsearch ANSI ODBC driver" + VALUE "Comments", "OpenSearch ANSI ODBC driver" VALUE "CompanyName", "Amazon" - VALUE "FileDescription", "Elasticsearch ODBC Driver (English)" - VALUE "FileVersion", ES_ODBC_VERSION + VALUE "FileDescription", "OpenSearch ODBC Driver (English)" + VALUE "FileVersion", OPENSEARCH_ODBC_VERSION VALUE "InternalName", "odfesqlodbc" VALUE "LegalCopyright", "Copyright" VALUE "LegalTrademarks", "ODBC(TM) is a trademark of Microsoft Corporation. Microsoft? is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation." VALUE "OriginalFilename", "odfesqlodbc.dll" - VALUE "ProductName", "Elasticsearch" - VALUE "ProductVersion", ES_ODBC_VERSION + VALUE "ProductName", "OpenSearch" + VALUE "ProductVersion", OPENSEARCH_ODBC_VERSION END END BLOCK "VarFileInfo" diff --git a/sql-odbc/src/odfesqlodbc/es_parse_result.cpp b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp similarity index 67% rename from sql-odbc/src/odfesqlodbc/es_parse_result.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp index e111bb37f3..874bde96d2 100644 --- a/sql-odbc/src/odfesqlodbc/es_parse_result.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp @@ -14,12 +14,12 @@ * */ -#include "es_parse_result.h" +#include "opensearch_parse_result.h" #include -#include "es_helper.h" -#include "es_types.h" +#include "opensearch_types.h" +#include "opensearch_helper.h" #ifdef __APPLE__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-parameter" @@ -34,16 +34,19 @@ typedef std::vector< std::pair< std::string, OID > > schema_type; typedef rabbit::array json_arr; typedef json_arr::iterator::result_type json_arr_it; -bool _CC_from_ESResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &es_result); -bool _CC_Metadata_from_ESResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &es_result); -bool _CC_No_Metadata_from_ESResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &es_result); -void GetSchemaInfo(schema_type &schema, json_doc &es_result_doc); +bool _CC_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, + OpenSearchResult &opensearch_result); +bool _CC_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, + OpenSearchResult &opensearch_result); +bool _CC_No_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, + OpenSearchResult &opensearch_result); +void GetSchemaInfo(schema_type &schema, json_doc &opensearch_result_doc); bool AssignColumnHeaders(const schema_type &doc_schema, QResultClass *q_res, - const ESResult &es_result); -bool AssignTableData(json_doc &es_result_doc, QResultClass *q_res, + const OpenSearchResult &opensearch_result); +bool AssignTableData(json_doc &opensearch_result_doc, QResultClass *q_res, size_t doc_schema_size, ColumnInfoClass &fields); bool AssignRowData(const json_arr_it &row, size_t row_schema_size, QResultClass *q_res, ColumnInfoClass &fields, @@ -69,33 +72,33 @@ static const std::string JSON_KW_CURSOR = "cursor"; // clang-format on const std::unordered_map< std::string, OID > type_to_oid_map = { - {ES_TYPE_NAME_BOOLEAN, ES_TYPE_BOOL}, - {ES_TYPE_NAME_BYTE, ES_TYPE_INT2}, - {ES_TYPE_NAME_SHORT, ES_TYPE_INT2}, - {ES_TYPE_NAME_INTEGER, ES_TYPE_INT4}, - {ES_TYPE_NAME_LONG, ES_TYPE_INT8}, - {ES_TYPE_NAME_HALF_FLOAT, ES_TYPE_FLOAT4}, - {ES_TYPE_NAME_FLOAT, ES_TYPE_FLOAT4}, - {ES_TYPE_NAME_DOUBLE, ES_TYPE_FLOAT8}, - {ES_TYPE_NAME_SCALED_FLOAT, ES_TYPE_FLOAT8}, - {ES_TYPE_NAME_KEYWORD, ES_TYPE_VARCHAR}, - {ES_TYPE_NAME_TEXT, ES_TYPE_VARCHAR}, - {ES_TYPE_NAME_DATE, ES_TYPE_TIMESTAMP}, - {ES_TYPE_NAME_OBJECT, ES_TYPE_VARCHAR}, - {ES_TYPE_NAME_VARCHAR, ES_TYPE_VARCHAR}, - {ES_TYPE_NAME_DATE, ES_TYPE_DATE}}; - -#define ES_VARCHAR_SIZE (-2) + {OPENSEARCH_TYPE_NAME_BOOLEAN, OPENSEARCH_TYPE_BOOL}, + {OPENSEARCH_TYPE_NAME_BYTE, OPENSEARCH_TYPE_INT2}, + {OPENSEARCH_TYPE_NAME_SHORT, OPENSEARCH_TYPE_INT2}, + {OPENSEARCH_TYPE_NAME_INTEGER, OPENSEARCH_TYPE_INT4}, + {OPENSEARCH_TYPE_NAME_LONG, OPENSEARCH_TYPE_INT8}, + {OPENSEARCH_TYPE_NAME_HALF_FLOAT, OPENSEARCH_TYPE_FLOAT4}, + {OPENSEARCH_TYPE_NAME_FLOAT, OPENSEARCH_TYPE_FLOAT4}, + {OPENSEARCH_TYPE_NAME_DOUBLE, OPENSEARCH_TYPE_FLOAT8}, + {OPENSEARCH_TYPE_NAME_SCALED_FLOAT, OPENSEARCH_TYPE_FLOAT8}, + {OPENSEARCH_TYPE_NAME_KEYWORD, OPENSEARCH_TYPE_VARCHAR}, + {OPENSEARCH_TYPE_NAME_TEXT, OPENSEARCH_TYPE_VARCHAR}, + {OPENSEARCH_TYPE_NAME_DATE, OPENSEARCH_TYPE_TIMESTAMP}, + {OPENSEARCH_TYPE_NAME_OBJECT, OPENSEARCH_TYPE_VARCHAR}, + {OPENSEARCH_TYPE_NAME_VARCHAR, OPENSEARCH_TYPE_VARCHAR}, + {OPENSEARCH_TYPE_NAME_DATE, OPENSEARCH_TYPE_DATE}}; + +#define OPENSEARCH_VARCHAR_SIZE (-2) const std::unordered_map< OID, int16_t > oid_to_size_map = { - {ES_TYPE_BOOL, (int16_t)1}, - {ES_TYPE_INT2, (int16_t)2}, - {ES_TYPE_INT4, (int16_t)4}, - {ES_TYPE_INT8, (int16_t)8}, - {ES_TYPE_FLOAT4, (int16_t)4}, - {ES_TYPE_FLOAT8, (int16_t)8}, - {ES_TYPE_VARCHAR, (int16_t)ES_VARCHAR_SIZE}, - {ES_TYPE_DATE, (int16_t)ES_VARCHAR_SIZE}, - {ES_TYPE_TIMESTAMP, (int16_t)1}}; + {OPENSEARCH_TYPE_BOOL, (int16_t)1}, + {OPENSEARCH_TYPE_INT2, (int16_t)2}, + {OPENSEARCH_TYPE_INT4, (int16_t)4}, + {OPENSEARCH_TYPE_INT8, (int16_t)8}, + {OPENSEARCH_TYPE_FLOAT4, (int16_t)4}, + {OPENSEARCH_TYPE_FLOAT8, (int16_t)8}, + {OPENSEARCH_TYPE_VARCHAR, (int16_t)OPENSEARCH_VARCHAR_SIZE}, + {OPENSEARCH_TYPE_DATE, (int16_t)OPENSEARCH_VARCHAR_SIZE}, + {OPENSEARCH_TYPE_TIMESTAMP, (int16_t)1}}; // Using global variable here so that the error message can be propagated // without going otu of scope @@ -111,54 +114,60 @@ std::string GetResultParserError() { return error_msg; } -BOOL CC_from_ESResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &es_result) { +BOOL CC_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, + OpenSearchResult &opensearch_result) { ClearError(); - return _CC_from_ESResult(q_res, conn, cursor, es_result) ? TRUE : FALSE; + return _CC_from_OpenSearchResult(q_res, conn, cursor, opensearch_result) ? TRUE : FALSE; } -BOOL CC_Metadata_from_ESResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &es_result) { +BOOL CC_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, + OpenSearchResult &opensearch_result) { ClearError(); - return _CC_Metadata_from_ESResult(q_res, conn, cursor, es_result) ? TRUE : FALSE; + return _CC_Metadata_from_OpenSearchResult(q_res, conn, cursor, + opensearch_result) ? TRUE : FALSE; } -BOOL CC_No_Metadata_from_ESResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &es_result) { +BOOL CC_No_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, + OpenSearchResult &opensearch_result) { ClearError(); - return _CC_No_Metadata_from_ESResult(q_res, conn, cursor, es_result) + return _CC_No_Metadata_from_OpenSearchResult(q_res, conn, cursor, + opensearch_result) ? TRUE : FALSE; } -BOOL CC_Append_Table_Data(json_doc &es_result_doc, QResultClass *q_res, +BOOL CC_Append_Table_Data(json_doc &opensearch_result_doc, QResultClass *q_res, size_t doc_schema_size, ColumnInfoClass &fields) { ClearError(); - return AssignTableData(es_result_doc, q_res, doc_schema_size, fields) + return AssignTableData(opensearch_result_doc, q_res, doc_schema_size, fields) ? TRUE : FALSE; } -bool _CC_No_Metadata_from_ESResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &es_result) { +bool _CC_No_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, + OpenSearchResult &opensearch_result) { // Note - NULL conn and/or cursor is valid if (q_res == NULL) return false; try { schema_type doc_schema; - GetSchemaInfo(doc_schema, es_result.es_result_doc); + GetSchemaInfo(doc_schema, opensearch_result.opensearch_result_doc); SQLULEN starting_cached_rows = q_res->num_cached_rows; // Assign table data and column headers - if (!AssignTableData(es_result.es_result_doc, q_res, doc_schema.size(), + if (!AssignTableData(opensearch_result.opensearch_result_doc, q_res, doc_schema.size(), *(q_res->fields))) return false; // Update fields of QResult to reflect data written UpdateResultFields(q_res, conn, starting_cached_rows, cursor, - es_result.command_type); + opensearch_result.command_type); // Return true (success) return true; @@ -169,15 +178,16 @@ bool _CC_No_Metadata_from_ESResult(QResultClass *q_res, ConnectionClass *conn, } catch (const std::exception &e) { SetError(e.what()); } catch (...) { - SetError("Unknown exception thrown in _CC_No_Metadata_from_ESResult."); + SetError("Unknown exception thrown in _CC_No_Metadata_from_OpenSearchResult."); } // Exception occurred, return false (error) return false; } -bool _CC_Metadata_from_ESResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &es_result) { +bool _CC_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, + OpenSearchResult &opensearch_result) { // Note - NULL conn and/or cursor is valid if (q_res == NULL) return false; @@ -185,14 +195,14 @@ bool _CC_Metadata_from_ESResult(QResultClass *q_res, ConnectionClass *conn, QR_set_conn(q_res, conn); try { schema_type doc_schema; - GetSchemaInfo(doc_schema, es_result.es_result_doc); + GetSchemaInfo(doc_schema, opensearch_result.opensearch_result_doc); // Assign table data and column headers - if (!AssignColumnHeaders(doc_schema, q_res, es_result)) + if (!AssignColumnHeaders(doc_schema, q_res, opensearch_result)) return false; // Set command type and cursor name - QR_set_command(q_res, es_result.command_type.c_str()); + QR_set_command(q_res, opensearch_result.command_type.c_str()); QR_set_cursor(q_res, cursor); if (cursor == NULL) QR_set_reached_eof(q_res); @@ -206,15 +216,16 @@ bool _CC_Metadata_from_ESResult(QResultClass *q_res, ConnectionClass *conn, } catch (const std::exception &e) { SetError(e.what()); } catch (...) { - SetError("Unknown exception thrown in _CC_Metadata_from_ESResult."); + SetError("Unknown exception thrown in _CC_Metadata_from_OpenSearchResult."); } // Exception occurred, return false (error) return false; } -bool _CC_from_ESResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &es_result) { +bool _CC_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, + OpenSearchResult &opensearch_result) { // Note - NULL conn and/or cursor is valid if (q_res == NULL) return false; @@ -222,18 +233,18 @@ bool _CC_from_ESResult(QResultClass *q_res, ConnectionClass *conn, QR_set_conn(q_res, conn); try { schema_type doc_schema; - GetSchemaInfo(doc_schema, es_result.es_result_doc); + GetSchemaInfo(doc_schema, opensearch_result.opensearch_result_doc); SQLULEN starting_cached_rows = q_res->num_cached_rows; // Assign table data and column headers - if ((!AssignColumnHeaders(doc_schema, q_res, es_result)) - || (!AssignTableData(es_result.es_result_doc, q_res, doc_schema.size(), + if ((!AssignColumnHeaders(doc_schema, q_res, opensearch_result)) + || (!AssignTableData(opensearch_result.opensearch_result_doc, q_res, doc_schema.size(), *(q_res->fields)))) return false; // Update fields of QResult to reflect data written UpdateResultFields(q_res, conn, starting_cached_rows, cursor, - es_result.command_type); + opensearch_result.command_type); // Return true (success) return true; @@ -244,15 +255,15 @@ bool _CC_from_ESResult(QResultClass *q_res, ConnectionClass *conn, } catch (const std::exception &e) { SetError(e.what()); } catch (...) { - SetError("Unknown exception thrown in CC_from_ESResult."); + SetError("Unknown exception thrown in CC_from_OpenSearchResult."); } // Exception occurred, return false (error) return false; } -void GetSchemaInfo(schema_type &schema, json_doc &es_result_doc) { - json_arr schema_arr = es_result_doc[JSON_KW_SCHEMA]; +void GetSchemaInfo(schema_type &schema, json_doc &opensearch_result_doc) { + json_arr schema_arr = opensearch_result_doc[JSON_KW_SCHEMA]; for (auto it : schema_arr) { auto mapped_oid = type_to_oid_map.find(it[JSON_KW_TYPE].as_string()); OID type_oid = (mapped_oid == type_to_oid_map.end()) @@ -264,13 +275,13 @@ void GetSchemaInfo(schema_type &schema, json_doc &es_result_doc) { } bool AssignColumnHeaders(const schema_type &doc_schema, QResultClass *q_res, - const ESResult &es_result) { + const OpenSearchResult &opensearch_result) { // Verify server_info size matches the schema size - if (es_result.column_info.size() != doc_schema.size()) + if (opensearch_result.column_info.size() != doc_schema.size()) return false; // Allocte memory for column fields - QR_set_num_fields(q_res, (uint16_t)es_result.column_info.size()); + QR_set_num_fields(q_res, (uint16_t)opensearch_result.column_info.size()); if (QR_get_fields(q_res)->coli_array == NULL) return false; @@ -278,13 +289,14 @@ bool AssignColumnHeaders(const schema_type &doc_schema, QResultClass *q_res, for (size_t i = 0; i < doc_schema.size(); i++) { auto type_size_ptr = oid_to_size_map.find(doc_schema[i].second); int16_t type_size = (type_size_ptr == oid_to_size_map.end()) - ? ES_ADT_UNSET + ? OPENSEARCH_ADT_UNSET : type_size_ptr->second; CI_set_field_info(QR_get_fields(q_res), (int)i, doc_schema[i].first.c_str(), doc_schema[i].second, - type_size, es_result.column_info[i].length_of_str, - es_result.column_info[i].relation_id, - es_result.column_info[i].attribute_number); + type_size, + opensearch_result.column_info[i].length_of_str, + opensearch_result.column_info[i].relation_id, + opensearch_result.column_info[i].attribute_number); QR_set_rstatus(q_res, PORES_FIELDS_OK); } q_res->num_fields = CI_get_num_fields(QR_get_fields(q_res)); @@ -294,21 +306,21 @@ bool AssignColumnHeaders(const schema_type &doc_schema, QResultClass *q_res, // Responsible for looping through rows, allocating tuples and passing rows for // assignment -bool AssignTableData(json_doc &es_result_doc, QResultClass *q_res, +bool AssignTableData(json_doc &opensearch_result_doc, QResultClass *q_res, size_t doc_schema_size, ColumnInfoClass &fields) { // Assign row info - json_arr es_result_data = es_result_doc[JSON_KW_DATAROWS]; - if (es_result_data.size() == 0) + json_arr opensearch_result_data = opensearch_result_doc[JSON_KW_DATAROWS]; + if (opensearch_result_data.size() == 0) return true; // Figure out number of columns are in a row and make schema is not bigger // than it - size_t row_size = std::distance(es_result_data.begin()->value_begin(), - es_result_data.begin()->value_end()); + size_t row_size = std::distance(opensearch_result_data.begin()->value_begin(), + opensearch_result_data.begin()->value_end()); if (row_size < doc_schema_size) { return false; } - for (auto it : es_result_data) { + for (auto it : opensearch_result_data) { // Setup memory to receive tuple if (!QR_prepare_for_tupledata(q_res)) return false; diff --git a/sql-odbc/src/odfesqlodbc/es_parse_result.h b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.h similarity index 57% rename from sql-odbc/src/odfesqlodbc/es_parse_result.h rename to sql-odbc/src/odfesqlodbc/opensearch_parse_result.h index 0543c6ac0d..0678e7044e 100644 --- a/sql-odbc/src/odfesqlodbc/es_parse_result.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.h @@ -14,8 +14,8 @@ * */ -#ifndef _ES_PARSE_RESULT_H_ -#define _ES_PARSE_RESULT_H_ +#ifndef _OPENSEARCH_PARSE_RESULT_H_ +#define _OPENSEARCH_PARSE_RESULT_H_ #include "qresult.h" #ifdef __cplusplus @@ -27,18 +27,21 @@ extern "C" { #endif #ifdef __cplusplus -#include "es_helper.h" +#include "opensearch_helper.h" typedef rabbit::document json_doc; // const char* is used instead of string for the cursor, because a NULL cursor // is sometimes used Cannot pass q_res as reference because it breaks qresult.h // macros that expect to use -> operator -BOOL CC_from_ESResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &es_result); -BOOL CC_Metadata_from_ESResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &es_result); -BOOL CC_No_Metadata_from_ESResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &es_result); -BOOL CC_Append_Table_Data(json_doc &es_result_doc, QResultClass *q_res, +BOOL CC_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, + OpenSearchResult &opensearch_result); +BOOL CC_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, + OpenSearchResult &opensearch_result); +BOOL CC_No_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, + OpenSearchResult &opensearch_result); +BOOL CC_Append_Table_Data(json_doc &opensearch_result_doc, QResultClass *q_res, size_t doc_schema_size, ColumnInfoClass &fields); #endif #endif diff --git a/sql-odbc/src/odfesqlodbc/es_result_queue.cpp b/sql-odbc/src/odfesqlodbc/opensearch_result_queue.cpp similarity index 78% rename from sql-odbc/src/odfesqlodbc/es_result_queue.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_result_queue.cpp index 0943f1cd0c..f7cab25f1b 100644 --- a/sql-odbc/src/odfesqlodbc/es_result_queue.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_result_queue.cpp @@ -14,23 +14,23 @@ * */ -#include "es_result_queue.h" +#include "opensearch_result_queue.h" -#include "es_types.h" +#include "opensearch_types.h" -ESResultQueue::ESResultQueue(unsigned int capacity) +OpenSearchResultQueue::OpenSearchResultQueue(unsigned int capacity) : m_push_semaphore(capacity, capacity), m_pop_semaphore(0, capacity) { } -ESResultQueue::~ESResultQueue() { +OpenSearchResultQueue::~OpenSearchResultQueue() { while (!m_queue.empty()) { delete m_queue.front(); m_queue.pop(); } } -void ESResultQueue::clear() { +void OpenSearchResultQueue::clear() { std::scoped_lock lock(m_queue_mutex); while (!m_queue.empty()) { delete m_queue.front(); @@ -40,7 +40,7 @@ void ESResultQueue::clear() { } } -bool ESResultQueue::pop(unsigned int timeout_ms, ESResult*& result) { +bool OpenSearchResultQueue::pop(unsigned int timeout_ms, OpenSearchResult*& result) { if (m_pop_semaphore.try_lock_for(timeout_ms)) { std::scoped_lock lock(m_queue_mutex); result = m_queue.front(); @@ -52,7 +52,7 @@ bool ESResultQueue::pop(unsigned int timeout_ms, ESResult*& result) { return false; } -bool ESResultQueue::push(unsigned int timeout_ms, ESResult* result) { +bool OpenSearchResultQueue::push(unsigned int timeout_ms, OpenSearchResult* result) { if (m_push_semaphore.try_lock_for(timeout_ms)) { std::scoped_lock lock(m_queue_mutex); m_queue.push(result); diff --git a/sql-odbc/src/odfesqlodbc/es_result_queue.h b/sql-odbc/src/odfesqlodbc/opensearch_result_queue.h similarity index 59% rename from sql-odbc/src/odfesqlodbc/es_result_queue.h rename to sql-odbc/src/odfesqlodbc/opensearch_result_queue.h index d624d38934..0ffe03def3 100644 --- a/sql-odbc/src/odfesqlodbc/es_result_queue.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_result_queue.h @@ -13,31 +13,32 @@ * permissions and limitations under the License. * */ -#ifndef ES_RESULT_QUEUE -#define ES_RESULT_QUEUE +#ifndef OPENSEARCH_RESULT_QUEUE +#define OPENSEARCH_RESULT_QUEUE -#include #include -#include "es_semaphore.h" +#include + +#include "opensearch_semaphore.h" #define QUEUE_TIMEOUT 20 // milliseconds -struct ESResult; +struct OpenSearchResult; -class ESResultQueue { +class OpenSearchResultQueue { public: - ESResultQueue(unsigned int capacity); - ~ESResultQueue(); + OpenSearchResultQueue(unsigned int capacity); + ~OpenSearchResultQueue(); void clear(); - bool pop(unsigned int timeout_ms, ESResult*& result); - bool push(unsigned int timeout_ms, ESResult* result); + bool pop(unsigned int timeout_ms, OpenSearchResult*& result); + bool push(unsigned int timeout_ms, OpenSearchResult* result); private: - std::queue m_queue; + std::queue< OpenSearchResult*> m_queue; std::mutex m_queue_mutex; - es_semaphore m_push_semaphore; - es_semaphore m_pop_semaphore; + opensearch_semaphore m_push_semaphore; + opensearch_semaphore m_pop_semaphore; }; #endif diff --git a/sql-odbc/src/odfesqlodbc/es_semaphore.cpp b/sql-odbc/src/odfesqlodbc/opensearch_semaphore.cpp similarity index 88% rename from sql-odbc/src/odfesqlodbc/es_semaphore.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_semaphore.cpp index eaf1532564..e61cfacc19 100644 --- a/sql-odbc/src/odfesqlodbc/es_semaphore.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_semaphore.cpp @@ -14,7 +14,7 @@ * */ -#include "es_semaphore.h" +#include "opensearch_semaphore.h" #include @@ -39,7 +39,7 @@ HANDLE createSemaphore(unsigned int initial, unsigned int capacity) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-parameter" #endif // __APPLE__ -es_semaphore::es_semaphore(unsigned int initial, unsigned int capacity) +opensearch_semaphore::opensearch_semaphore(unsigned int initial, unsigned int capacity) #ifdef __APPLE__ #pragma clang diagnostic pop #endif // __APPLE__ @@ -55,7 +55,7 @@ es_semaphore::es_semaphore(unsigned int initial, unsigned int capacity) #endif } -es_semaphore::~es_semaphore() { +opensearch_semaphore::~opensearch_semaphore() { #ifdef WIN32 CloseHandle(m_semaphore); #elif defined(__APPLE__) @@ -64,7 +64,7 @@ es_semaphore::~es_semaphore() { #endif } -void es_semaphore::lock() { +void opensearch_semaphore::lock() { #ifdef WIN32 WaitForSingleObject(m_semaphore, INFINITE); #elif defined(__APPLE__) @@ -74,7 +74,7 @@ void es_semaphore::lock() { #endif } -void es_semaphore::release() { +void opensearch_semaphore::release() { #ifdef WIN32 ReleaseSemaphore(m_semaphore, 1, NULL); #elif defined(__APPLE__) @@ -84,7 +84,7 @@ void es_semaphore::release() { #endif } -bool es_semaphore::try_lock_for(unsigned int timeout_ms) { +bool opensearch_semaphore::try_lock_for(unsigned int timeout_ms) { #ifdef WIN32 return WaitForSingleObject(m_semaphore, timeout_ms) == WAIT_OBJECT_0; #elif defined(__APPLE__) diff --git a/sql-odbc/src/odfesqlodbc/es_semaphore.h b/sql-odbc/src/odfesqlodbc/opensearch_semaphore.h similarity index 84% rename from sql-odbc/src/odfesqlodbc/es_semaphore.h rename to sql-odbc/src/odfesqlodbc/opensearch_semaphore.h index 980e4cd6eb..d171162b42 100644 --- a/sql-odbc/src/odfesqlodbc/es_semaphore.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_semaphore.h @@ -13,8 +13,8 @@ * permissions and limitations under the License. * */ -#ifndef ES_SEMAPHORE -#define ES_SEMAPHORE +#ifndef OPENSEARCH_SEMAPHORE +#define OPENSEARCH_SEMAPHORE #ifdef WIN32 #include @@ -24,10 +24,10 @@ #include #endif -class es_semaphore { +class opensearch_semaphore { public: - es_semaphore(unsigned int initial, unsigned int capacity); - ~es_semaphore(); + opensearch_semaphore(unsigned int initial, unsigned int capacity); + ~opensearch_semaphore(); void lock(); void release(); diff --git a/sql-odbc/src/odfesqlodbc/es_statement.cpp b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp similarity index 83% rename from sql-odbc/src/odfesqlodbc/es_statement.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_statement.cpp index afedd5e066..ef3eb59d21 100644 --- a/sql-odbc/src/odfesqlodbc/es_statement.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp @@ -14,12 +14,12 @@ * */ -#include "es_statement.h" +#include "opensearch_statement.h" #include "environ.h" // Critical section for statment -#include "es_apifunc.h" -#include "es_helper.h" #include "misc.h" +#include "opensearch_apifunc.h" +#include "opensearch_helper.h" #include "statement.h" extern "C" void *common_cs; @@ -67,8 +67,8 @@ RETCODE ExecuteStatement(StatementClass *stmt, BOOL commit) { QResultClass *res = SendQueryGetResult(stmt, commit); if (!res) { - std::string es_conn_err = GetErrorMsg(SC_get_conn(stmt)->esconn); - ConnErrorType es_err_type = GetErrorType(SC_get_conn(stmt)->esconn); + std::string es_conn_err = GetErrorMsg(SC_get_conn(stmt)->opensearchconn); + ConnErrorType es_err_type = GetErrorType(SC_get_conn(stmt)->opensearchconn); std::string es_parse_err = GetResultParserError(); if (!es_conn_err.empty()) { if (es_err_type == ConnErrorType::CONN_ERROR_QUERY_SYNTAX) { @@ -171,19 +171,19 @@ SQLRETURN GetNextResultSet(StatementClass *stmt) { return SQL_ERROR; } - ESResult *es_res = ESGetResult(conn->esconn); + OpenSearchResult *es_res = OpenSearchGetResult(conn->opensearchconn); if (es_res != NULL) { // Save server cursor id to fetch more pages later - if (es_res->es_result_doc.has("cursor")) { + if (es_res->opensearch_result_doc.has("cursor")) { QR_set_server_cursor_id( - q_res, es_res->es_result_doc["cursor"].as_string().c_str()); + q_res, es_res->opensearch_result_doc["cursor"].as_string().c_str()); } else { QR_set_server_cursor_id(q_res, NULL); } // Responsible for looping through rows, allocating tuples and // appending these rows in q_result - CC_Append_Table_Data(es_res->es_result_doc, q_res, total_columns, + CC_Append_Table_Data(es_res->opensearch_result_doc, q_res, total_columns, *(q_res->fields)); } @@ -245,15 +245,16 @@ QResultClass *SendQueryGetResult(StatementClass *stmt, BOOL commit) { // Send command ConnectionClass *conn = SC_get_conn(stmt); - if (ESExecDirect(conn->esconn, stmt->statement, conn->connInfo.fetch_size) + if (OpenSearchExecDirect(conn->opensearchconn, stmt->statement, + conn->connInfo.fetch_size) != 0) { QR_Destructor(res); return NULL; } res->rstatus = PORES_COMMAND_OK; - // Get ESResult - ESResult *es_res = ESGetResult(conn->esconn); + // Get OpenSearchResult + OpenSearchResult *es_res = OpenSearchGetResult(conn->opensearchconn); if (es_res == NULL) { QR_Destructor(res); return NULL; @@ -261,8 +262,9 @@ QResultClass *SendQueryGetResult(StatementClass *stmt, BOOL commit) { BOOL success = commit - ? CC_from_ESResult(res, conn, res->cursor_name, *es_res) - : CC_Metadata_from_ESResult(res, conn, res->cursor_name, *es_res); + ? CC_from_OpenSearchResult(res, conn, res->cursor_name, *es_res) + : CC_Metadata_from_OpenSearchResult(res, conn, res->cursor_name, + *es_res); // Convert result to QResultClass if (!success) { @@ -271,12 +273,12 @@ QResultClass *SendQueryGetResult(StatementClass *stmt, BOOL commit) { } if (commit) { - // Deallocate ESResult - ESClearResult(es_res); - res->es_result = NULL; + // Deallocate OpenSearchResult + OpenSearchClearResult(es_res); + res->opensearch_result = NULL; } else { - // Set ESResult into connection class so it can be used later - res->es_result = es_res; + // Set OpenSearchResult into connection class so it can be used later + res->opensearch_result = es_res; } return res; } @@ -286,40 +288,41 @@ RETCODE AssignResult(StatementClass *stmt) { return SQL_ERROR; QResultClass *res = SC_get_Result(stmt); - if (!res || !res->es_result) { + if (!res || !res->opensearch_result) { return SQL_ERROR; } // Commit result to QResultClass - ESResult *es_res = static_cast< ESResult * >(res->es_result); + OpenSearchResult *es_res = static_cast< OpenSearchResult * >(res->opensearch_result); ConnectionClass *conn = SC_get_conn(stmt); - if (!CC_No_Metadata_from_ESResult(res, conn, res->cursor_name, *es_res)) { + if (!CC_No_Metadata_from_OpenSearchResult(res, conn, res->cursor_name, + *es_res)) { QR_Destructor(res); return SQL_ERROR; } GetNextResultSet(stmt); // Deallocate and return result - ESClearResult(es_res); - res->es_result = NULL; + OpenSearchClearResult(es_res); + res->opensearch_result = NULL; return SQL_SUCCESS; } -void ClearESResult(void *es_result) { - if (es_result != NULL) { - ESResult *es_res = static_cast< ESResult * >(es_result); - ESClearResult(es_res); +void ClearOpenSearchResult(void *opensearch_result) { + if (opensearch_result != NULL) { + OpenSearchResult *es_res = static_cast< OpenSearchResult * >(opensearch_result); + OpenSearchClearResult(es_res); } } -SQLRETURN ESAPI_Cancel(HSTMT hstmt) { +SQLRETURN OPENSEARCHAPI_Cancel(HSTMT hstmt) { // Verify pointer validity and convert to StatementClass if (hstmt == NULL) return SQL_INVALID_HANDLE; StatementClass *stmt = (StatementClass *)hstmt; // Get execution delegate (if applicable) and initialize return code - StatementClass *estmt = + StatementClass *opensearchtmt = (stmt->execute_delegate == NULL) ? stmt : stmt->execute_delegate; SQLRETURN ret = SQL_SUCCESS; @@ -327,15 +330,15 @@ SQLRETURN ESAPI_Cancel(HSTMT hstmt) { ENTER_COMMON_CS; // Waiting for more data from SQLParamData/SQLPutData - cancel statement - if (estmt->data_at_exec >= 0) { + if (opensearchtmt->data_at_exec >= 0) { // Enter statement critical section ENTER_STMT_CS(stmt); // Clear info and cancel need data SC_clear_error(stmt); - estmt->data_at_exec = -1; - estmt->put_data = FALSE; - cancelNeedDataState(estmt); + opensearchtmt->data_at_exec = -1; + opensearchtmt->put_data = FALSE; + cancelNeedDataState(opensearchtmt); // Leave statement critical section LEAVE_STMT_CS(stmt); diff --git a/sql-odbc/src/odfesqlodbc/es_statement.h b/sql-odbc/src/odfesqlodbc/opensearch_statement.h similarity index 84% rename from sql-odbc/src/odfesqlodbc/es_statement.h rename to sql-odbc/src/odfesqlodbc/opensearch_statement.h index 455f226664..c76d3a45e9 100644 --- a/sql-odbc/src/odfesqlodbc/es_statement.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_statement.h @@ -14,10 +14,10 @@ * */ -#ifndef _ES_STATEMENT_H_ -#define _ES_STATEMENT_H_ +#ifndef _OPENSEARCH_STATEMENT_H_ +#define _OPENSEARCH_STATEMENT_H_ -#include "es_parse_result.h" +#include "opensearch_parse_result.h" #include "qresult.h" #include "statement.h" @@ -29,9 +29,9 @@ RETCODE PrepareStatement(StatementClass* stmt, const SQLCHAR *stmt_str, SQLINTEG RETCODE ExecuteStatement(StatementClass *stmt, BOOL commit); QResultClass *SendQueryGetResult(StatementClass *stmt, BOOL commit); RETCODE AssignResult(StatementClass *stmt); -SQLRETURN ESAPI_Cancel(HSTMT hstmt); +SQLRETURN OPENSEARCHAPI_Cancel(HSTMT hstmt); SQLRETURN GetNextResultSet(StatementClass *stmt); -void ClearESResult(void *es_result); +void ClearOpenSearchResult(void *opensearch_result); #ifdef __cplusplus } #endif diff --git a/sql-odbc/src/odfesqlodbc/es_types.c b/sql-odbc/src/odfesqlodbc/opensearch_types.c similarity index 65% rename from sql-odbc/src/odfesqlodbc/es_types.c rename to sql-odbc/src/odfesqlodbc/opensearch_types.c index d6da15cac9..d431dbe408 100644 --- a/sql-odbc/src/odfesqlodbc/es_types.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.c @@ -14,11 +14,11 @@ * */ -#include "es_types.h" +#include "opensearch_types.h" #include "dlg_specific.h" #include "environ.h" -#include "es_connection.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" #ifndef WIN32 @@ -74,7 +74,7 @@ SQLSMALLINT sqlTypes[] = { #define ALLOWED_C_BIGINT SQL_C_CHAR #endif -OID es_true_type(const ConnectionClass *conn, OID type, OID basetype) { +OID opensearch_true_type(const ConnectionClass *conn, OID type, OID basetype) { if (0 == basetype) return type; else if (0 == type) @@ -95,7 +95,7 @@ static Int4 getCharColumnSizeX(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as) { int p = -1, maxsize; - MYLOG(ES_TRACE, + MYLOG(OPENSEARCH_TRACE, "entering type=%d, atttypmod=%d, adtsize_or=%d, unknown = %d\n", type, atttypmod, adtsize_or_longestlen, handle_unknown_size_as); @@ -112,19 +112,19 @@ static Int4 getCharColumnSizeX(const ConnectionClass *conn, OID type, * Static ColumnSize (i.e., the Maximum ColumnSize of the datatype) This * has nothing to do with a result set. */ - MYLOG(ES_DEBUG, "!!! atttypmod < 0 ?\n"); + MYLOG(OPENSEARCH_DEBUG, "!!! atttypmod < 0 ?\n"); if (atttypmod < 0 && adtsize_or_longestlen < 0) return maxsize; - MYLOG(ES_DEBUG, "!!! adtsize_or_logngest=%d\n", adtsize_or_longestlen); + MYLOG(OPENSEARCH_DEBUG, "!!! adtsize_or_logngest=%d\n", adtsize_or_longestlen); p = adtsize_or_longestlen; /* longest */ /* * Catalog Result Sets -- use assigned column width (i.e., from * set_tuplefield_string) */ - MYLOG(ES_DEBUG, "!!! catalog_result=%d\n", handle_unknown_size_as); + MYLOG(OPENSEARCH_DEBUG, "!!! catalog_result=%d\n", handle_unknown_size_as); if (UNKNOWNS_AS_LONGEST == handle_unknown_size_as) { - MYLOG(ES_DEBUG, "LONGEST: p = %d\n", p); + MYLOG(OPENSEARCH_DEBUG, "LONGEST: p = %d\n", p); if (p > 0 && (atttypmod < 0 || atttypmod > p)) return p; } @@ -153,9 +153,9 @@ static Int4 getCharColumnSizeX(const ConnectionClass *conn, OID type, if (maxsize <= 0) return maxsize; switch (type) { - case ES_TYPE_BPCHAR: - case ES_TYPE_VARCHAR: - case ES_TYPE_TEXT: + case OPENSEARCH_TYPE_BPCHAR: + case OPENSEARCH_TYPE_VARCHAR: + case OPENSEARCH_TYPE_TEXT: return maxsize; } @@ -176,7 +176,7 @@ static SQLSMALLINT getNumericDecimalDigitsX(const ConnectionClass *conn, UNUSED(conn, handle_unknown_size_as); SQLSMALLINT default_decimal_digits = 6; - MYLOG(ES_TRACE, "entering type=%d, atttypmod=%d\n", type, atttypmod); + MYLOG(OPENSEARCH_TRACE, "entering type=%d, atttypmod=%d\n", type, atttypmod); if (atttypmod < 0 && adtsize_or_longest < 0) return default_decimal_digits; @@ -189,12 +189,12 @@ static SQLSMALLINT getNumericDecimalDigitsX(const ConnectionClass *conn, return (SQLSMALLINT)adtsize_or_longest; } -static Int4 /* Elasticsearch restritiction */ +static Int4 /* OpenSearch restritiction */ 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(ES_TRACE, "entering type=%d, typmod=%d\n", type, atttypmod); + MYLOG(OPENSEARCH_TRACE, "entering type=%d, typmod=%d\n", type, atttypmod); if (atttypmod > -1) return (atttypmod >> 16) & 0xffff; @@ -220,7 +220,7 @@ getNumericColumnSizeX(const ConnectionClass *conn, OID type, int atttypmod, static SQLSMALLINT getTimestampDecimalDigitsX(const ConnectionClass *conn, OID type, int atttypmod) { UNUSED(conn); - MYLOG(ES_DEBUG, "type=%d, atttypmod=%d\n", type, atttypmod); + MYLOG(OPENSEARCH_DEBUG, "type=%d, atttypmod=%d\n", type, atttypmod); return (SQLSMALLINT)(atttypmod > -1 ? atttypmod : 6); } @@ -228,7 +228,7 @@ static SQLSMALLINT getTimestampDecimalDigitsX(const ConnectionClass *conn, static SQLSMALLINT getIntervalDecimalDigits(OID type, int atttypmod) { Int4 prec; - MYLOG(ES_TRACE, "entering type=%d, atttypmod=%d\n", type, atttypmod); + MYLOG(OPENSEARCH_TRACE, "entering type=%d, atttypmod=%d\n", type, atttypmod); if ((atttypmod & SECOND_BIT) == 0) return 0; @@ -237,8 +237,8 @@ static SQLSMALLINT getIntervalDecimalDigits(OID type, int atttypmod) { #endif // ES_INTERVAL_AS_SQL_INTERVAL SQLSMALLINT -estype_attr_to_concise_type(const ConnectionClass *conn, OID type, - int atttypmod, int adtsize_or_longestlen, +opensearchtype_attr_to_concise_type(const ConnectionClass *conn, OID type, + int typmod, int adtsize_or_longestlen, int handle_unknown_size_as) { EnvironmentClass *env = (EnvironmentClass *)CC_get_env(conn); #ifdef ES_INTERVAL_AS_SQL_INTERVAL @@ -247,16 +247,16 @@ estype_attr_to_concise_type(const ConnectionClass *conn, OID type, BOOL bLongVarchar, bFixed = FALSE; switch (type) { - case ES_TYPE_CHAR: + case OPENSEARCH_TYPE_CHAR: return ansi_to_wtype(conn, SQL_CHAR); - case ES_TYPE_NAME: - case ES_TYPE_REFCURSOR: + case OPENSEARCH_TYPE_NAME: + case OPENSEARCH_TYPE_REFCURSOR: return ansi_to_wtype(conn, SQL_VARCHAR); - case ES_TYPE_BPCHAR: + case OPENSEARCH_TYPE_BPCHAR: bFixed = TRUE; - case ES_TYPE_VARCHAR: - if (getCharColumnSizeX(conn, type, atttypmod, adtsize_or_longestlen, + case OPENSEARCH_TYPE_VARCHAR: + if (getCharColumnSizeX(conn, type, typmod, adtsize_or_longestlen, handle_unknown_size_as) > MAX_VARCHAR_SIZE) bLongVarchar = TRUE; @@ -265,10 +265,10 @@ estype_attr_to_concise_type(const ConnectionClass *conn, OID type, return ansi_to_wtype(conn, bLongVarchar ? SQL_LONGVARCHAR : (bFixed ? SQL_CHAR : SQL_VARCHAR)); - case ES_TYPE_TEXT: + case OPENSEARCH_TYPE_TEXT: bLongVarchar = DEFAULT_TEXTASLONGVARCHAR; if (bLongVarchar) { - int column_size = getCharColumnSizeX(conn, type, atttypmod, + int column_size = getCharColumnSizeX(conn, type, typmod, adtsize_or_longestlen, handle_unknown_size_as); if (column_size > 0 && column_size <= MAX_VARCHAR_SIZE) @@ -277,61 +277,61 @@ estype_attr_to_concise_type(const ConnectionClass *conn, OID type, return ansi_to_wtype(conn, bLongVarchar ? SQL_LONGVARCHAR : SQL_VARCHAR); - case ES_TYPE_BYTEA: + case OPENSEARCH_TYPE_BYTEA: return SQL_VARBINARY; - case ES_TYPE_LO_UNDEFINED: + case OPENSEARCH_TYPE_LO_UNDEFINED: return SQL_LONGVARBINARY; - case ES_TYPE_INT2: + case OPENSEARCH_TYPE_INT2: return SQL_SMALLINT; - case ES_TYPE_OID: - case ES_TYPE_XID: - case ES_TYPE_INT4: + case OPENSEARCH_TYPE_OID: + case OPENSEARCH_TYPE_XID: + case OPENSEARCH_TYPE_INT4: return SQL_INTEGER; /* Change this to SQL_BIGINT for ODBC v3 bjm 2001-01-23 */ - case ES_TYPE_INT8: + case OPENSEARCH_TYPE_INT8: if (conn->ms_jet) return SQL_NUMERIC; /* maybe a little better than SQL_VARCHAR */ return SQL_BIGINT; - case ES_TYPE_NUMERIC: + case OPENSEARCH_TYPE_NUMERIC: return SQL_NUMERIC; - case ES_TYPE_FLOAT4: + case OPENSEARCH_TYPE_FLOAT4: return SQL_REAL; - case ES_TYPE_FLOAT8: + case OPENSEARCH_TYPE_FLOAT8: return SQL_FLOAT; - case ES_TYPE_DATE: + case OPENSEARCH_TYPE_DATE: if (EN_is_odbc3(env)) return SQL_TYPE_DATE; return SQL_DATE; - case ES_TYPE_TIME: + case OPENSEARCH_TYPE_TIME: if (EN_is_odbc3(env)) return SQL_TYPE_TIME; return SQL_TIME; - case ES_TYPE_ABSTIME: - case ES_TYPE_DATETIME: - case ES_TYPE_TIMESTAMP_NO_TMZONE: - case ES_TYPE_TIMESTAMP: + case OPENSEARCH_TYPE_ABSTIME: + case OPENSEARCH_TYPE_DATETIME: + case OPENSEARCH_TYPE_TIMESTAMP_NO_TMZONE: + case OPENSEARCH_TYPE_TIMESTAMP: if (EN_is_odbc3(env)) return SQL_TYPE_TIMESTAMP; return SQL_TIMESTAMP; - case ES_TYPE_MONEY: + case OPENSEARCH_TYPE_MONEY: return SQL_FLOAT; - case ES_TYPE_BOOL: + case OPENSEARCH_TYPE_BOOL: return SQL_BIT; - case ES_TYPE_XML: + case OPENSEARCH_TYPE_XML: return ansi_to_wtype(conn, SQL_LONGVARCHAR); - case ES_TYPE_INET: - case ES_TYPE_CIDR: - case ES_TYPE_MACADDR: + case OPENSEARCH_TYPE_INET: + case OPENSEARCH_TYPE_CIDR: + case OPENSEARCH_TYPE_MACADDR: return ansi_to_wtype(conn, SQL_VARCHAR); - case ES_TYPE_UUID: + case OPENSEARCH_TYPE_UUID: return SQL_GUID; - case ES_TYPE_INTERVAL: + case OPENSEARCH_TYPE_INTERVAL: #ifdef ES_INTERVAL_AS_SQL_INTERVAL if (sqltype = get_interval_type(atttypmod, NULL), 0 != sqltype) return sqltype; @@ -351,7 +351,7 @@ estype_attr_to_concise_type(const ConnectionClass *conn, OID type, bLongVarchar = DEFAULT_UNKNOWNSASLONGVARCHAR; if (bLongVarchar) { - int column_size = getCharColumnSizeX(conn, type, atttypmod, + int column_size = getCharColumnSizeX(conn, type, typmod, adtsize_or_longestlen, handle_unknown_size_as); if (column_size > 0 && column_size <= MAX_VARCHAR_SIZE) @@ -367,18 +367,18 @@ estype_attr_to_concise_type(const ConnectionClass *conn, OID type, } SQLSMALLINT -estype_attr_to_sqldesctype(const ConnectionClass *conn, OID type, int atttypmod, +opensearchtype_attr_to_sqldesctype(const ConnectionClass *conn, OID type, int typmod, int adtsize_or_longestlen, int handle_unknown_size_as) { SQLSMALLINT rettype; #ifdef ES_INTERVAL_AS_SQL_INTERVAL - if (ES_TYPE_INTERVAL == type) + if (OPENSEARCH_TYPE_INTERVAL == type) return SQL_INTERVAL; #endif /* ES_INTERVAL_AS_SQL_INTERVAL */ - switch (rettype = estype_attr_to_concise_type(conn, type, atttypmod, - adtsize_or_longestlen, - handle_unknown_size_as)) { + switch (rettype = opensearchtype_attr_to_concise_type( + conn, type, typmod, adtsize_or_longestlen, + handle_unknown_size_as)) { case SQL_TYPE_DATE: case SQL_TYPE_TIME: case SQL_TYPE_TIMESTAMP: @@ -388,72 +388,72 @@ estype_attr_to_sqldesctype(const ConnectionClass *conn, OID type, int atttypmod, } SQLSMALLINT -estype_attr_to_datetime_sub(const ConnectionClass *conn, OID type, - int atttypmod) { - UNUSED(conn, type, atttypmod); +opensearchtype_attr_to_datetime_sub(const ConnectionClass *conn, OID type, + int typmod) { + UNUSED(conn, type, typmod); return -1; } SQLSMALLINT -estype_attr_to_ctype(const ConnectionClass *conn, OID type, int atttypmod) { - UNUSED(atttypmod); +opensearchtype_attr_to_ctype(const ConnectionClass *conn, OID type, int typmod) { + UNUSED(typmod); EnvironmentClass *env = (EnvironmentClass *)CC_get_env(conn); #ifdef ES_INTERVAL_AS_SQL_INTERVAL SQLSMALLINT ctype; #endif /* ES_INTERVAL_A_SQL_INTERVAL */ switch (type) { - case ES_TYPE_INT8: + case OPENSEARCH_TYPE_INT8: if (!conn->ms_jet) return ALLOWED_C_BIGINT; return SQL_C_CHAR; - case ES_TYPE_NUMERIC: + case OPENSEARCH_TYPE_NUMERIC: return SQL_C_CHAR; - case ES_TYPE_INT2: + case OPENSEARCH_TYPE_INT2: return SQL_C_SSHORT; - case ES_TYPE_OID: - case ES_TYPE_XID: + case OPENSEARCH_TYPE_OID: + case OPENSEARCH_TYPE_XID: return SQL_C_ULONG; - case ES_TYPE_INT4: + case OPENSEARCH_TYPE_INT4: return SQL_C_SLONG; - case ES_TYPE_FLOAT4: + case OPENSEARCH_TYPE_FLOAT4: return SQL_C_FLOAT; - case ES_TYPE_FLOAT8: + case OPENSEARCH_TYPE_FLOAT8: return SQL_C_DOUBLE; - case ES_TYPE_DATE: + case OPENSEARCH_TYPE_DATE: if (EN_is_odbc3(env)) return SQL_C_TYPE_DATE; return SQL_C_DATE; - case ES_TYPE_TIME: + case OPENSEARCH_TYPE_TIME: if (EN_is_odbc3(env)) return SQL_C_TYPE_TIME; return SQL_C_TIME; - case ES_TYPE_ABSTIME: - case ES_TYPE_DATETIME: - case ES_TYPE_TIMESTAMP_NO_TMZONE: - case ES_TYPE_TIMESTAMP: + case OPENSEARCH_TYPE_ABSTIME: + case OPENSEARCH_TYPE_DATETIME: + case OPENSEARCH_TYPE_TIMESTAMP_NO_TMZONE: + case OPENSEARCH_TYPE_TIMESTAMP: if (EN_is_odbc3(env)) return SQL_C_TYPE_TIMESTAMP; return SQL_C_TIMESTAMP; - case ES_TYPE_MONEY: + case OPENSEARCH_TYPE_MONEY: return SQL_C_FLOAT; - case ES_TYPE_BOOL: + case OPENSEARCH_TYPE_BOOL: return SQL_C_BIT; - case ES_TYPE_BYTEA: + case OPENSEARCH_TYPE_BYTEA: return SQL_C_BINARY; - case ES_TYPE_LO_UNDEFINED: + case OPENSEARCH_TYPE_LO_UNDEFINED: return SQL_C_BINARY; - case ES_TYPE_BPCHAR: - case ES_TYPE_VARCHAR: - case ES_TYPE_TEXT: + case OPENSEARCH_TYPE_BPCHAR: + case OPENSEARCH_TYPE_VARCHAR: + case OPENSEARCH_TYPE_TEXT: return ansi_to_wtype(conn, SQL_C_CHAR); - case ES_TYPE_UUID: + case OPENSEARCH_TYPE_UUID: if (!conn->ms_jet) return SQL_C_GUID; return ansi_to_wtype(conn, SQL_C_CHAR); - case ES_TYPE_INTERVAL: + case OPENSEARCH_TYPE_INTERVAL: #ifdef ES_INTERVAL_AS_SQL_INTERVAL if (ctype = get_interval_type(atttypmod, NULL), 0 != ctype) return ctype; @@ -474,77 +474,77 @@ estype_attr_to_ctype(const ConnectionClass *conn, OID type, int atttypmod) { } } -const char *estype_attr_to_name(const ConnectionClass *conn, OID type, +const char *opensearchtype_attr_to_name(const ConnectionClass *conn, OID type, int typmod, BOOL auto_increment) { UNUSED(conn, typmod, conn, auto_increment); switch (type) { - case ES_TYPE_BOOL: - return ES_TYPE_NAME_BOOLEAN; - case ES_TYPE_INT1: - return ES_TYPE_NAME_BYTE; - case ES_TYPE_INT2: - return ES_TYPE_NAME_SHORT; - case ES_TYPE_INT4: - return ES_TYPE_NAME_INTEGER; - case ES_TYPE_INT8: - return ES_TYPE_NAME_LONG; - case ES_TYPE_HALF_FLOAT: - return ES_TYPE_NAME_HALF_FLOAT; - case ES_TYPE_FLOAT4: - return ES_TYPE_NAME_FLOAT; - case ES_TYPE_FLOAT8: - return ES_TYPE_NAME_DOUBLE; - case ES_TYPE_SCALED_FLOAT: - return ES_TYPE_NAME_SCALED_FLOAT; - case ES_TYPE_KEYWORD: - return ES_TYPE_NAME_KEYWORD; - case ES_TYPE_TEXT: - return ES_TYPE_NAME_TEXT; - case ES_TYPE_NESTED: - return ES_TYPE_NAME_NESTED; - case ES_TYPE_DATETIME: - return ES_TYPE_NAME_DATE; - case ES_TYPE_OBJECT: - return ES_TYPE_NAME_OBJECT; - case ES_TYPE_VARCHAR: - return ES_TYPE_NAME_VARCHAR; + case OPENSEARCH_TYPE_BOOL: + return OPENSEARCH_TYPE_NAME_BOOLEAN; + case OPENSEARCH_TYPE_INT1: + return OPENSEARCH_TYPE_NAME_BYTE; + case OPENSEARCH_TYPE_INT2: + return OPENSEARCH_TYPE_NAME_SHORT; + case OPENSEARCH_TYPE_INT4: + return OPENSEARCH_TYPE_NAME_INTEGER; + case OPENSEARCH_TYPE_INT8: + return OPENSEARCH_TYPE_NAME_LONG; + case OPENSEARCH_TYPE_HALF_FLOAT: + return OPENSEARCH_TYPE_NAME_HALF_FLOAT; + case OPENSEARCH_TYPE_FLOAT4: + return OPENSEARCH_TYPE_NAME_FLOAT; + case OPENSEARCH_TYPE_FLOAT8: + return OPENSEARCH_TYPE_NAME_DOUBLE; + case OPENSEARCH_TYPE_SCALED_FLOAT: + return OPENSEARCH_TYPE_NAME_SCALED_FLOAT; + case OPENSEARCH_TYPE_KEYWORD: + return OPENSEARCH_TYPE_NAME_KEYWORD; + case OPENSEARCH_TYPE_TEXT: + return OPENSEARCH_TYPE_NAME_TEXT; + case OPENSEARCH_TYPE_NESTED: + return OPENSEARCH_TYPE_NAME_NESTED; + case OPENSEARCH_TYPE_DATETIME: + return OPENSEARCH_TYPE_NAME_DATE; + case OPENSEARCH_TYPE_OBJECT: + return OPENSEARCH_TYPE_NAME_OBJECT; + case OPENSEARCH_TYPE_VARCHAR: + return OPENSEARCH_TYPE_NAME_VARCHAR; default: - return ES_TYPE_NAME_UNSUPPORTED; + return OPENSEARCH_TYPE_NAME_UNSUPPORTED; } } -Int4 /* Elasticsearch restriction */ -estype_attr_column_size(const ConnectionClass *conn, OID type, int atttypmod, +Int4 /* OpenSearch restriction */ +opensearchtype_attr_column_size(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longest, int handle_unknown_size_as) { UNUSED(handle_unknown_size_as, adtsize_or_longest, atttypmod, conn); switch (type) { - case ES_TYPE_BOOL: + case OPENSEARCH_TYPE_BOOL: return 1; - case ES_TYPE_INT1: + case OPENSEARCH_TYPE_INT1: return 3; - case ES_TYPE_INT2: + case OPENSEARCH_TYPE_INT2: return 5; - case ES_TYPE_INT4: + case OPENSEARCH_TYPE_INT4: return 10; - case ES_TYPE_INT8: + case OPENSEARCH_TYPE_INT8: return 19; - case ES_TYPE_HALF_FLOAT: + case OPENSEARCH_TYPE_HALF_FLOAT: return 7; - case ES_TYPE_FLOAT4: + case OPENSEARCH_TYPE_FLOAT4: return 7; - case ES_TYPE_FLOAT8: + case OPENSEARCH_TYPE_FLOAT8: return 15; - case ES_TYPE_SCALED_FLOAT: + case OPENSEARCH_TYPE_SCALED_FLOAT: return 15; - case ES_TYPE_KEYWORD: + case OPENSEARCH_TYPE_KEYWORD: return 256; - case ES_TYPE_TEXT: + case OPENSEARCH_TYPE_TEXT: return INT_MAX; - case ES_TYPE_NESTED: + case OPENSEARCH_TYPE_NESTED: return 0; - case ES_TYPE_DATETIME: + case OPENSEARCH_TYPE_DATETIME: return 24; - case ES_TYPE_OBJECT: + case OPENSEARCH_TYPE_OBJECT: return 0; default: return adtsize_or_longest; @@ -552,136 +552,136 @@ estype_attr_column_size(const ConnectionClass *conn, OID type, int atttypmod, } SQLSMALLINT -estype_attr_precision(const ConnectionClass *conn, OID type, int atttypmod, +opensearchtype_attr_precision(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longest, int handle_unknown_size_as) { switch (type) { - case ES_TYPE_NUMERIC: + case OPENSEARCH_TYPE_NUMERIC: return (SQLSMALLINT)getNumericColumnSizeX(conn, type, atttypmod, adtsize_or_longest, handle_unknown_size_as); - case ES_TYPE_TIME: - case ES_TYPE_DATETIME: - case ES_TYPE_TIMESTAMP_NO_TMZONE: + case OPENSEARCH_TYPE_TIME: + case OPENSEARCH_TYPE_DATETIME: + case OPENSEARCH_TYPE_TIMESTAMP_NO_TMZONE: return getTimestampDecimalDigitsX(conn, type, atttypmod); #ifdef ES_INTERVAL_AS_SQL_INTERVAL - case ES_TYPE_INTERVAL: + case OPENSEARCH_TYPE_INTERVAL: return getIntervalDecimalDigits(type, atttypmod); #endif /* ES_INTERVAL_AS_SQL_INTERVAL */ } return -1; } -Int4 estype_attr_display_size(const ConnectionClass *conn, OID type, +Int4 opensearchtype_attr_display_size(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as) { int dsize; switch (type) { - case ES_TYPE_INT2: + case OPENSEARCH_TYPE_INT2: return 6; - case ES_TYPE_OID: - case ES_TYPE_XID: + case OPENSEARCH_TYPE_OID: + case OPENSEARCH_TYPE_XID: return 10; - case ES_TYPE_INT4: + case OPENSEARCH_TYPE_INT4: return 11; - case ES_TYPE_INT8: + case OPENSEARCH_TYPE_INT8: return 20; /* signed: 19 digits + sign */ - case ES_TYPE_NUMERIC: + case OPENSEARCH_TYPE_NUMERIC: dsize = getNumericColumnSizeX(conn, type, atttypmod, adtsize_or_longestlen, handle_unknown_size_as); return dsize <= 0 ? dsize : dsize + 2; - case ES_TYPE_MONEY: + case OPENSEARCH_TYPE_MONEY: return 15; /* ($9,999,999.99) */ - case ES_TYPE_FLOAT4: /* a sign, ES_REAL_DIGITS digits, a decimal point, + case OPENSEARCH_TYPE_FLOAT4: /* a sign, OPENSEARCH_REAL_DIGITS digits, a decimal point, the letter E, a sign, and 2 digits */ - return (1 + ES_REAL_DIGITS + 1 + 1 + 3); + return (1 + OPENSEARCH_REAL_DIGITS + 1 + 1 + 3); - case ES_TYPE_FLOAT8: /* a sign, ES_DOUBLE_DIGITS digits, a decimal + case OPENSEARCH_TYPE_FLOAT8: /* a sign, OPENSEARCH_DOUBLE_DIGITS digits, a decimal point, the letter E, a sign, and 3 digits */ - return (1 + ES_DOUBLE_DIGITS + 1 + 1 + 1 + 3); + return (1 + OPENSEARCH_DOUBLE_DIGITS + 1 + 1 + 1 + 3); - case ES_TYPE_MACADDR: + case OPENSEARCH_TYPE_MACADDR: return 17; - case ES_TYPE_INET: - case ES_TYPE_CIDR: + case OPENSEARCH_TYPE_INET: + case OPENSEARCH_TYPE_CIDR: return sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255/128"); - case ES_TYPE_UUID: + case OPENSEARCH_TYPE_UUID: return 36; - case ES_TYPE_INTERVAL: + case OPENSEARCH_TYPE_INTERVAL: return 30; /* Character types use regular precision */ default: - return estype_attr_column_size(conn, type, atttypmod, - adtsize_or_longestlen, - handle_unknown_size_as); + return opensearchtype_attr_column_size(conn, type, atttypmod, + adtsize_or_longestlen, + handle_unknown_size_as); } } -Int4 estype_attr_buffer_length(const ConnectionClass *conn, OID type, +Int4 opensearchtype_attr_buffer_length(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as) { int dsize; switch (type) { - case ES_TYPE_INT2: + case OPENSEARCH_TYPE_INT2: return 2; /* sizeof(SQLSMALLINT) */ - case ES_TYPE_OID: - case ES_TYPE_XID: - case ES_TYPE_INT4: + case OPENSEARCH_TYPE_OID: + case OPENSEARCH_TYPE_XID: + case OPENSEARCH_TYPE_INT4: return 4; /* sizeof(SQLINTEGER) */ - case ES_TYPE_INT8: - if (SQL_C_CHAR == estype_attr_to_ctype(conn, type, atttypmod)) + case OPENSEARCH_TYPE_INT8: + if (SQL_C_CHAR == opensearchtype_attr_to_ctype(conn, type, atttypmod)) return 20; /* signed: 19 digits + sign */ return 8; /* sizeof(SQLSBININT) */ - case ES_TYPE_NUMERIC: + case OPENSEARCH_TYPE_NUMERIC: dsize = getNumericColumnSizeX(conn, type, atttypmod, adtsize_or_longestlen, handle_unknown_size_as); return dsize <= 0 ? dsize : dsize + 2; - case ES_TYPE_FLOAT4: - case ES_TYPE_MONEY: + case OPENSEARCH_TYPE_FLOAT4: + case OPENSEARCH_TYPE_MONEY: return 4; /* sizeof(SQLREAL) */ - case ES_TYPE_FLOAT8: + case OPENSEARCH_TYPE_FLOAT8: return 8; /* sizeof(SQLFLOAT) */ - case ES_TYPE_DATE: - case ES_TYPE_TIME: + case OPENSEARCH_TYPE_DATE: + case OPENSEARCH_TYPE_TIME: return 6; /* sizeof(DATE(TIME)_STRUCT) */ - case ES_TYPE_ABSTIME: - case ES_TYPE_DATETIME: - case ES_TYPE_TIMESTAMP: - case ES_TYPE_TIMESTAMP_NO_TMZONE: + case OPENSEARCH_TYPE_ABSTIME: + case OPENSEARCH_TYPE_DATETIME: + case OPENSEARCH_TYPE_TIMESTAMP: + case OPENSEARCH_TYPE_TIMESTAMP_NO_TMZONE: return 16; /* sizeof(TIMESTAMP_STRUCT) */ - case ES_TYPE_MACADDR: + case OPENSEARCH_TYPE_MACADDR: return 17; - case ES_TYPE_INET: - case ES_TYPE_CIDR: + case OPENSEARCH_TYPE_INET: + case OPENSEARCH_TYPE_CIDR: return sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255/128"); - case ES_TYPE_UUID: + case OPENSEARCH_TYPE_UUID: return 16; /* sizeof(SQLGUID) */ /* Character types use the default precision */ - case ES_TYPE_VARCHAR: - case ES_TYPE_BPCHAR: { + case OPENSEARCH_TYPE_VARCHAR: + case OPENSEARCH_TYPE_BPCHAR: { int coef = 1; - Int4 prec = estype_attr_column_size(conn, type, atttypmod, - adtsize_or_longestlen, - handle_unknown_size_as), + Int4 prec = opensearchtype_attr_column_size(conn, type, atttypmod, + adtsize_or_longestlen, + handle_unknown_size_as), maxvarc; if (SQL_NO_TOTAL == prec) return prec; @@ -701,101 +701,101 @@ Int4 estype_attr_buffer_length(const ConnectionClass *conn, OID type, return coef * prec; } #ifdef ES_INTERVAL_AS_SQL_INTERVAL - case ES_TYPE_INTERVAL: + case OPENSEARCH_TYPE_INTERVAL: return sizeof(SQL_INTERVAL_STRUCT); #endif /* ES_INTERVAL_AS_SQL_INTERVAL */ default: - return estype_attr_column_size(conn, type, atttypmod, - adtsize_or_longestlen, - handle_unknown_size_as); + return opensearchtype_attr_column_size(conn, type, atttypmod, + adtsize_or_longestlen, + handle_unknown_size_as); } } /* */ -Int4 estype_attr_desclength(const ConnectionClass *conn, OID type, +Int4 opensearchtype_attr_desclength(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as) { int dsize; switch (type) { - case ES_TYPE_INT2: + case OPENSEARCH_TYPE_INT2: return 2; - case ES_TYPE_OID: - case ES_TYPE_XID: - case ES_TYPE_INT4: + case OPENSEARCH_TYPE_OID: + case OPENSEARCH_TYPE_XID: + case OPENSEARCH_TYPE_INT4: return 4; - case ES_TYPE_INT8: + case OPENSEARCH_TYPE_INT8: return 20; /* signed: 19 digits + sign */ - case ES_TYPE_NUMERIC: + case OPENSEARCH_TYPE_NUMERIC: dsize = getNumericColumnSizeX(conn, type, atttypmod, adtsize_or_longestlen, handle_unknown_size_as); return dsize <= 0 ? dsize : dsize + 2; - case ES_TYPE_FLOAT4: - case ES_TYPE_MONEY: + case OPENSEARCH_TYPE_FLOAT4: + case OPENSEARCH_TYPE_MONEY: return 4; - case ES_TYPE_FLOAT8: + case OPENSEARCH_TYPE_FLOAT8: return 8; - case ES_TYPE_DATE: - case ES_TYPE_TIME: - case ES_TYPE_ABSTIME: - case ES_TYPE_DATETIME: - case ES_TYPE_TIMESTAMP_NO_TMZONE: - case ES_TYPE_TIMESTAMP: - case ES_TYPE_VARCHAR: - case ES_TYPE_BPCHAR: - return estype_attr_column_size(conn, type, atttypmod, - adtsize_or_longestlen, - handle_unknown_size_as); + case OPENSEARCH_TYPE_DATE: + case OPENSEARCH_TYPE_TIME: + case OPENSEARCH_TYPE_ABSTIME: + case OPENSEARCH_TYPE_DATETIME: + case OPENSEARCH_TYPE_TIMESTAMP_NO_TMZONE: + case OPENSEARCH_TYPE_TIMESTAMP: + case OPENSEARCH_TYPE_VARCHAR: + case OPENSEARCH_TYPE_BPCHAR: + return opensearchtype_attr_column_size(conn, type, atttypmod, + adtsize_or_longestlen, + handle_unknown_size_as); default: - return estype_attr_column_size(conn, type, atttypmod, - adtsize_or_longestlen, - handle_unknown_size_as); + return opensearchtype_attr_column_size(conn, type, atttypmod, + adtsize_or_longestlen, + handle_unknown_size_as); } } -Int2 estype_attr_decimal_digits(const ConnectionClass *conn, OID type, +Int2 opensearchtype_attr_decimal_digits(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, - int UNUSED_handle_unknown_size_as) { + int handle_unknown_size_as) { switch (type) { - case ES_TYPE_INT2: - case ES_TYPE_OID: - case ES_TYPE_XID: - case ES_TYPE_INT4: - case ES_TYPE_INT8: - case ES_TYPE_FLOAT4: - case ES_TYPE_FLOAT8: - case ES_TYPE_MONEY: - case ES_TYPE_BOOL: + case OPENSEARCH_TYPE_INT2: + case OPENSEARCH_TYPE_OID: + case OPENSEARCH_TYPE_XID: + case OPENSEARCH_TYPE_INT4: + case OPENSEARCH_TYPE_INT8: + case OPENSEARCH_TYPE_FLOAT4: + case OPENSEARCH_TYPE_FLOAT8: + case OPENSEARCH_TYPE_MONEY: + case OPENSEARCH_TYPE_BOOL: /* * Number of digits to the right of the decimal point in * "yyyy-mm=dd hh:mm:ss[.f...]" */ - case ES_TYPE_ABSTIME: - case ES_TYPE_TIMESTAMP: + case OPENSEARCH_TYPE_ABSTIME: + case OPENSEARCH_TYPE_TIMESTAMP: return 0; - case ES_TYPE_TIME: - case ES_TYPE_DATETIME: - case ES_TYPE_TIMESTAMP_NO_TMZONE: + case OPENSEARCH_TYPE_TIME: + case OPENSEARCH_TYPE_DATETIME: + case OPENSEARCH_TYPE_TIMESTAMP_NO_TMZONE: /* return 0; */ return getTimestampDecimalDigitsX(conn, type, atttypmod); - case ES_TYPE_NUMERIC: + case OPENSEARCH_TYPE_NUMERIC: return getNumericDecimalDigitsX(conn, type, atttypmod, adtsize_or_longestlen, - UNUSED_handle_unknown_size_as); + handle_unknown_size_as); #ifdef ES_INTERVAL_AS_SQL_INTERVAL - case ES_TYPE_INTERVAL: + case OPENSEARCH_TYPE_INTERVAL: return getIntervalDecimalDigits(type, atttypmod); #endif /* ES_INTERVAL_AS_SQL_INTERVAL */ @@ -804,31 +804,32 @@ Int2 estype_attr_decimal_digits(const ConnectionClass *conn, OID type, } } -Int2 estype_attr_scale(const ConnectionClass *conn, OID type, int atttypmod, +Int2 opensearchtype_attr_scale(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, - int UNUSED_handle_unknown_size_as) { + int handle_unknown_size_as) { switch (type) { - case ES_TYPE_NUMERIC: + case OPENSEARCH_TYPE_NUMERIC: return getNumericDecimalDigitsX(conn, type, atttypmod, adtsize_or_longestlen, - UNUSED_handle_unknown_size_as); + handle_unknown_size_as); } return -1; } -Int4 estype_attr_transfer_octet_length(const ConnectionClass *conn, OID type, +Int4 opensearchtype_attr_transfer_octet_length(const ConnectionClass *conn, OID type, int atttypmod, int handle_unknown_size_as) { int coef = 1; Int4 maxvarc, column_size; switch (type) { - case ES_TYPE_VARCHAR: - case ES_TYPE_BPCHAR: - case ES_TYPE_TEXT: - case ES_TYPE_UNKNOWN: - column_size = estype_attr_column_size( - conn, type, atttypmod, ES_ADT_UNSET, handle_unknown_size_as); + case OPENSEARCH_TYPE_VARCHAR: + case OPENSEARCH_TYPE_BPCHAR: + case OPENSEARCH_TYPE_TEXT: + case OPENSEARCH_TYPE_UNKNOWN: + column_size = opensearchtype_attr_column_size( + conn, type, atttypmod, OPENSEARCH_ADT_UNSET, + handle_unknown_size_as); if (SQL_NO_TOTAL == column_size) return column_size; #ifdef UNICODE_SUPPORT @@ -845,14 +846,15 @@ Int4 estype_attr_transfer_octet_length(const ConnectionClass *conn, OID type, if (column_size <= maxvarc && column_size * coef > maxvarc) return maxvarc; return coef * column_size; - case ES_TYPE_BYTEA: - return estype_attr_column_size(conn, type, atttypmod, ES_ADT_UNSET, - handle_unknown_size_as); + case OPENSEARCH_TYPE_BYTEA: + return opensearchtype_attr_column_size(conn, type, atttypmod, + OPENSEARCH_ADT_UNSET, + handle_unknown_size_as); default: if (type == (OID)conn->lobj_type) - return estype_attr_column_size(conn, type, atttypmod, - ES_ADT_UNSET, - handle_unknown_size_as); + return opensearchtype_attr_column_size(conn, type, atttypmod, + OPENSEARCH_ADT_UNSET, + handle_unknown_size_as); } return -1; } @@ -860,49 +862,49 @@ Int4 estype_attr_transfer_octet_length(const ConnectionClass *conn, OID type, /* * Casting parameters e.g. ?::timestamp is much more flexible * than specifying parameter datatype oids determined by - * sqltype_to_bind_estype() via parse message. + * sqltype_to_bind_opensearchtype() via parse message. */ -const char *sqltype_to_escast(const ConnectionClass *conn, +const char *sqltype_to_opensearchcast(const ConnectionClass *conn, SQLSMALLINT fSqlType) { - const char *esCast = NULL_STRING; + const char *openSearchCast = NULL_STRING; switch (fSqlType) { case SQL_BINARY: case SQL_VARBINARY: - esCast = "::bytea"; + openSearchCast = "::bytea"; break; case SQL_TYPE_DATE: case SQL_DATE: - esCast = "::date"; + openSearchCast = "::date"; break; case SQL_DECIMAL: case SQL_NUMERIC: - esCast = "::numeric"; + openSearchCast = "::numeric"; break; case SQL_BIGINT: - esCast = "::int8"; + openSearchCast = "::int8"; break; case SQL_INTEGER: - esCast = "::int4"; + openSearchCast = "::int4"; break; case SQL_REAL: - esCast = "::float4"; + openSearchCast = "::float4"; break; case SQL_SMALLINT: case SQL_TINYINT: - esCast = "::int2"; + openSearchCast = "::int2"; break; case SQL_TIME: case SQL_TYPE_TIME: - esCast = "::time"; + openSearchCast = "::time"; break; case SQL_TIMESTAMP: case SQL_TYPE_TIMESTAMP: - esCast = "::timestamp"; + openSearchCast = "::timestamp"; break; case SQL_GUID: - if (ES_VERSION_GE(conn, 8.3)) - esCast = "::uuid"; + if (OPENSEARCH_VERSION_GE(conn, 8.3)) + openSearchCast = "::uuid"; break; case SQL_INTERVAL_MONTH: case SQL_INTERVAL_YEAR: @@ -917,107 +919,107 @@ const char *sqltype_to_escast(const ConnectionClass *conn, case SQL_INTERVAL_HOUR_TO_MINUTE: case SQL_INTERVAL_HOUR_TO_SECOND: case SQL_INTERVAL_MINUTE_TO_SECOND: - esCast = "::interval"; + openSearchCast = "::interval"; break; } - return esCast; + return openSearchCast; } -OID sqltype_to_estype(const ConnectionClass *conn, SQLSMALLINT fSqlType) { - OID esType = 0; +OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType) { + OID openSearchType = 0; switch (fSqlType) { case SQL_BINARY: - esType = ES_TYPE_BYTEA; + openSearchType = OPENSEARCH_TYPE_BYTEA; break; case SQL_CHAR: - esType = ES_TYPE_BPCHAR; + openSearchType = OPENSEARCH_TYPE_BPCHAR; break; #ifdef UNICODE_SUPPORT case SQL_WCHAR: - esType = ES_TYPE_BPCHAR; + openSearchType = OPENSEARCH_TYPE_BPCHAR; break; #endif /* UNICODE_SUPPORT */ case SQL_BIT: - esType = ES_TYPE_BOOL; + openSearchType = OPENSEARCH_TYPE_BOOL; break; case SQL_TYPE_DATE: case SQL_DATE: - esType = ES_TYPE_DATE; + openSearchType = OPENSEARCH_TYPE_DATE; break; case SQL_DOUBLE: case SQL_FLOAT: - esType = ES_TYPE_FLOAT8; + openSearchType = OPENSEARCH_TYPE_FLOAT8; break; case SQL_DECIMAL: case SQL_NUMERIC: - esType = ES_TYPE_NUMERIC; + openSearchType = OPENSEARCH_TYPE_NUMERIC; break; case SQL_BIGINT: - esType = ES_TYPE_INT8; + openSearchType = OPENSEARCH_TYPE_INT8; break; case SQL_INTEGER: - esType = ES_TYPE_INT4; + openSearchType = OPENSEARCH_TYPE_INT4; break; case SQL_LONGVARBINARY: - esType = conn->lobj_type; + openSearchType = conn->lobj_type; break; case SQL_LONGVARCHAR: - esType = ES_TYPE_VARCHAR; + openSearchType = OPENSEARCH_TYPE_VARCHAR; break; #ifdef UNICODE_SUPPORT case SQL_WLONGVARCHAR: - esType = ES_TYPE_VARCHAR; + openSearchType = OPENSEARCH_TYPE_VARCHAR; break; #endif /* UNICODE_SUPPORT */ case SQL_REAL: - esType = ES_TYPE_FLOAT4; + openSearchType = OPENSEARCH_TYPE_FLOAT4; break; case SQL_SMALLINT: case SQL_TINYINT: - esType = ES_TYPE_INT2; + openSearchType = OPENSEARCH_TYPE_INT2; break; case SQL_TIME: case SQL_TYPE_TIME: - esType = ES_TYPE_TIME; + openSearchType = OPENSEARCH_TYPE_TIME; break; case SQL_TIMESTAMP: case SQL_TYPE_TIMESTAMP: - esType = ES_TYPE_DATETIME; + openSearchType = OPENSEARCH_TYPE_DATETIME; break; case SQL_VARBINARY: - esType = ES_TYPE_BYTEA; + openSearchType = OPENSEARCH_TYPE_BYTEA; break; case SQL_VARCHAR: - esType = ES_TYPE_VARCHAR; + openSearchType = OPENSEARCH_TYPE_VARCHAR; break; #ifdef UNICODE_SUPPORT case SQL_WVARCHAR: - esType = ES_TYPE_VARCHAR; + openSearchType = OPENSEARCH_TYPE_VARCHAR; break; #endif /* UNICODE_SUPPORT */ case SQL_GUID: - if (ES_VERSION_GE(conn, 8.3)) - esType = ES_TYPE_UUID; + if (OPENSEARCH_VERSION_GE(conn, 8.3)) + openSearchType = OPENSEARCH_TYPE_UUID; break; case SQL_INTERVAL_MONTH: @@ -1033,11 +1035,11 @@ OID sqltype_to_estype(const ConnectionClass *conn, SQLSMALLINT fSqlType) { case SQL_INTERVAL_HOUR_TO_MINUTE: case SQL_INTERVAL_HOUR_TO_SECOND: case SQL_INTERVAL_MINUTE_TO_SECOND: - esType = ES_TYPE_INTERVAL; + openSearchType = OPENSEARCH_TYPE_INTERVAL; break; } - return esType; + return openSearchType; } static int getAtttypmodEtc(const StatementClass *stmt, int col, @@ -1045,7 +1047,7 @@ static int getAtttypmodEtc(const StatementClass *stmt, int col, int atttypmod = -1; if (NULL != adtsize_or_longestlen) - *adtsize_or_longestlen = ES_ADT_UNSET; + *adtsize_or_longestlen = OPENSEARCH_ADT_UNSET; if (col >= 0) { const QResultClass *res; @@ -1056,7 +1058,7 @@ static int getAtttypmodEtc(const StatementClass *stmt, int col, *adtsize_or_longestlen = QR_get_fieldsize(res, col); else { *adtsize_or_longestlen = QR_get_display_size(res, col); - if (ES_TYPE_NUMERIC == QR_get_field_type(res, col) + if (OPENSEARCH_TYPE_NUMERIC == QR_get_field_type(res, col) && atttypmod < 0 && *adtsize_or_longestlen > 0) { SQLULEN i; size_t sval, maxscale = 0; @@ -1095,51 +1097,51 @@ static int getAtttypmodEtc(const StatementClass *stmt, int col, *other es routines in here return a suitable default. */ SQLSMALLINT -estype_to_concise_type(const StatementClass *stmt, OID type, int col, +opensearchtype_to_concise_type(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as) { int atttypmod, adtsize_or_longestlen; atttypmod = getAtttypmodEtc(stmt, col, &adtsize_or_longestlen); - return estype_attr_to_concise_type(SC_get_conn(stmt), type, atttypmod, - adtsize_or_longestlen, - handle_unknown_size_as); + return opensearchtype_attr_to_concise_type(SC_get_conn(stmt), type, + atttypmod, adtsize_or_longestlen, + handle_unknown_size_as); } SQLSMALLINT -estype_to_sqldesctype(const StatementClass *stmt, OID type, int col, +opensearchtype_to_sqldesctype(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as) { int adtsize_or_longestlen; int atttypmod = getAtttypmodEtc(stmt, col, &adtsize_or_longestlen); - return estype_attr_to_sqldesctype(SC_get_conn(stmt), type, atttypmod, - adtsize_or_longestlen, - handle_unknown_size_as); + return opensearchtype_attr_to_sqldesctype(SC_get_conn(stmt), type, + atttypmod, adtsize_or_longestlen, + handle_unknown_size_as); } -const char *estype_to_name(const StatementClass *stmt, OID type, int col, +const char *opensearchtype_to_name(const StatementClass *stmt, OID type, int col, BOOL auto_increment) { int atttypmod = getAtttypmodEtc(stmt, col, NULL); - return estype_attr_to_name(SC_get_conn(stmt), type, atttypmod, - auto_increment); + return opensearchtype_attr_to_name(SC_get_conn(stmt), type, atttypmod, + auto_increment); } /* * This corresponds to "precision" in ODBC 2.x. * - * For ES_TYPE_VARCHAR, ES_TYPE_BPCHAR, ES_TYPE_NUMERIC, SQLColumns will + * For OPENSEARCH_TYPE_VARCHAR, OPENSEARCH_TYPE_BPCHAR, OPENSEARCH_TYPE_NUMERIC, SQLColumns will * override this length with the atttypmod length from es_attribute . * * If col >= 0, then will attempt to get the info from the result set. * This is used for functions SQLDescribeCol and SQLColAttributes. */ -Int4 /* Elasticsearch restriction */ -estype_column_size(const StatementClass *stmt, OID type, int col, +Int4 /* OpenSearch restriction */ +opensearchtype_column_size(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as) { int atttypmod, adtsize_or_longestlen; atttypmod = getAtttypmodEtc(stmt, col, &adtsize_or_longestlen); - return estype_attr_column_size( + return opensearchtype_attr_column_size( SC_get_conn(stmt), type, atttypmod, adtsize_or_longestlen, stmt->catalog_result ? UNKNOWNS_AS_LONGEST : handle_unknown_size_as); } @@ -1148,22 +1150,22 @@ estype_column_size(const StatementClass *stmt, OID type, int col, * precision in ODBC 3.x. */ SQLSMALLINT -estype_precision(const StatementClass *stmt, OID type, int col, +opensearchtype_precision(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as) { int atttypmod, adtsize_or_longestlen; atttypmod = getAtttypmodEtc(stmt, col, &adtsize_or_longestlen); - return estype_attr_precision( + return opensearchtype_attr_precision( SC_get_conn(stmt), type, atttypmod, adtsize_or_longestlen, stmt->catalog_result ? UNKNOWNS_AS_LONGEST : handle_unknown_size_as); } -Int4 estype_display_size(const StatementClass *stmt, OID type, int col, +Int4 opensearchtype_display_size(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as) { int atttypmod, adtsize_or_longestlen; atttypmod = getAtttypmodEtc(stmt, col, &adtsize_or_longestlen); - return estype_attr_display_size( + return opensearchtype_attr_display_size( SC_get_conn(stmt), type, atttypmod, adtsize_or_longestlen, stmt->catalog_result ? UNKNOWNS_AS_LONGEST : handle_unknown_size_as); } @@ -1172,24 +1174,24 @@ Int4 estype_display_size(const StatementClass *stmt, OID type, int col, * The length in bytes of data transferred on an SQLGetData, SQLFetch, * or SQLFetchScroll operation if SQL_C_DEFAULT is specified. */ -Int4 estype_buffer_length(const StatementClass *stmt, OID type, int col, +Int4 opensearchtype_buffer_length(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as) { int atttypmod, adtsize_or_longestlen; atttypmod = getAtttypmodEtc(stmt, col, &adtsize_or_longestlen); - return estype_attr_buffer_length( + return opensearchtype_attr_buffer_length( SC_get_conn(stmt), type, atttypmod, adtsize_or_longestlen, stmt->catalog_result ? UNKNOWNS_AS_LONGEST : handle_unknown_size_as); } /* */ -Int4 estype_desclength(const StatementClass *stmt, OID type, int col, +Int4 opensearchtype_desclength(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as) { int atttypmod, adtsize_or_longestlen; atttypmod = getAtttypmodEtc(stmt, col, &adtsize_or_longestlen); - return estype_attr_desclength( + return opensearchtype_attr_desclength( SC_get_conn(stmt), type, atttypmod, adtsize_or_longestlen, stmt->catalog_result ? UNKNOWNS_AS_LONGEST : handle_unknown_size_as); } @@ -1198,16 +1200,16 @@ Int4 estype_desclength(const StatementClass *stmt, OID type, int col, /* * Transfer octet length. */ -Int4 estype_transfer_octet_length(const StatementClass *stmt, OID type, +Int4 opensearchtype_transfer_octet_length(const StatementClass *stmt, OID type, int column_size) { ConnectionClass *conn = SC_get_conn(stmt); int coef = 1; Int4 maxvarc; switch (type) { - case ES_TYPE_VARCHAR: - case ES_TYPE_BPCHAR: - case ES_TYPE_TEXT: + case OPENSEARCH_TYPE_VARCHAR: + case OPENSEARCH_TYPE_BPCHAR: + case OPENSEARCH_TYPE_TEXT: if (SQL_NO_TOTAL == column_size) return column_size; #ifdef UNICODE_SUPPORT @@ -1224,7 +1226,7 @@ Int4 estype_transfer_octet_length(const StatementClass *stmt, OID type, if (column_size <= maxvarc && column_size * coef > maxvarc) return maxvarc; return coef * column_size; - case ES_TYPE_BYTEA: + case OPENSEARCH_TYPE_BYTEA: return column_size; default: if (type == conn->lobj_type) @@ -1237,7 +1239,7 @@ Int4 estype_transfer_octet_length(const StatementClass *stmt, OID type, /* * corrsponds to "min_scale" in ODBC 2.x. */ -Int2 estype_min_decimal_digits(const ConnectionClass *conn, OID type) { +Int2 opensearchtype_min_decimal_digits(const ConnectionClass *conn, OID type) { UNUSED(conn, type); return -1; } @@ -1245,7 +1247,7 @@ Int2 estype_min_decimal_digits(const ConnectionClass *conn, OID type) { /* * corrsponds to "max_scale" in ODBC 2.x. */ -Int2 estype_max_decimal_digits(const ConnectionClass *conn, OID type) { +Int2 opensearchtype_max_decimal_digits(const ConnectionClass *conn, OID type) { UNUSED(conn, type); return -1; } @@ -1253,47 +1255,47 @@ Int2 estype_max_decimal_digits(const ConnectionClass *conn, OID type) { /* * corrsponds to "scale" in ODBC 2.x. */ -Int2 estype_decimal_digits(const StatementClass *stmt, OID type, int col) { +Int2 opensearchtype_decimal_digits(const StatementClass *stmt, OID type, int col) { int atttypmod, adtsize_or_longestlen; atttypmod = getAtttypmodEtc(stmt, col, &adtsize_or_longestlen); - return estype_attr_decimal_digits(SC_get_conn(stmt), type, atttypmod, - adtsize_or_longestlen, - UNUSED_HANDLE_UNKNOWN_SIZE_AS); + return opensearchtype_attr_decimal_digits(SC_get_conn(stmt), type, + atttypmod, adtsize_or_longestlen, + UNUSED_HANDLE_UNKNOWN_SIZE_AS); } /* * "scale" in ODBC 3.x. */ -Int2 estype_scale(const StatementClass *stmt, OID type, int col) { +Int2 opensearchtype_scale(const StatementClass *stmt, OID type, int col) { int atttypmod, adtsize_or_longestlen; atttypmod = getAtttypmodEtc(stmt, col, &adtsize_or_longestlen); - return estype_attr_scale(SC_get_conn(stmt), type, atttypmod, - adtsize_or_longestlen, - UNUSED_HANDLE_UNKNOWN_SIZE_AS); + return opensearchtype_attr_scale(SC_get_conn(stmt), type, atttypmod, + adtsize_or_longestlen, + UNUSED_HANDLE_UNKNOWN_SIZE_AS); } -Int2 estype_radix(const ConnectionClass *conn, OID type) { +Int2 opensearchtype_radix(const ConnectionClass *conn, OID type) { UNUSED(conn, type); return 10; } -Int2 estype_nullable(const ConnectionClass *conn, OID type) { +Int2 opensearchtype_nullable(const ConnectionClass *conn, OID type) { UNUSED(conn, type); return SQL_NULLABLE_UNKNOWN; /* everything should be nullable unknown */ } -Int2 estype_auto_increment(const ConnectionClass *conn, OID type) { +Int2 opensearchtype_auto_increment(const ConnectionClass *conn, OID type) { UNUSED(conn, type); return SQL_FALSE; } -Int2 estype_case_sensitive(const ConnectionClass *conn, OID type) { +Int2 opensearchtype_case_sensitive(const ConnectionClass *conn, OID type) { UNUSED(conn, type); switch (type) { - case ES_TYPE_KEYWORD: - case ES_TYPE_TEXT: + case OPENSEARCH_TYPE_KEYWORD: + case OPENSEARCH_TYPE_TEXT: return SQL_TRUE; default: @@ -1301,35 +1303,35 @@ Int2 estype_case_sensitive(const ConnectionClass *conn, OID type) { } } -Int2 estype_money(const ConnectionClass *conn, OID type) { +Int2 opensearchtype_money(const ConnectionClass *conn, OID type) { UNUSED(conn, type); return SQL_FALSE; } -Int2 estype_searchable(const ConnectionClass *conn, OID type) { +Int2 opensearchtype_searchable(const ConnectionClass *conn, OID type) { UNUSED(conn, type); return SQL_SEARCHABLE; } -Int2 estype_unsigned(const ConnectionClass *conn, OID type) { +Int2 opensearchtype_unsigned(const ConnectionClass *conn, OID type) { UNUSED(conn); switch (type) { - case ES_TYPE_BOOL: - case ES_TYPE_KEYWORD: - case ES_TYPE_TEXT: - case ES_TYPE_NESTED: - case ES_TYPE_DATETIME: - case ES_TYPE_OBJECT: + case OPENSEARCH_TYPE_BOOL: + case OPENSEARCH_TYPE_KEYWORD: + case OPENSEARCH_TYPE_TEXT: + case OPENSEARCH_TYPE_NESTED: + case OPENSEARCH_TYPE_DATETIME: + case OPENSEARCH_TYPE_OBJECT: return SQL_TRUE; - case ES_TYPE_INT1: - case ES_TYPE_INT2: - case ES_TYPE_INT4: - case ES_TYPE_INT8: - case ES_TYPE_HALF_FLOAT: - case ES_TYPE_FLOAT4: - case ES_TYPE_FLOAT8: - case ES_TYPE_SCALED_FLOAT: + case OPENSEARCH_TYPE_INT1: + case OPENSEARCH_TYPE_INT2: + case OPENSEARCH_TYPE_INT4: + case OPENSEARCH_TYPE_INT8: + case OPENSEARCH_TYPE_HALF_FLOAT: + case OPENSEARCH_TYPE_FLOAT4: + case OPENSEARCH_TYPE_FLOAT8: + case OPENSEARCH_TYPE_SCALED_FLOAT: return SQL_FALSE; default: @@ -1337,33 +1339,33 @@ Int2 estype_unsigned(const ConnectionClass *conn, OID type) { } } -const char *estype_literal_prefix(const ConnectionClass *conn, OID type) { +const char *opensearchtype_literal_prefix(const ConnectionClass *conn, OID type) { UNUSED(conn); switch (type) { - case ES_TYPE_KEYWORD: - case ES_TYPE_TEXT: - case ES_TYPE_NESTED: - case ES_TYPE_OBJECT: + case OPENSEARCH_TYPE_KEYWORD: + case OPENSEARCH_TYPE_TEXT: + case OPENSEARCH_TYPE_NESTED: + case OPENSEARCH_TYPE_OBJECT: return "\'"; default: return ""; } } -const char *estype_literal_suffix(const ConnectionClass *conn, OID type) { +const char *opensearchtype_literal_suffix(const ConnectionClass *conn, OID type) { UNUSED(conn); switch (type) { - case ES_TYPE_KEYWORD: - case ES_TYPE_TEXT: - case ES_TYPE_NESTED: - case ES_TYPE_OBJECT: + case OPENSEARCH_TYPE_KEYWORD: + case OPENSEARCH_TYPE_TEXT: + case OPENSEARCH_TYPE_NESTED: + case OPENSEARCH_TYPE_OBJECT: return "\'"; default: return ""; } } -const char *estype_create_params(const ConnectionClass *conn, OID type) { +const char *opensearchtype_create_params(const ConnectionClass *conn, OID type) { UNUSED(conn, type); return NULL; } diff --git a/sql-odbc/src/odfesqlodbc/es_types.h b/sql-odbc/src/odfesqlodbc/opensearch_types.h similarity index 57% rename from sql-odbc/src/odfesqlodbc/es_types.h rename to sql-odbc/src/odfesqlodbc/opensearch_types.h index ab133ac9c8..3dd52c863a 100644 --- a/sql-odbc/src/odfesqlodbc/es_types.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.h @@ -14,196 +14,196 @@ * */ -#ifndef ES_TYPES -#define ES_TYPES +#ifndef OPENSEARCH_TYPES +#define OPENSEARCH_TYPES #include "dlg_specific.h" -#include "es_odbc.h" +#include "opensearch_odbc.h" #ifdef __cplusplus extern "C" { #endif /* the type numbers are defined by the OID's of the types' rows */ -/* in table es_type */ +/* in table opensearch_type */ #ifdef NOT_USED #define ES_TYPE_LO ? ? ? ? /* waiting for permanent type */ #endif -#define ES_TYPE_NAME_BOOLEAN "boolean" -#define ES_TYPE_NAME_BYTE "byte" -#define ES_TYPE_NAME_SHORT "short" -#define ES_TYPE_NAME_INTEGER "integer" -#define ES_TYPE_NAME_LONG "long" -#define ES_TYPE_NAME_HALF_FLOAT "half_float" -#define ES_TYPE_NAME_FLOAT "float" -#define ES_TYPE_NAME_DOUBLE "double" -#define ES_TYPE_NAME_SCALED_FLOAT "scaled_float" -#define ES_TYPE_NAME_KEYWORD "keyword" -#define ES_TYPE_NAME_TEXT "text" -#define ES_TYPE_NAME_NESTED "nested" -#define ES_TYPE_NAME_DATE "date" -#define ES_TYPE_NAME_OBJECT "object" -#define ES_TYPE_NAME_VARCHAR "varchar" -#define ES_TYPE_NAME_UNSUPPORTED "unsupported" +#define OPENSEARCH_TYPE_NAME_BOOLEAN "boolean" +#define OPENSEARCH_TYPE_NAME_BYTE "byte" +#define OPENSEARCH_TYPE_NAME_SHORT "short" +#define OPENSEARCH_TYPE_NAME_INTEGER "integer" +#define OPENSEARCH_TYPE_NAME_LONG "long" +#define OPENSEARCH_TYPE_NAME_HALF_FLOAT "half_float" +#define OPENSEARCH_TYPE_NAME_FLOAT "float" +#define OPENSEARCH_TYPE_NAME_DOUBLE "double" +#define OPENSEARCH_TYPE_NAME_SCALED_FLOAT "scaled_float" +#define OPENSEARCH_TYPE_NAME_KEYWORD "keyword" +#define OPENSEARCH_TYPE_NAME_TEXT "text" +#define OPENSEARCH_TYPE_NAME_NESTED "nested" +#define OPENSEARCH_TYPE_NAME_DATE "date" +#define OPENSEARCH_TYPE_NAME_OBJECT "object" +#define OPENSEARCH_TYPE_NAME_VARCHAR "varchar" +#define OPENSEARCH_TYPE_NAME_UNSUPPORTED "unsupported" #define MS_ACCESS_SERIAL "int identity" -#define ES_TYPE_BOOL 16 -#define ES_TYPE_BYTEA 17 -#define ES_TYPE_CHAR 18 -#define ES_TYPE_NAME 19 -#define ES_TYPE_INT8 20 -#define ES_TYPE_INT2 21 -#define ES_TYPE_INT2VECTOR 22 -#define ES_TYPE_INT4 23 -#define ES_TYPE_REGPROC 24 -#define ES_TYPE_TEXT 25 -#define ES_TYPE_OID 26 -#define ES_TYPE_TID 27 -#define ES_TYPE_XID 28 -#define ES_TYPE_CID 29 -#define ES_TYPE_OIDVECTOR 30 -#define ES_TYPE_INT1 31 -#define ES_TYPE_HALF_FLOAT 32 -#define ES_TYPE_SCALED_FLOAT 33 -#define ES_TYPE_KEYWORD 34 -#define ES_TYPE_NESTED 35 -#define ES_TYPE_OBJECT 36 -#define ES_TYPE_XML 142 -#define ES_TYPE_XMLARRAY 143 -#define ES_TYPE_CIDR 650 -#define ES_TYPE_FLOAT4 700 -#define ES_TYPE_FLOAT8 701 -#define ES_TYPE_ABSTIME 702 -#define ES_TYPE_UNKNOWN 705 -#define ES_TYPE_MONEY 790 -#define ES_TYPE_MACADDR 829 -#define ES_TYPE_INET 869 -#define ES_TYPE_TEXTARRAY 1009 -#define ES_TYPE_BPCHARARRAY 1014 -#define ES_TYPE_VARCHARARRAY 1015 -#define ES_TYPE_BPCHAR 1042 -#define ES_TYPE_VARCHAR 1043 -#define ES_TYPE_DATE 1082 -#define ES_TYPE_TIME 1083 -#define ES_TYPE_TIMESTAMP_NO_TMZONE 1114 /* since 7.2 */ -#define ES_TYPE_DATETIME 1184 /* timestamptz */ -#define ES_TYPE_INTERVAL 1186 -#define ES_TYPE_TIME_WITH_TMZONE 1266 /* since 7.1 */ -#define ES_TYPE_TIMESTAMP 1296 /* deprecated since 7.0 */ -#define ES_TYPE_BIT 1560 -#define ES_TYPE_NUMERIC 1700 -#define ES_TYPE_REFCURSOR 1790 -#define ES_TYPE_RECORD 2249 -#define ES_TYPE_ANY 2276 -#define ES_TYPE_VOID 2278 -#define ES_TYPE_UUID 2950 +#define OPENSEARCH_TYPE_BOOL 16 +#define OPENSEARCH_TYPE_BYTEA 17 +#define OPENSEARCH_TYPE_CHAR 18 +#define OPENSEARCH_TYPE_NAME 19 +#define OPENSEARCH_TYPE_INT8 20 +#define OPENSEARCH_TYPE_INT2 21 +#define OPENSEARCH_TYPE_INT2VECTOR 22 +#define OPENSEARCH_TYPE_INT4 23 +#define OPENSEARCH_TYPE_REGPROC 24 +#define OPENSEARCH_TYPE_TEXT 25 +#define OPENSEARCH_TYPE_OID 26 +#define OPENSEARCH_TYPE_TID 27 +#define OPENSEARCH_TYPE_XID 28 +#define OPENSEARCH_TYPE_CID 29 +#define OPENSEARCH_TYPE_OIDVECTOR 30 +#define OPENSEARCH_TYPE_INT1 31 +#define OPENSEARCH_TYPE_HALF_FLOAT 32 +#define OPENSEARCH_TYPE_SCALED_FLOAT 33 +#define OPENSEARCH_TYPE_KEYWORD 34 +#define OPENSEARCH_TYPE_NESTED 35 +#define OPENSEARCH_TYPE_OBJECT 36 +#define OPENSEARCH_TYPE_XML 142 +#define OPENSEARCH_TYPE_XMLARRAY 143 +#define OPENSEARCH_TYPE_CIDR 650 +#define OPENSEARCH_TYPE_FLOAT4 700 +#define OPENSEARCH_TYPE_FLOAT8 701 +#define OPENSEARCH_TYPE_ABSTIME 702 +#define OPENSEARCH_TYPE_UNKNOWN 705 +#define OPENSEARCH_TYPE_MONEY 790 +#define OPENSEARCH_TYPE_MACADDR 829 +#define OPENSEARCH_TYPE_INET 869 +#define OPENSEARCH_TYPE_TEXTARRAY 1009 +#define OPENSEARCH_TYPE_BPCHARARRAY 1014 +#define OPENSEARCH_TYPE_VARCHARARRAY 1015 +#define OPENSEARCH_TYPE_BPCHAR 1042 +#define OPENSEARCH_TYPE_VARCHAR 1043 +#define OPENSEARCH_TYPE_DATE 1082 +#define OPENSEARCH_TYPE_TIME 1083 +#define OPENSEARCH_TYPE_TIMESTAMP_NO_TMZONE 1114 /* since 7.2 */ +#define OPENSEARCH_TYPE_DATETIME 1184 /* timestamptz */ +#define OPENSEARCH_TYPE_INTERVAL 1186 +#define OPENSEARCH_TYPE_TIME_WITH_TMZONE 1266 /* since 7.1 */ +#define OPENSEARCH_TYPE_TIMESTAMP 1296 /* deprecated since 7.0 */ +#define OPENSEARCH_TYPE_BIT 1560 +#define OPENSEARCH_TYPE_NUMERIC 1700 +#define OPENSEARCH_TYPE_REFCURSOR 1790 +#define OPENSEARCH_TYPE_RECORD 2249 +#define OPENSEARCH_TYPE_ANY 2276 +#define OPENSEARCH_TYPE_VOID 2278 +#define OPENSEARCH_TYPE_UUID 2950 #define INTERNAL_ASIS_TYPE (-9999) #define TYPE_MAY_BE_ARRAY(type) \ - ((type) == ES_TYPE_XMLARRAY || ((type) >= 1000 && (type) <= 1041)) -/* extern Int4 es_types_defined[]; */ + ((type) == OPENSEARCH_TYPE_XMLARRAY || ((type) >= 1000 && (type) <= 1041)) +/* extern Int4 opensearch_types_defined[]; */ extern SQLSMALLINT sqlTypes[]; -/* Defines for estype_precision */ -#define ES_ATP_UNSET (-3) /* atttypmod */ -#define ES_ADT_UNSET (-3) /* adtsize_or_longestlen */ -#define ES_UNKNOWNS_UNSET 0 /* UNKNOWNS_AS_MAX */ -#define ES_WIDTH_OF_BOOLS_AS_CHAR 5 +/* Defines for opensearchtype_precision */ +#define OPENSEARCH_ATP_UNSET (-3) /* atttypmod */ +#define OPENSEARCH_ADT_UNSET (-3) /* adtsize_or_longestlen */ +#define OPENSEARCH_UNKNOWNS_UNSET 0 /* UNKNOWNS_AS_MAX */ +#define OPENSEARCH_WIDTH_OF_BOOLS_AS_CHAR 5 /* * SQL_INTERVAL support is disabled because I found * some applications which are unhappy with it. * -#define ES_INTERVAL_AS_SQL_INTERVAL +#define OPENSEARCH_INTERVAL_AS_SQL_INTERVAL */ -OID es_true_type(const ConnectionClass *, OID, OID); -OID sqltype_to_estype(const ConnectionClass *conn, SQLSMALLINT fSqlType); -const char *sqltype_to_escast(const ConnectionClass *conn, +OID opensearch_true_type(const ConnectionClass *, OID, OID); +OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType); +const char *sqltype_to_opensearchcast(const ConnectionClass *conn, SQLSMALLINT fSqlType); -SQLSMALLINT estype_to_concise_type(const StatementClass *stmt, OID type, +SQLSMALLINT opensearchtype_to_concise_type(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as); -SQLSMALLINT estype_to_sqldesctype(const StatementClass *stmt, OID type, int col, +SQLSMALLINT opensearchtype_to_sqldesctype(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as); -const char *estype_to_name(const StatementClass *stmt, OID type, int col, +const char *opensearchtype_to_name(const StatementClass *stmt, OID type, int col, BOOL auto_increment); -SQLSMALLINT estype_attr_to_concise_type(const ConnectionClass *conn, OID type, +SQLSMALLINT opensearchtype_attr_to_concise_type(const ConnectionClass *conn, OID type, int typmod, int adtsize_or_longestlen, int handle_unknown_size_as); -SQLSMALLINT estype_attr_to_sqldesctype(const ConnectionClass *conn, OID type, +SQLSMALLINT opensearchtype_attr_to_sqldesctype(const ConnectionClass *conn, OID type, int typmod, int adtsize_or_longestlen, int handle_unknown_size_as); -SQLSMALLINT estype_attr_to_datetime_sub(const ConnectionClass *conn, OID type, +SQLSMALLINT opensearchtype_attr_to_datetime_sub(const ConnectionClass *conn, OID type, int typmod); -SQLSMALLINT estype_attr_to_ctype(const ConnectionClass *conn, OID type, +SQLSMALLINT opensearchtype_attr_to_ctype(const ConnectionClass *conn, OID type, int typmod); -const char *estype_attr_to_name(const ConnectionClass *conn, OID type, +const char *opensearchtype_attr_to_name(const ConnectionClass *conn, OID type, int typmod, BOOL auto_increment); -Int4 estype_attr_column_size(const ConnectionClass *conn, OID type, +Int4 opensearchtype_attr_column_size(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longest, int handle_unknown_size_as); -Int4 estype_attr_buffer_length(const ConnectionClass *conn, OID type, +Int4 opensearchtype_attr_buffer_length(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as); -Int4 estype_attr_display_size(const ConnectionClass *conn, OID type, +Int4 opensearchtype_attr_display_size(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as); -Int2 estype_attr_decimal_digits(const ConnectionClass *conn, OID type, +Int2 opensearchtype_attr_decimal_digits(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as); -Int4 estype_attr_transfer_octet_length(const ConnectionClass *conn, OID type, +Int4 opensearchtype_attr_transfer_octet_length(const ConnectionClass *conn, OID type, int atttypmod, int handle_unknown_size_as); -SQLSMALLINT estype_attr_precision(const ConnectionClass *conn, OID type, +SQLSMALLINT opensearchtype_attr_precision(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longest, int handle_unknown_size_as); -Int4 estype_attr_desclength(const ConnectionClass *conn, OID type, +Int4 opensearchtype_attr_desclength(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as); -Int2 estype_attr_scale(const ConnectionClass *conn, OID type, int atttypmod, +Int2 opensearchtype_attr_scale(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as); /* These functions can use static numbers or result sets(col parameter) */ -Int4 estype_column_size( +Int4 opensearchtype_column_size( const StatementClass *stmt, OID type, int col, int handle_unknown_size_as); /* corresponds to "precision" in ODBC 2.x */ -SQLSMALLINT estype_precision( +SQLSMALLINT opensearchtype_precision( const StatementClass *stmt, OID type, int col, int handle_unknown_size_as); /* "precsion in ODBC 3.x */ /* the following size/length are of Int4 due to ES restriction */ -Int4 estype_display_size(const StatementClass *stmt, OID type, int col, +Int4 opensearchtype_display_size(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as); -Int4 estype_buffer_length(const StatementClass *stmt, OID type, int col, +Int4 opensearchtype_buffer_length(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as); -Int4 estype_desclength(const StatementClass *stmt, OID type, int col, +Int4 opensearchtype_desclength(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as); -// Int4 estype_transfer_octet_length(const ConnectionClass *conn, OID type, +// Int4 opensearchtype_transfer_octet_length(const ConnectionClass *conn, OID type, // int column_size); -SQLSMALLINT estype_decimal_digits( +SQLSMALLINT opensearchtype_decimal_digits( const StatementClass *stmt, OID type, int col); /* corresponds to "scale" in ODBC 2.x */ -SQLSMALLINT estype_min_decimal_digits( +SQLSMALLINT opensearchtype_min_decimal_digits( const ConnectionClass *conn, OID type); /* corresponds to "min_scale" in ODBC 2.x */ -SQLSMALLINT estype_max_decimal_digits( +SQLSMALLINT opensearchtype_max_decimal_digits( const ConnectionClass *conn, OID type); /* corresponds to "max_scale" in ODBC 2.x */ -SQLSMALLINT estype_scale(const StatementClass *stmt, OID type, +SQLSMALLINT opensearchtype_scale(const StatementClass *stmt, OID type, int col); /* ODBC 3.x " */ -Int2 estype_radix(const ConnectionClass *conn, OID type); -Int2 estype_nullable(const ConnectionClass *conn, OID type); -Int2 estype_auto_increment(const ConnectionClass *conn, OID type); -Int2 estype_case_sensitive(const ConnectionClass *conn, OID type); -Int2 estype_money(const ConnectionClass *conn, OID type); -Int2 estype_searchable(const ConnectionClass *conn, OID type); -Int2 estype_unsigned(const ConnectionClass *conn, OID type); -const char *estype_literal_prefix(const ConnectionClass *conn, OID type); -const char *estype_literal_suffix(const ConnectionClass *conn, OID type); -const char *estype_create_params(const ConnectionClass *conn, OID type); +Int2 opensearchtype_radix(const ConnectionClass *conn, OID type); +Int2 opensearchtype_nullable(const ConnectionClass *conn, OID type); +Int2 opensearchtype_auto_increment(const ConnectionClass *conn, OID type); +Int2 opensearchtype_case_sensitive(const ConnectionClass *conn, OID type); +Int2 opensearchtype_money(const ConnectionClass *conn, OID type); +Int2 opensearchtype_searchable(const ConnectionClass *conn, OID type); +Int2 opensearchtype_unsigned(const ConnectionClass *conn, OID type); +const char *opensearchtype_literal_prefix(const ConnectionClass *conn, OID type); +const char *opensearchtype_literal_suffix(const ConnectionClass *conn, OID type); +const char *opensearchtype_create_params(const ConnectionClass *conn, OID type); SQLSMALLINT sqltype_to_default_ctype(const ConnectionClass *stmt, SQLSMALLINT sqltype); @@ -334,7 +334,7 @@ typedef struct ColumnInfo { } } ColumnInfo; -typedef struct ESResult { +typedef struct OpenSearchResult { uint32_t ref_count; // reference count. A ColumnInfo can be shared by // several qresults. uint16_t num_fields; @@ -342,14 +342,14 @@ typedef struct ESResult { std::string cursor; std::string result_json; std::string command_type; // SELECT / FETCH / etc - rabbit::document es_result_doc; - ESResult() { + rabbit::document opensearch_result_doc; + OpenSearchResult() { ref_count = 0; num_fields = 0; result_json = ""; command_type = ""; } -} ESResult; +} OpenSearchResult; #endif #endif diff --git a/sql-odbc/src/odfesqlodbc/es_utility.cpp b/sql-odbc/src/odfesqlodbc/opensearch_utility.cpp similarity index 78% rename from sql-odbc/src/odfesqlodbc/es_utility.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_utility.cpp index 1da446eaae..80cf269660 100644 --- a/sql-odbc/src/odfesqlodbc/es_utility.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_utility.cpp @@ -14,7 +14,7 @@ * */ -#include "es_utility.h" +#include "opensearch_utility.h" #include #include @@ -32,7 +32,7 @@ static char oom_buffer[1] = ""; static char *oom_buffer_ptr = oom_buffer; -static void MarkESExpBufferBroken(ESExpBuffer str) { +static void MarkOpenSearchExpBufferBroken(OpenSearchExpBuffer str) { if (str->data != oom_buffer) free(str->data); str->data = oom_buffer_ptr; @@ -40,12 +40,12 @@ static void MarkESExpBufferBroken(ESExpBuffer str) { str->maxlen = 0; } -static bool EnlargeESExpBuffer(ESExpBuffer str, size_t needed) { - if (ESExpBufferBroken(str)) +static bool EnlargeOpenSearchExpBuffer(OpenSearchExpBuffer str, size_t needed) { + if (OpenSearchExpBufferBroken(str)) return 0; if (needed >= ((size_t)INT_MAX - str->len)) { - MarkESExpBufferBroken(str); + MarkOpenSearchExpBufferBroken(str); return false; } @@ -67,11 +67,11 @@ static bool EnlargeESExpBuffer(ESExpBuffer str, size_t needed) { return true; } - MarkESExpBufferBroken(str); + MarkOpenSearchExpBufferBroken(str); return false; } -static bool AppendESExpBufferVA(ESExpBuffer str, const char *fmt, +static bool AppendOpenSearchExpBufferVA(OpenSearchExpBuffer str, const char *fmt, va_list args) { size_t needed = 32; if (str->maxlen > (str->len + 16)) { @@ -79,7 +79,7 @@ static bool AppendESExpBufferVA(ESExpBuffer str, const char *fmt, int nprinted = vsnprintf(str->data + str->len, avail, fmt, args); if ((nprinted < 0) || (nprinted > (INT_MAX - 1))) { - MarkESExpBufferBroken(str); + MarkOpenSearchExpBufferBroken(str); return true; } else if ((size_t)nprinted < avail) { str->len += nprinted; @@ -87,10 +87,10 @@ static bool AppendESExpBufferVA(ESExpBuffer str, const char *fmt, } needed = nprinted + 1; } - return !EnlargeESExpBuffer(str, needed); + return !EnlargeOpenSearchExpBuffer(str, needed); } -void InitESExpBuffer(ESExpBuffer str) { +void InitOpenSearchExpBuffer(OpenSearchExpBuffer str) { str->data = (char *)malloc(INITIAL_EXPBUFFER_SIZE); if (str->data == NULL) { str->data = oom_buffer_ptr; @@ -102,8 +102,8 @@ void InitESExpBuffer(ESExpBuffer str) { str->len = 0; } -void AppendESExpBuffer(ESExpBuffer str, const char *fmt, ...) { - if (ESExpBufferBroken(str)) +void AppendOpenSearchExpBuffer(OpenSearchExpBuffer str, const char *fmt, ...) { + if (OpenSearchExpBufferBroken(str)) return; va_list args; @@ -112,12 +112,12 @@ void AppendESExpBuffer(ESExpBuffer str, const char *fmt, ...) { do { errno = save_errno; va_start(args, fmt); - done = AppendESExpBufferVA(str, fmt, args); + done = AppendOpenSearchExpBufferVA(str, fmt, args); va_end(args); } while (!done); } -void TermESExpBuffer(ESExpBuffer str) { +void TermOpenSearchExpBuffer(OpenSearchExpBuffer str) { if (str->data != oom_buffer) free(str->data); str->data = oom_buffer_ptr; diff --git a/sql-odbc/src/odfesqlodbc/es_utility.h b/sql-odbc/src/odfesqlodbc/opensearch_utility.h similarity index 58% rename from sql-odbc/src/odfesqlodbc/es_utility.h rename to sql-odbc/src/odfesqlodbc/opensearch_utility.h index 0093a39ef0..6c1615b189 100644 --- a/sql-odbc/src/odfesqlodbc/es_utility.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_utility.h @@ -14,8 +14,8 @@ * */ -#ifndef ES_UTILITY_H -#define ES_UTILITY_H +#ifndef OPENSEARCH_UTILITY_H +#define OPENSEARCH_UTILITY_H #include @@ -23,24 +23,24 @@ extern "C" { #endif -typedef struct ESExpBufferData { +typedef struct OpenSearchExpBufferData { char *data; size_t len; size_t maxlen; -} ESExpBufferData; +} OpenSearchExpBufferData; -typedef ESExpBufferData *ESExpBuffer; +typedef OpenSearchExpBufferData *OpenSearchExpBuffer; -#define ESExpBufferBroken(str) ((str) == NULL || (str)->maxlen == 0) -#define ESExpBufferDataBroken(buf) ((buf).maxlen == 0) +#define OpenSearchExpBufferBroken(str) ((str) == NULL || (str)->maxlen == 0) +#define OpenSearchExpBufferDataBroken(buf) ((buf).maxlen == 0) #define INITIAL_EXPBUFFER_SIZE 256 -void InitESExpBuffer(ESExpBuffer str); -void AppendESExpBuffer(ESExpBuffer str, const char *fmt, ...); -void TermESExpBuffer(ESExpBuffer str); +void InitOpenSearchExpBuffer(OpenSearchExpBuffer str); +void AppendOpenSearchExpBuffer(OpenSearchExpBuffer str, const char *fmt, ...); +void TermOpenSearchExpBuffer(OpenSearchExpBuffer str); #ifdef __cplusplus } #endif -#endif /* ES_UTILITY_H */ +#endif /* OPENSEARCH_UTILITY_H */ diff --git a/sql-odbc/src/odfesqlodbc/options.c b/sql-odbc/src/odfesqlodbc/options.c index 2210fdf784..aaf53f5812 100644 --- a/sql-odbc/src/odfesqlodbc/options.c +++ b/sql-odbc/src/odfesqlodbc/options.c @@ -17,10 +17,10 @@ #include #include "environ.h" -#include "es_apifunc.h" -#include "es_connection.h" -#include "es_odbc.h" +#include "opensearch_odbc.h" #include "misc.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" #include "unicode_support.h" @@ -53,7 +53,7 @@ static RETCODE set_statement_option(ConnectionClass *conn, StatementClass *stmt, * positioned update isn't supported so cursor concurrency is * read-only */ - MYLOG(ES_DEBUG, "SQL_CONCURRENCY = " FORMAT_LEN " ", vParam); + MYLOG(OPENSEARCH_DEBUG, "SQL_CONCURRENCY = " FORMAT_LEN " ", vParam); setval = SQL_CONCUR_READ_ONLY; if (conn) conn->stmtOptions.scroll_concurrency = (SQLUINTEGER)setval; @@ -78,7 +78,7 @@ static RETCODE set_statement_option(ConnectionClass *conn, StatementClass *stmt, * if declare/fetch, then type can only be forward. otherwise, * it can only be forward or static. */ - MYLOG(ES_DEBUG, "SQL_CURSOR_TYPE = " FORMAT_LEN " ", vParam); + MYLOG(OPENSEARCH_DEBUG, "SQL_CURSOR_TYPE = " FORMAT_LEN " ", vParam); setval = SQL_CURSOR_FORWARD_ONLY; if (SQL_CURSOR_STATIC == vParam) setval = vParam; @@ -106,7 +106,7 @@ static RETCODE set_statement_option(ConnectionClass *conn, StatementClass *stmt, break; case SQL_KEYSET_SIZE: /* ignored, but saved and returned */ - MYLOG(ES_DEBUG, "SQL_KEYSET_SIZE, vParam = " FORMAT_LEN "\n", + MYLOG(OPENSEARCH_DEBUG, "SQL_KEYSET_SIZE, vParam = " FORMAT_LEN "\n", vParam); if (conn) @@ -122,7 +122,7 @@ static RETCODE set_statement_option(ConnectionClass *conn, StatementClass *stmt, break; case SQL_MAX_LENGTH: /* ignored, but saved */ - MYLOG(ES_DEBUG, "SQL_MAX_LENGTH, vParam = " FORMAT_LEN "\n", + MYLOG(OPENSEARCH_DEBUG, "SQL_MAX_LENGTH, vParam = " FORMAT_LEN "\n", vParam); if (conn) conn->stmtOptions.maxLength = vParam; @@ -136,7 +136,7 @@ static RETCODE set_statement_option(ConnectionClass *conn, StatementClass *stmt, break; case SQL_MAX_ROWS: /* ignored, but saved */ - MYLOG(ES_DEBUG, "SQL_MAX_ROWS, vParam = " FORMAT_LEN "\n", vParam); + MYLOG(OPENSEARCH_DEBUG, "SQL_MAX_ROWS, vParam = " FORMAT_LEN "\n", vParam); if (conn) conn->stmtOptions.maxRows = vParam; if (stmt) { @@ -149,11 +149,11 @@ static RETCODE set_statement_option(ConnectionClass *conn, StatementClass *stmt, break; case SQL_NOSCAN: /* ignored */ - MYLOG(ES_DEBUG, "SQL_NOSCAN, vParam = " FORMAT_LEN "\n", vParam); + MYLOG(OPENSEARCH_DEBUG, "SQL_NOSCAN, vParam = " FORMAT_LEN "\n", vParam); break; case SQL_QUERY_TIMEOUT: /* ignored */ - MYLOG(ES_DEBUG, "SQL_QUERY_TIMEOUT, vParam = " FORMAT_LEN "\n", + MYLOG(OPENSEARCH_DEBUG, "SQL_QUERY_TIMEOUT, vParam = " FORMAT_LEN "\n", vParam); if (conn) conn->stmtOptions.stmt_timeout = (SQLULEN)vParam; @@ -162,7 +162,7 @@ static RETCODE set_statement_option(ConnectionClass *conn, StatementClass *stmt, break; case SQL_RETRIEVE_DATA: - MYLOG(ES_DEBUG, "SQL_RETRIEVE_DATA, vParam = " FORMAT_LEN "\n", + MYLOG(OPENSEARCH_DEBUG, "SQL_RETRIEVE_DATA, vParam = " FORMAT_LEN "\n", vParam); if (conn) conn->stmtOptions.retrieve_data = (SQLUINTEGER)vParam; @@ -171,7 +171,7 @@ static RETCODE set_statement_option(ConnectionClass *conn, StatementClass *stmt, break; case SQL_ROWSET_SIZE: - MYLOG(ES_DEBUG, "SQL_ROWSET_SIZE, vParam = " FORMAT_LEN "\n", + MYLOG(OPENSEARCH_DEBUG, "SQL_ROWSET_SIZE, vParam = " FORMAT_LEN "\n", vParam); if (vParam < 1) { @@ -203,7 +203,7 @@ static RETCODE set_statement_option(ConnectionClass *conn, StatementClass *stmt, case SQL_USE_BOOKMARKS: if (stmt) { MYLOG( - ES_DEBUG, "USE_BOOKMARKS %s\n", + OPENSEARCH_DEBUG, "USE_BOOKMARKS %s\n", (vParam == SQL_UB_OFF) ? "off" : ((vParam == SQL_UB_VARIABLE) ? "variable" : "fixed")); @@ -276,15 +276,15 @@ static RETCODE set_statement_option(ConnectionClass *conn, StatementClass *stmt, } /* Implements only SQL_AUTOCOMMIT */ -RETCODE SQL_API ESAPI_SetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, +RETCODE SQL_API OPENSEARCHAPI_SetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, SQLULEN vParam) { - CSTR func = "ESAPI_SetConnectOption"; + CSTR func = "OPENSEARCHAPI_SetConnectOption"; ConnectionClass *conn = (ConnectionClass *)hdbc; char changed = FALSE; RETCODE retval; BOOL autocomm_on; - MYLOG(ES_TRACE, "entering fOption = %d vParam = " FORMAT_LEN "\n", fOption, + MYLOG(OPENSEARCH_TRACE, "entering fOption = %d vParam = " FORMAT_LEN "\n", fOption, vParam); if (!conn) { CC_log_error(func, "", NULL); @@ -349,7 +349,7 @@ RETCODE SQL_API ESAPI_SetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, break; conn->autocommit_public = (autocomm_on ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF); - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "AUTOCOMMIT: transact_status=%d, vparam=" FORMAT_LEN "\n", conn->transact_status, vParam); @@ -416,7 +416,7 @@ RETCODE SQL_API ESAPI_SetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, #endif /* UNICODE_SUPPORT */ cmp = strncmp((char *)vParam, "Microsoft Jet", 13); if (0 == cmp) { - MYLOG(ES_DEBUG, "Microsoft Jet !!!!\n"); + MYLOG(OPENSEARCH_DEBUG, "Microsoft Jet !!!!\n"); CC_set_errornumber(conn, 0); conn->ms_jet = 1; return SQL_SUCCESS; @@ -437,16 +437,16 @@ RETCODE SQL_API ESAPI_SetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, } /* This function just can tell you whether you are in Autcommit mode or not */ -RETCODE SQL_API ESAPI_GetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, +RETCODE SQL_API OPENSEARCHAPI_GetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, PTR pvParam, SQLINTEGER *StringLength, SQLINTEGER BufferLength) { - CSTR func = "ESAPI_GetConnectOption"; + CSTR func = "OPENSEARCHAPI_GetConnectOption"; ConnectionClass *conn = (ConnectionClass *)hdbc; const char *p = NULL; SQLLEN len = sizeof(SQLINTEGER); SQLRETURN result = SQL_SUCCESS; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); if (!conn) { CC_log_error(func, "", NULL); @@ -497,7 +497,7 @@ RETCODE SQL_API ESAPI_GetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, #else case 1209: #endif /* SQL_ATTR_CONNECTION_DEAD */ - MYLOG(ES_DEBUG, "CONNECTION_DEAD status=%d", conn->status); + MYLOG(OPENSEARCH_DEBUG, "CONNECTION_DEAD status=%d", conn->status); *((SQLUINTEGER *)pvParam) = CC_not_connected(conn); MYPRINTF(0, " val=" FORMAT_UINTEGER "\n", *((SQLUINTEGER *)pvParam)); @@ -505,7 +505,7 @@ RETCODE SQL_API ESAPI_GetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, case SQL_ATTR_ANSI_APP: *((SQLUINTEGER *)pvParam) = CC_is_in_ansi_app(conn); - MYLOG(ES_DEBUG, "ANSI_APP val=" FORMAT_UINTEGER "\n", + MYLOG(OPENSEARCH_DEBUG, "ANSI_APP val=" FORMAT_UINTEGER "\n", *((SQLUINTEGER *)pvParam)); break; @@ -559,13 +559,13 @@ RETCODE SQL_API ESAPI_GetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, return result; } -RETCODE SQL_API ESAPI_SetStmtOption(HSTMT hstmt, SQLUSMALLINT fOption, +RETCODE SQL_API OPENSEARCHAPI_SetStmtOption(HSTMT hstmt, SQLUSMALLINT fOption, SQLULEN vParam) { - CSTR func = "ESAPI_SetStmtOption"; + CSTR func = "OPENSEARCHAPI_SetStmtOption"; StatementClass *stmt = (StatementClass *)hstmt; RETCODE retval; - MYLOG(ES_DEBUG, " entering...\n"); + MYLOG(OPENSEARCH_DEBUG, " entering...\n"); /* * Though we could fake Access out by just returning SQL_SUCCESS all @@ -581,18 +581,18 @@ RETCODE SQL_API ESAPI_SetStmtOption(HSTMT hstmt, SQLUSMALLINT fOption, return retval; } -RETCODE SQL_API ESAPI_GetStmtOption(HSTMT hstmt, SQLUSMALLINT fOption, +RETCODE SQL_API OPENSEARCHAPI_GetStmtOption(HSTMT hstmt, SQLUSMALLINT fOption, PTR pvParam, SQLINTEGER *StringLength, SQLINTEGER BufferLength) { UNUSED(BufferLength); - CSTR func = "ESAPI_GetStmtOption"; + CSTR func = "OPENSEARCHAPI_GetStmtOption"; StatementClass *stmt = (StatementClass *)hstmt; QResultClass *res; SQLLEN ridx; SQLINTEGER len = sizeof(SQLINTEGER); Int4 bookmark; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); /* * thought we could fake Access out by just returning SQL_SUCCESS all @@ -655,19 +655,19 @@ RETCODE SQL_API ESAPI_GetStmtOption(HSTMT hstmt, SQLUSMALLINT fOption, break; case SQL_CONCURRENCY: /* NOT REALLY SUPPORTED */ - MYLOG(ES_DEBUG, "SQL_CONCURRENCY " FORMAT_INTEGER "\n", + MYLOG(OPENSEARCH_DEBUG, "SQL_CONCURRENCY " FORMAT_INTEGER "\n", stmt->options.scroll_concurrency); *((SQLINTEGER *)pvParam) = stmt->options.scroll_concurrency; break; case SQL_CURSOR_TYPE: /* PARTIAL SUPPORT */ - MYLOG(ES_DEBUG, "SQL_CURSOR_TYPE " FORMAT_INTEGER "\n", + MYLOG(OPENSEARCH_DEBUG, "SQL_CURSOR_TYPE " FORMAT_INTEGER "\n", stmt->options.cursor_type); *((SQLINTEGER *)pvParam) = stmt->options.cursor_type; break; case SQL_KEYSET_SIZE: /* NOT SUPPORTED, but saved */ - MYLOG(ES_DEBUG, "SQL_KEYSET_SIZE\n"); + MYLOG(OPENSEARCH_DEBUG, "SQL_KEYSET_SIZE\n"); *((SQLLEN *)pvParam) = stmt->options.keyset_size; break; @@ -677,7 +677,7 @@ RETCODE SQL_API ESAPI_GetStmtOption(HSTMT hstmt, SQLUSMALLINT fOption, case SQL_MAX_ROWS: /* NOT SUPPORTED, but saved */ *((SQLLEN *)pvParam) = stmt->options.maxRows; - MYLOG(ES_DEBUG, "MAX_ROWS, returning " FORMAT_LEN "\n", + MYLOG(OPENSEARCH_DEBUG, "MAX_ROWS, returning " FORMAT_LEN "\n", stmt->options.maxRows); break; diff --git a/sql-odbc/src/odfesqlodbc/parse.c b/sql-odbc/src/odfesqlodbc/parse.c index 4fde3f0b4f..60c093402e 100644 --- a/sql-odbc/src/odfesqlodbc/parse.c +++ b/sql-odbc/src/odfesqlodbc/parse.c @@ -14,22 +14,20 @@ * */ -#include "es_odbc.h" - #include #include #include #include "catfunc.h" -#include "es_apifunc.h" -#include "es_connection.h" -#include "es_types.h" -#include "qresult.h" -#include "statement.h" - -#include "es_info.h" +#include "opensearch_odbc.h" +#include "opensearch_types.h" #include "misc.h" #include "multibyte.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" +#include "opensearch_info.h" +#include "qresult.h" +#include "statement.h" Int4 FI_precision(const FIELD_INFO *fi) { OID ftype; @@ -38,10 +36,10 @@ Int4 FI_precision(const FIELD_INFO *fi) { return -1; ftype = FI_type(fi); switch (ftype) { - case ES_TYPE_NUMERIC: + case OPENSEARCH_TYPE_NUMERIC: return fi->column_size; - case ES_TYPE_DATETIME: - case ES_TYPE_TIMESTAMP_NO_TMZONE: + case OPENSEARCH_TYPE_DATETIME: + case OPENSEARCH_TYPE_TIMESTAMP_NO_TMZONE: return fi->decimal_digits; } return 0; diff --git a/sql-odbc/src/odfesqlodbc/qresult.c b/sql-odbc/src/odfesqlodbc/qresult.c index 0348076e26..a26b740463 100644 --- a/sql-odbc/src/odfesqlodbc/qresult.c +++ b/sql-odbc/src/odfesqlodbc/qresult.c @@ -20,8 +20,8 @@ #include #include -#include "es_statement.h" #include "misc.h" +#include "opensearch_statement.h" #include "statement.h" /* @@ -31,11 +31,11 @@ void QR_set_num_fields(QResultClass *self, int new_num_fields) { if (!self) return; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); CI_set_num_fields(QR_get_fields(self), (SQLSMALLINT)new_num_fields); - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); } void QR_set_position(QResultClass *self, SQLLEN pos) { @@ -91,7 +91,7 @@ void QR_set_rowstart_in_cache(QResultClass *self, SQLLEN start) { void QR_inc_rowstart_in_cache(QResultClass *self, SQLLEN base_inc) { if (!QR_has_valid_base(self)) - MYLOG(ES_DEBUG, " called while the cache is not ready\n"); + MYLOG(OPENSEARCH_DEBUG, " called while the cache is not ready\n"); self->base += base_inc; if (QR_synchronize_keys(self)) self->key_base = self->base; @@ -124,7 +124,7 @@ void QR_set_fields(QResultClass *self, ColumnInfoClass *fields) { QResultClass *QR_Constructor(void) { QResultClass *rv; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); rv = (QResultClass *)malloc(sizeof(QResultClass)); if (rv != NULL) { @@ -162,7 +162,7 @@ QResultClass *QR_Constructor(void) { rv->cursTuple = -1; rv->move_offset = 0; rv->num_fields = 0; - rv->num_key_fields = ES_NUM_NORMAL_KEYS; /* CTID + OID */ + rv->num_key_fields = OPENSEARCH_NUM_NORMAL_KEYS; /* CTID + OID */ rv->tupleField = NULL; rv->cursor_name = NULL; rv->aborted = FALSE; @@ -190,11 +190,11 @@ QResultClass *QR_Constructor(void) { rv->dl_count = 0; rv->deleted = NULL; rv->deleted_keyset = NULL; - rv->es_result = NULL; + rv->opensearch_result = NULL; rv->server_cursor_id = NULL; } - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); return rv; } @@ -205,7 +205,7 @@ void QR_close_result(QResultClass *self, BOOL destroy) { if (!self) return; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); while (self) { QR_free_memory(self); /* safe to call anyway */ @@ -258,11 +258,11 @@ void QR_close_result(QResultClass *self, BOOL destroy) { top = FALSE; } - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); } void QR_reset_for_re_execute(QResultClass *self) { - MYLOG(ES_TRACE, "entering for %p\n", self); + MYLOG(OPENSEARCH_TRACE, "entering for %p\n", self); if (!self) return; QR_close_result(self, FALSE); @@ -276,16 +276,16 @@ void QR_reset_for_re_execute(QResultClass *self) { self->sqlstate[0] = '\0'; self->messageref = NULL; - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); } void QR_Destructor(QResultClass *self) { - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if (!self) return; QR_close_result(self, TRUE); - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); } void QR_set_command(QResultClass *self, const char *msg) { @@ -372,7 +372,7 @@ TupleField *QR_AddNew(QResultClass *self) { if (!self) return NULL; - MYLOG(ES_ALL, FORMAT_ULEN "th row(%d fields) alloc=" FORMAT_LEN "\n", + MYLOG(OPENSEARCH_ALL, FORMAT_ULEN "th row(%d fields) alloc=" FORMAT_LEN "\n", self->num_cached_rows, QR_NumResultCols(self), self->count_backend_allocated); if (num_fields = QR_NumResultCols(self), !num_fields) @@ -409,7 +409,7 @@ void QR_free_memory(QResultClass *self) { SQLLEN num_backend_rows = self->num_cached_rows; int num_fields = self->num_fields; - MYLOG(ES_TRACE, "entering fcount=" FORMAT_LEN "\n", num_backend_rows); + MYLOG(OPENSEARCH_TRACE, "entering fcount=" FORMAT_LEN "\n", num_backend_rows); if (self->backend_tuples) { ClearCachedRows(self->backend_tuples, num_fields, num_backend_rows); @@ -467,9 +467,9 @@ void QR_free_memory(QResultClass *self) { free(self->updated_tuples); self->updated_tuples = NULL; } - if (self->es_result) { - ClearESResult(self->es_result); - self->es_result = NULL; + if (self->opensearch_result) { + ClearOpenSearchResult(self->opensearch_result); + self->opensearch_result = NULL; } self->up_alloc = 0; @@ -481,5 +481,5 @@ void QR_free_memory(QResultClass *self) { self->cursTuple = -1; self->pstatus = 0; - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); } diff --git a/sql-odbc/src/odfesqlodbc/qresult.h b/sql-odbc/src/odfesqlodbc/qresult.h index 1b30e5709a..44fd277fc5 100644 --- a/sql-odbc/src/odfesqlodbc/qresult.h +++ b/sql-odbc/src/odfesqlodbc/qresult.h @@ -18,8 +18,8 @@ #define __QRESULT_H__ #include "columninfo.h" -#include "es_connection.h" -#include "es_odbc.h" +#include "opensearch_connection.h" +#include "opensearch_odbc.h" #include "tuple.h" #ifdef __cplusplus @@ -31,7 +31,7 @@ typedef enum QueryResultCode_ { PORES_COMMAND_OK, /* a query command that doesn't return * anything was executed properly by the backend */ PORES_TUPLES_OK, /* a query command that returns tuples - * was executed properly by the backend, ESresult + * was executed properly by the backend, OpenSearchResult * contains the resulttuples */ PORES_COPY_OUT, PORES_COPY_IN, @@ -117,7 +117,7 @@ struct QResultClass_ { SQLLEN *updated; /* updated index info */ KeySet *updated_keyset; /* uddated keyset info */ TupleField *updated_tuples; /* uddated data by myself */ - void *es_result; + void *opensearch_result; char *server_cursor_id; }; @@ -215,15 +215,15 @@ enum { } while (0) #define QR_set_next_in_cache(self, number) \ do { \ - MYLOG(ES_ALL, "set the number to " FORMAT_LEN " to read next\n", \ + MYLOG(OPENSEARCH_ALL, "set the number to " FORMAT_LEN " to read next\n", \ number); \ self->fetch_number = number; \ } while (0) #define QR_inc_next_in_cache(self) \ do { \ - MYLOG(ES_ALL, "increased the number " FORMAT_LEN, self->fetch_number); \ + MYLOG(OPENSEARCH_ALL, "increased the number " FORMAT_LEN, self->fetch_number); \ self->fetch_number++; \ - MYLOG(ES_ALL, "to " FORMAT_LEN " to next read\n", self->fetch_number); \ + MYLOG(OPENSEARCH_ALL, "to " FORMAT_LEN " to next read\n", self->fetch_number); \ } while (0) #define QR_get_message(self) \ diff --git a/sql-odbc/src/odfesqlodbc/resource.h b/sql-odbc/src/odfesqlodbc/resource.h index fe17397e22..ff5fc59c8d 100644 --- a/sql-odbc/src/odfesqlodbc/resource.h +++ b/sql-odbc/src/odfesqlodbc/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by es_odbc.rc +// Used by opensearch_odbc.rc // #define IDS_BADDSN 1 #define IDS_MSGTITLE 2 diff --git a/sql-odbc/src/odfesqlodbc/results.c b/sql-odbc/src/odfesqlodbc/results.c index bc37adae14..2b22767bf7 100644 --- a/sql-odbc/src/odfesqlodbc/results.c +++ b/sql-odbc/src/odfesqlodbc/results.c @@ -22,26 +22,26 @@ #include "convert.h" #include "dlg_specific.h" #include "environ.h" -#include "es_apifunc.h" -#include "es_connection.h" -#include "es_odbc.h" -#include "es_types.h" +#include "opensearch_odbc.h" +#include "opensearch_types.h" #include "misc.h" +#include "opensearch_apifunc.h" +#include "opensearch_connection.h" +#include "opensearch_statement.h" #include "qresult.h" #include "statement.h" -#include "es_statement.h" /* Helper macro */ #define getEffectiveOid(conn, fi) \ - es_true_type((conn), (fi)->columntype, FI_type(fi)) + opensearch_true_type((conn), (fi)->columntype, FI_type(fi)) #define NULL_IF_NULL(a) ((a) ? ((const char *)(a)) : "(null)") -RETCODE SQL_API ESAPI_RowCount(HSTMT hstmt, SQLLEN *pcrow) { - CSTR func = "ESAPI_RowCount"; +RETCODE SQL_API OPENSEARCHAPI_RowCount(HSTMT hstmt, SQLLEN *pcrow) { + CSTR func = "OPENSEARCHAPI_RowCount"; StatementClass *stmt = (StatementClass *)hstmt; QResultClass *res; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); if (!stmt) { SC_log_error(func, NULL_STRING, NULL); return SQL_INVALID_HANDLE; @@ -69,13 +69,13 @@ RETCODE SQL_API ESAPI_RowCount(HSTMT hstmt, SQLLEN *pcrow) { * This returns the number of columns associated with the database * attached to "hstmt". */ -RETCODE SQL_API ESAPI_NumResultCols(HSTMT hstmt, SQLSMALLINT *pccol) { - CSTR func = "ESAPI_NumResultCols"; +RETCODE SQL_API OPENSEARCHAPI_NumResultCols(HSTMT hstmt, SQLSMALLINT *pccol) { + CSTR func = "OPENSEARCHAPI_NumResultCols"; StatementClass *stmt = (StatementClass *)hstmt; QResultClass *result; RETCODE ret = SQL_SUCCESS; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); if (!stmt) { SC_log_error(func, NULL_STRING, NULL); return SQL_INVALID_HANDLE; @@ -109,13 +109,13 @@ RETCODE SQL_API ESAPI_NumResultCols(HSTMT hstmt, SQLSMALLINT *pccol) { * Return information about the database column the user wants * information about. */ -RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, +RETCODE SQL_API OPENSEARCHAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, SQLCHAR *szColName, SQLSMALLINT cbColNameMax, SQLSMALLINT *pcbColName, SQLSMALLINT *pfSqlType, SQLULEN *pcbColDef, SQLSMALLINT *pibScale, SQLSMALLINT *pfNullable) { - CSTR func = "ESAPI_DescribeCol"; + CSTR func = "OPENSEARCHAPI_DescribeCol"; /* gets all the information about a specific column */ StatementClass *stmt = (StatementClass *)hstmt; @@ -133,7 +133,7 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, int len = 0; RETCODE result = SQL_SUCCESS; - MYLOG(ES_TRACE, "entering.%d..\n", icol); + MYLOG(OPENSEARCH_TRACE, "entering.%d..\n", icol); if (!stmt) { SC_log_error(func, NULL_STRING, NULL); @@ -161,7 +161,7 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, ? SQL_BINARY : SQL_INTEGER; - MYLOG(ES_ALL, "answering bookmark info\n"); + MYLOG(OPENSEARCH_ALL, "answering bookmark info\n"); if (szColName && cbColNameMax > 0) *szColName = '\0'; if (pcbColName) @@ -229,12 +229,13 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, column_size = fi->column_size; decimal_digits = fi->decimal_digits; } else { - column_size = - estype_column_size(stmt, fieldtype, icol, unknown_sizes); - decimal_digits = estype_decimal_digits(stmt, fieldtype, icol); + column_size = opensearchtype_column_size(stmt, fieldtype, icol, + unknown_sizes); + decimal_digits = + opensearchtype_decimal_digits(stmt, fieldtype, icol); } - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "PARSE: fieldtype=%u, col_name='%s', column_size=" FORMAT_LEN "\n", fieldtype, NULL_IF_NULL(col_name), column_size); @@ -242,13 +243,14 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, col_name = QR_get_fieldname(res, icol); fieldtype = QR_get_field_type(res, icol); - column_size = estype_column_size(stmt, fieldtype, icol, unknown_sizes); - decimal_digits = estype_decimal_digits(stmt, fieldtype, icol); + column_size = + opensearchtype_column_size(stmt, fieldtype, icol, unknown_sizes); + decimal_digits = opensearchtype_decimal_digits(stmt, fieldtype, icol); } - MYLOG(ES_DEBUG, "col %d fieldname = '%s'\n", icol, NULL_IF_NULL(col_name)); - MYLOG(ES_DEBUG, "col %d fieldtype = %d\n", icol, fieldtype); - MYLOG(ES_DEBUG, "col %d column_size = " FORMAT_LEN "\n", icol, column_size); + MYLOG(OPENSEARCH_DEBUG, "col %d fieldname = '%s'\n", icol, NULL_IF_NULL(col_name)); + MYLOG(OPENSEARCH_DEBUG, "col %d fieldtype = %d\n", icol, fieldtype); + MYLOG(OPENSEARCH_DEBUG, "col %d column_size = " FORMAT_LEN "\n", icol, column_size); result = SQL_SUCCESS; @@ -277,10 +279,10 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, * CONCISE(SQL) TYPE */ if (pfSqlType) { - *pfSqlType = - estype_to_concise_type(stmt, fieldtype, icol, unknown_sizes); + *pfSqlType = opensearchtype_to_concise_type(stmt, fieldtype, icol, + unknown_sizes); - MYLOG(ES_DEBUG, "col %d *pfSqlType = %d\n", icol, *pfSqlType); + MYLOG(OPENSEARCH_DEBUG, "col %d *pfSqlType = %d\n", icol, *pfSqlType); } /* @@ -292,7 +294,7 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, *pcbColDef = column_size; - MYLOG(ES_DEBUG, "Col: col %d *pcbColDef = " FORMAT_ULEN "\n", icol, + MYLOG(OPENSEARCH_DEBUG, "Col: col %d *pcbColDef = " FORMAT_ULEN "\n", icol, *pcbColDef); } @@ -304,7 +306,7 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, decimal_digits = 0; *pibScale = (SQLSMALLINT)decimal_digits; - MYLOG(ES_DEBUG, "col %d *pibScale = %d\n", icol, *pibScale); + MYLOG(OPENSEARCH_DEBUG, "col %d *pibScale = %d\n", icol, *pibScale); } /* @@ -314,9 +316,9 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, if (SC_has_outer_join(stmt)) *pfNullable = TRUE; else - *pfNullable = fi ? fi->nullable : estype_nullable(conn, fieldtype); + *pfNullable = fi ? fi->nullable : opensearchtype_nullable(conn, fieldtype); - MYLOG(ES_DEBUG, "col %d *pfNullable = %d\n", icol, *pfNullable); + MYLOG(OPENSEARCH_DEBUG, "col %d *pfNullable = %d\n", icol, *pfNullable); } cleanup: @@ -325,11 +327,11 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, } /* Returns result column descriptor information for a result set. */ -RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, +RETCODE SQL_API OPENSEARCHAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, PTR rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc, SQLLEN *pfDesc) { - CSTR func = "ESAPI_ColAttributes"; + CSTR func = "OPENSEARCHAPI_ColAttributes"; StatementClass *stmt = (StatementClass *)hstmt; IRDFields *irdflds; OID field_type = 0; @@ -346,7 +348,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, QResultClass *res; BOOL stmt_updatable; - MYLOG(ES_TRACE, "entering..col=%d %d len=%d.\n", icol, fDescType, + MYLOG(OPENSEARCH_TRACE, "entering..col=%d %d len=%d.\n", icol, fDescType, cbDescMax); if (!stmt) { @@ -374,7 +376,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, res = SC_get_Curres(stmt); if (0 == icol && SQL_DESC_COUNT != fDescType) /* bookmark column */ { - MYLOG(ES_ALL, "answering bookmark info\n"); + MYLOG(OPENSEARCH_ALL, "answering bookmark info\n"); switch (fDescType) { case SQL_DESC_OCTET_LENGTH: if (pfDesc) @@ -476,7 +478,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, field_type = getEffectiveOid(conn, fi); } - MYLOG(ES_DEBUG, "col %d field_type=%d fi,ti=%p,%p\n", col_idx, field_type, + MYLOG(OPENSEARCH_DEBUG, "col %d field_type=%d fi,ti=%p,%p\n", col_idx, field_type, fi, ti); #ifdef SUPPRESS_LONGEST_ON_CURSORS @@ -494,21 +496,22 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, column_size = (USE_FI(fi, unknown_sizes) && fi->column_size > 0) ? fi->column_size - : estype_column_size(stmt, field_type, col_idx, unknown_sizes); + : opensearchtype_column_size(stmt, field_type, col_idx, + unknown_sizes); switch (fDescType) { case SQL_COLUMN_AUTO_INCREMENT: /* == SQL_DESC_AUTO_UNIQUE_VALUE */ if (fi && fi->auto_increment) value = TRUE; else - value = estype_auto_increment(conn, field_type); + value = opensearchtype_auto_increment(conn, field_type); if (value == -1) /* non-numeric becomes FALSE (ODBC Doc) */ value = FALSE; - MYLOG(ES_DEBUG, "AUTO_INCREMENT=" FORMAT_LEN "\n", value); + MYLOG(OPENSEARCH_DEBUG, "AUTO_INCREMENT=" FORMAT_LEN "\n", value); break; case SQL_COLUMN_CASE_SENSITIVE: /* == SQL_DESC_CASE_SENSITIVE */ - value = estype_case_sensitive(conn, field_type); + value = opensearchtype_case_sensitive(conn, field_type); break; /* @@ -519,10 +522,10 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, case SQL_COLUMN_DISPLAY_SIZE: /* == SQL_DESC_DISPLAY_SIZE */ value = (USE_FI(fi, unknown_sizes) && 0 != fi->display_size) ? fi->display_size - : estype_display_size(stmt, field_type, col_idx, - unknown_sizes); + : opensearchtype_display_size(stmt, field_type, col_idx, + unknown_sizes); - MYLOG(ES_DEBUG, "col %d, display_size= " FORMAT_LEN "\n", col_idx, + MYLOG(OPENSEARCH_DEBUG, "col %d, display_size= " FORMAT_LEN "\n", col_idx, value); break; @@ -531,55 +534,55 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, if (fi && (NAME_IS_VALID(fi->column_alias))) { p = GET_NAME(fi->column_alias); - MYLOG(ES_DEBUG, "COLUMN_LABEL = '%s'\n", p); + MYLOG(OPENSEARCH_DEBUG, "COLUMN_LABEL = '%s'\n", p); break; } /* otherwise same as column name -- FALL THROUGH!!! */ case SQL_DESC_NAME: - MYLOG(ES_ALL, "fi=%p (alias, name)=", fi); + MYLOG(OPENSEARCH_ALL, "fi=%p (alias, name)=", fi); if (fi) - MYPRINTF(ES_DEBUG, "(%s,%s)\n", PRINT_NAME(fi->column_alias), + MYPRINTF(OPENSEARCH_DEBUG, "(%s,%s)\n", PRINT_NAME(fi->column_alias), PRINT_NAME(fi->column_name)); else - MYPRINTF(ES_DEBUG, "NULL\n"); + MYPRINTF(OPENSEARCH_DEBUG, "NULL\n"); p = fi ? (NAME_IS_NULL(fi->column_alias) ? SAFE_NAME(fi->column_name) : GET_NAME(fi->column_alias)) : QR_get_fieldname(res, col_idx); - MYLOG(ES_DEBUG, "COLUMN_NAME = '%s'\n", p); + MYLOG(OPENSEARCH_DEBUG, "COLUMN_NAME = '%s'\n", p); break; case SQL_COLUMN_LENGTH: value = (USE_FI(fi, unknown_sizes) && fi->length > 0) ? fi->length - : estype_buffer_length(stmt, field_type, col_idx, - unknown_sizes); + : opensearchtype_buffer_length(stmt, field_type, + col_idx, unknown_sizes); if (0 > value) /* if (-1 == value) I'm not sure which is right */ value = 0; - MYLOG(ES_DEBUG, "col %d, column_length = " FORMAT_LEN "\n", col_idx, + MYLOG(OPENSEARCH_DEBUG, "col %d, column_length = " FORMAT_LEN "\n", col_idx, value); break; case SQL_COLUMN_MONEY: /* == SQL_DESC_FIXED_PREC_SCALE */ - value = estype_money(conn, field_type); - MYLOG(ES_ALL, "COLUMN_MONEY=" FORMAT_LEN "\n", value); + value = opensearchtype_money(conn, field_type); + MYLOG(OPENSEARCH_ALL, "COLUMN_MONEY=" FORMAT_LEN "\n", value); break; case SQL_DESC_NULLABLE: if (SC_has_outer_join(stmt)) value = TRUE; else - value = fi ? fi->nullable : estype_nullable(conn, field_type); - MYLOG(ES_ALL, "COLUMN_NULLABLE=" FORMAT_LEN "\n", value); + value = fi ? fi->nullable : opensearchtype_nullable(conn, field_type); + MYLOG(OPENSEARCH_ALL, "COLUMN_NULLABLE=" FORMAT_LEN "\n", value); break; case SQL_COLUMN_OWNER_NAME: /* == SQL_DESC_SCHEMA_NAME */ p = ti ? SAFE_NAME(ti->schema_name) : NULL_STRING; - MYLOG(ES_DEBUG, "SCHEMA_NAME = '%s'\n", p); + MYLOG(OPENSEARCH_DEBUG, "SCHEMA_NAME = '%s'\n", p); break; case SQL_COLUMN_PRECISION: /* in 2.x */ @@ -587,7 +590,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, if (value < 0) value = 0; - MYLOG(ES_DEBUG, "col %d, column_size = " FORMAT_LEN "\n", col_idx, + MYLOG(OPENSEARCH_DEBUG, "col %d, column_size = " FORMAT_LEN "\n", col_idx, value); break; @@ -597,35 +600,35 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, break; case SQL_COLUMN_SCALE: /* in 2.x */ - value = estype_decimal_digits(stmt, field_type, col_idx); - MYLOG(ES_ALL, "COLUMN_SCALE=" FORMAT_LEN "\n", value); + value = opensearchtype_decimal_digits(stmt, field_type, col_idx); + MYLOG(OPENSEARCH_ALL, "COLUMN_SCALE=" FORMAT_LEN "\n", value); if (value < 0) value = 0; break; case SQL_COLUMN_SEARCHABLE: /* == SQL_DESC_SEARCHABLE */ - value = estype_searchable(conn, field_type); + value = opensearchtype_searchable(conn, field_type); break; case SQL_COLUMN_TABLE_NAME: /* == SQL_DESC_TABLE_NAME */ p = ti ? SAFE_NAME(ti->table_name) : NULL_STRING; - MYLOG(ES_DEBUG, "TABLE_NAME = '%s'\n", p); + MYLOG(OPENSEARCH_DEBUG, "TABLE_NAME = '%s'\n", p); break; case SQL_COLUMN_TYPE: /* == SQL_DESC_CONCISE_TYPE */ - value = estype_to_concise_type(stmt, field_type, col_idx, - unknown_sizes); - MYLOG(ES_DEBUG, "COLUMN_TYPE=" FORMAT_LEN "\n", value); + value = opensearchtype_to_concise_type(stmt, field_type, col_idx, + unknown_sizes); + MYLOG(OPENSEARCH_DEBUG, "COLUMN_TYPE=" FORMAT_LEN "\n", value); break; case SQL_COLUMN_TYPE_NAME: /* == SQL_DESC_TYPE_NAME */ - p = estype_to_name(stmt, field_type, col_idx, - fi && fi->auto_increment); + p = opensearchtype_to_name(stmt, field_type, col_idx, + fi && fi->auto_increment); break; case SQL_COLUMN_UNSIGNED: /* == SQL_DESC_UNSINGED */ - value = estype_unsigned(conn, field_type); + value = opensearchtype_unsigned(conn, field_type); if (value == -1) /* non-numeric becomes TRUE (ODBC Doc) */ value = SQL_TRUE; @@ -636,7 +639,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, /* * Neither Access or Borland care about this. * - * if (field_type == ES_TYPE_OID) pfDesc = SQL_ATTR_READONLY; + * if (field_type == OPENSEARCH_TYPE_OID) pfDesc = SQL_ATTR_READONLY; * else */ if (!stmt_updatable) @@ -656,72 +659,72 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, value = SQL_ATTR_READONLY; } - MYLOG(ES_DEBUG, "%s: UPDATEABLE = " FORMAT_LEN "\n", func, value); + MYLOG(OPENSEARCH_DEBUG, "%s: UPDATEABLE = " FORMAT_LEN "\n", func, value); break; case SQL_DESC_BASE_COLUMN_NAME: p = fi ? SAFE_NAME(fi->column_name) : QR_get_fieldname(res, col_idx); - MYLOG(ES_DEBUG, "BASE_COLUMN_NAME = '%s'\n", p); + MYLOG(OPENSEARCH_DEBUG, "BASE_COLUMN_NAME = '%s'\n", p); break; case SQL_DESC_BASE_TABLE_NAME: /* the same as TABLE_NAME ok ? */ p = ti ? SAFE_NAME(ti->table_name) : NULL_STRING; - MYLOG(ES_DEBUG, "BASE_TABLE_NAME = '%s'\n", p); + MYLOG(OPENSEARCH_DEBUG, "BASE_TABLE_NAME = '%s'\n", p); break; case SQL_DESC_LENGTH: /* different from SQL_COLUMN_LENGTH */ value = (fi && column_size > 0) ? column_size - : estype_desclength(stmt, field_type, col_idx, - unknown_sizes); + : opensearchtype_desclength(stmt, field_type, col_idx, + unknown_sizes); if (-1 == value) value = 0; - MYLOG(ES_DEBUG, "col %d, desc_length = " FORMAT_LEN "\n", col_idx, + MYLOG(OPENSEARCH_DEBUG, "col %d, desc_length = " FORMAT_LEN "\n", col_idx, value); break; case SQL_DESC_OCTET_LENGTH: value = (USE_FI(fi, unknown_sizes) && fi->length > 0) ? fi->length - : estype_attr_transfer_octet_length( + : opensearchtype_attr_transfer_octet_length( conn, field_type, column_size, unknown_sizes); if (-1 == value) value = 0; - MYLOG(ES_DEBUG, "col %d, octet_length = " FORMAT_LEN "\n", col_idx, + MYLOG(OPENSEARCH_DEBUG, "col %d, octet_length = " FORMAT_LEN "\n", col_idx, value); break; case SQL_DESC_PRECISION: /* different from SQL_COLUMN_PRECISION */ if (value = FI_precision(fi), value <= 0) - value = - estype_precision(stmt, field_type, col_idx, unknown_sizes); + value = opensearchtype_precision(stmt, field_type, col_idx, + unknown_sizes); if (value < 0) value = 0; - MYLOG(ES_DEBUG, "col %d, desc_precision = " FORMAT_LEN "\n", + MYLOG(OPENSEARCH_DEBUG, "col %d, desc_precision = " FORMAT_LEN "\n", col_idx, value); break; case SQL_DESC_SCALE: /* different from SQL_COLUMN_SCALE */ - value = estype_scale(stmt, field_type, col_idx); + value = opensearchtype_scale(stmt, field_type, col_idx); if (value < 0) value = 0; break; case SQL_DESC_LOCAL_TYPE_NAME: - p = estype_to_name(stmt, field_type, col_idx, - fi && fi->auto_increment); + p = opensearchtype_to_name(stmt, field_type, col_idx, + fi && fi->auto_increment); break; case SQL_DESC_TYPE: - value = - estype_to_sqldesctype(stmt, field_type, col_idx, unknown_sizes); + value = opensearchtype_to_sqldesctype(stmt, field_type, col_idx, + unknown_sizes); break; case SQL_DESC_NUM_PREC_RADIX: - value = estype_radix(conn, field_type); + value = opensearchtype_radix(conn, field_type); break; case SQL_DESC_LITERAL_PREFIX: - p = estype_literal_prefix(conn, field_type); + p = opensearchtype_literal_prefix(conn, field_type); break; case SQL_DESC_LITERAL_SUFFIX: - p = estype_literal_suffix(conn, field_type); + p = opensearchtype_literal_suffix(conn, field_type); break; case SQL_DESC_UNNAMED: value = (fi && NAME_IS_NULL(fi->column_name) @@ -770,10 +773,10 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, } /* Returns result data for a single column in the current row. */ -RETCODE SQL_API ESAPI_GetData(HSTMT hstmt, SQLUSMALLINT icol, +RETCODE SQL_API OPENSEARCHAPI_GetData(HSTMT hstmt, SQLUSMALLINT icol, SQLSMALLINT fCType, PTR rgbValue, SQLLEN cbValueMax, SQLLEN *pcbValue) { - CSTR func = "ESAPI_GetData"; + CSTR func = "OPENSEARCHAPI_GetData"; QResultClass *res; StatementClass *stmt = (StatementClass *)hstmt; UInt2 num_cols; @@ -789,7 +792,7 @@ RETCODE SQL_API ESAPI_GetData(HSTMT hstmt, SQLUSMALLINT icol, SQLCHAR dum_rgb[2] = "\0\0"; #endif /* WITH_UNIXODBC */ - MYLOG(ES_TRACE, "entering stmt=%p icol=%d\n", stmt, icol); + MYLOG(OPENSEARCH_TRACE, "entering stmt=%p icol=%d\n", stmt, icol); if (!stmt) { SC_log_error(func, NULL_STRING, NULL); @@ -830,7 +833,7 @@ RETCODE SQL_API ESAPI_GetData(HSTMT hstmt, SQLUSMALLINT icol, binfo = &opts->bindings[icol - 1]; if (binfo) { target_type = binfo->returntype; - MYLOG(ES_DEBUG, "SQL_ARD_TYPE=%d\n", target_type); + MYLOG(OPENSEARCH_DEBUG, "SQL_ARD_TYPE=%d\n", target_type); precision = binfo->precision; } else { SC_set_error(stmt, STMT_STATUS_ERROR, @@ -855,7 +858,7 @@ RETCODE SQL_API ESAPI_GetData(HSTMT hstmt, SQLUSMALLINT icol, break; default: MYLOG( - ES_ALL, + OPENSEARCH_ALL, "GetData Column 0 is type %d not of type SQL_C_BOOKMARK\n", target_type); SC_set_error(stmt, STMT_PROGRAM_TYPE_OUT_OF_RANGE, @@ -894,17 +897,17 @@ RETCODE SQL_API ESAPI_GetData(HSTMT hstmt, SQLUSMALLINT icol, result = SQL_ERROR; goto cleanup; } - MYLOG(ES_DEBUG, " num_rows = " FORMAT_LEN "\n", num_rows); + MYLOG(OPENSEARCH_DEBUG, " num_rows = " FORMAT_LEN "\n", num_rows); if (!get_bookmark) { SQLLEN curt = GIdx2CacheIdx(stmt->currTuple, stmt, res); value = QR_get_value_backend_row(res, curt, icol); - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "currT=" FORMAT_LEN " base=" FORMAT_LEN " rowset=" FORMAT_LEN "\n", stmt->currTuple, QR_get_rowstart_in_cache(res), SC_get_rowset_start(stmt)); - MYLOG(ES_DEBUG, " value = '%s'\n", NULL_IF_NULL(value)); + MYLOG(OPENSEARCH_DEBUG, " value = '%s'\n", NULL_IF_NULL(value)); } } else { /* it's a SOCKET result (backend data) */ @@ -921,7 +924,7 @@ RETCODE SQL_API ESAPI_GetData(HSTMT hstmt, SQLUSMALLINT icol, SQLLEN curt = GIdx2CacheIdx(stmt->currTuple, stmt, res); value = QR_get_value_backend_row(res, curt, icol); } - MYLOG(ES_DEBUG, " socket: value = '%s'\n", NULL_IF_NULL(value)); + MYLOG(OPENSEARCH_DEBUG, " socket: value = '%s'\n", NULL_IF_NULL(value)); } if (get_bookmark) { @@ -951,7 +954,7 @@ RETCODE SQL_API ESAPI_GetData(HSTMT hstmt, SQLUSMALLINT icol, field_type = QR_get_field_type(res, icol); atttypmod = QR_get_atttypmod(res, icol); - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "**** icol = %d, target_type = %d, field_type = %d, value = '%s'\n", icol, target_type, field_type, NULL_IF_NULL(value)); @@ -968,7 +971,7 @@ RETCODE SQL_API ESAPI_GetData(HSTMT hstmt, SQLUSMALLINT icol, case COPY_UNSUPPORTED_TYPE: SC_set_error(stmt, STMT_RESTRICTED_DATA_TYPE_ERROR, - "Received an unsupported type from Elasticsearch.", + "Received an unsupported type from OpenSearch.", func); result = SQL_ERROR; break; @@ -1011,7 +1014,7 @@ RETCODE SQL_API ESAPI_GetData(HSTMT hstmt, SQLUSMALLINT icol, cleanup: #undef return - MYLOG(ES_TRACE, "leaving %d\n", result); + MYLOG(OPENSEARCH_TRACE, "leaving %d\n", result); return result; } @@ -1019,15 +1022,15 @@ RETCODE SQL_API ESAPI_GetData(HSTMT hstmt, SQLUSMALLINT icol, * Returns data for bound columns in the current row ("hstmt->iCursor"), * advances the cursor. */ -RETCODE SQL_API ESAPI_Fetch(HSTMT hstmt) { - CSTR func = "ESAPI_Fetch"; +RETCODE SQL_API OPENSEARCHAPI_Fetch(HSTMT hstmt) { + CSTR func = "OPENSEARCHAPI_Fetch"; StatementClass *stmt = (StatementClass *)hstmt; ARDFields *opts; QResultClass *res; BindInfoClass *bookmark; RETCODE retval = SQL_SUCCESS; - MYLOG(ES_TRACE, "entering stmt = %p, stmt->result= %p\n", stmt, + MYLOG(OPENSEARCH_TRACE, "entering stmt = %p, stmt->result= %p\n", stmt, stmt ? SC_get_Curres(stmt) : NULL); if (!stmt) { @@ -1039,7 +1042,7 @@ RETCODE SQL_API ESAPI_Fetch(HSTMT hstmt) { if (!(res = SC_get_Curres(stmt), res)) { SC_set_error(stmt, STMT_INVALID_CURSOR_STATE_ERROR, - "Null statement result in ESAPI_Fetch.", func); + "Null statement result in OPENSEARCHAPI_Fetch.", func); return SQL_ERROR; } @@ -1048,7 +1051,7 @@ RETCODE SQL_API ESAPI_Fetch(HSTMT hstmt) { if ((bookmark = opts->bookmark, bookmark) && bookmark->buffer) { SC_set_error( stmt, STMT_COLNUM_ERROR, - "Not allowed to bind a bookmark column when using ESAPI_Fetch", + "Not allowed to bind a bookmark column when using OPENSEARCHAPI_Fetch", func); return SQL_ERROR; } @@ -1107,12 +1110,12 @@ getNthValid(const QResultClass *res, SQLLEN sta, UWORD orientation, SQLULEN nth, if (!QR_once_reached_eof(res)) num_tuples = INT_MAX; /* Note that the parameter nth is 1-based */ - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "get " FORMAT_ULEN "th Valid data from " FORMAT_LEN " to %s [dlt=%d]", nth, sta, orientation == SQL_FETCH_PRIOR ? "backward" : "forward", res->dl_count); if (0 == res->dl_count) { - MYPRINTF(ES_DEBUG, "\n"); + MYPRINTF(OPENSEARCH_DEBUG, "\n"); if (SQL_FETCH_PRIOR == orientation) { if (sta + 1 >= (SQLLEN)nth) { *nearest = sta + 1 - nth; @@ -1138,9 +1141,9 @@ getNthValid(const QResultClass *res, SQLLEN sta, UWORD orientation, SQLULEN nth, if (SQL_FETCH_PRIOR == orientation) { *nearest = sta + 1 - nth; delsta = (-1); - MYPRINTF(ES_DEBUG, "deleted "); + MYPRINTF(OPENSEARCH_DEBUG, "deleted "); for (i = res->dl_count - 1; i >= 0 && *nearest <= deleted[i]; i--) { - MYPRINTF(ES_DEBUG, "[" FORMAT_LEN "]=" FORMAT_LEN " ", i, + MYPRINTF(OPENSEARCH_DEBUG, "[" FORMAT_LEN "]=" FORMAT_LEN " ", i, deleted[i]); if (sta >= deleted[i]) { (*nearest)--; @@ -1148,14 +1151,14 @@ getNthValid(const QResultClass *res, SQLLEN sta, UWORD orientation, SQLULEN nth, delsta = i; } } - MYPRINTF(ES_DEBUG, "nearest=" FORMAT_LEN "\n", *nearest); + MYPRINTF(OPENSEARCH_DEBUG, "nearest=" FORMAT_LEN "\n", *nearest); if (*nearest < 0) { *nearest = -1; count = sta - delsta; } else return nth; } else { - MYPRINTF(ES_DEBUG, "\n"); + MYPRINTF(OPENSEARCH_DEBUG, "\n"); *nearest = sta - 1 + nth; delsta = res->dl_count; if (!QR_once_reached_eof(res)) @@ -1180,7 +1183,7 @@ getNthValid(const QResultClass *res, SQLLEN sta, UWORD orientation, SQLULEN nth, & (CURS_SELF_DELETING | CURS_SELF_DELETED | CURS_OTHER_DELETED))) { *nearest = i; - MYPRINTF(ES_DEBUG, " nearest=" FORMAT_LEN "\n", *nearest); + MYPRINTF(OPENSEARCH_DEBUG, " nearest=" FORMAT_LEN "\n", *nearest); if (++count == nth) return count; } @@ -1194,14 +1197,14 @@ getNthValid(const QResultClass *res, SQLLEN sta, UWORD orientation, SQLULEN nth, & (CURS_SELF_DELETING | CURS_SELF_DELETED | CURS_OTHER_DELETED))) { *nearest = i; - MYPRINTF(ES_DEBUG, " nearest=" FORMAT_LEN "\n", *nearest); + MYPRINTF(OPENSEARCH_DEBUG, " nearest=" FORMAT_LEN "\n", *nearest); if (++count == nth) return count; } } *nearest = num_tuples; } - MYPRINTF(ES_DEBUG, " nearest not found\n"); + MYPRINTF(OPENSEARCH_DEBUG, " nearest not found\n"); return -(SQLLEN)count; } @@ -1211,7 +1214,7 @@ getNthValid(const QResultClass *res, SQLLEN sta, UWORD orientation, SQLULEN nth, */ #define EXTFETCH_RETURN_BOF(stmt, res) \ { \ - MYLOG(ES_ALL, "RETURN_BOF\n"); \ + MYLOG(OPENSEARCH_ALL, "RETURN_BOF\n"); \ SC_set_rowset_start(stmt, -1, TRUE); \ stmt->currTuple = -1; \ /* move_cursor_position_if_needed(stmt, res); */ \ @@ -1219,7 +1222,7 @@ getNthValid(const QResultClass *res, SQLLEN sta, UWORD orientation, SQLULEN nth, } #define EXTFETCH_RETURN_EOF(stmt, res) \ { \ - MYLOG(ES_ALL, "RETURN_EOF\n"); \ + MYLOG(OPENSEARCH_ALL, "RETURN_EOF\n"); \ SC_set_rowset_start(stmt, num_tuples, TRUE); \ stmt->currTuple = -1; \ /* move_cursor_position_if_needed(stmt, res); */ \ @@ -1227,12 +1230,12 @@ getNthValid(const QResultClass *res, SQLLEN sta, UWORD orientation, SQLULEN nth, } /* This fetchs a block of data (rowset). */ -RETCODE SQL_API ESAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, +RETCODE SQL_API OPENSEARCHAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, SQLLEN irow, SQLULEN *pcrow, SQLUSMALLINT *rgfRowStatus, SQLLEN bookmark_offset, SQLLEN rowsetSize) { UNUSED(bookmark_offset, irow); - CSTR func = "ESAPI_ExtendedFetch"; + CSTR func = "OPENSEARCHAPI_ExtendedFetch"; StatementClass *stmt = (StatementClass *)hstmt; ARDFields *opts; QResultClass *res; @@ -1247,7 +1250,7 @@ RETCODE SQL_API ESAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, BOOL currp_is_valid, reached_eof, useCursor; SQLLEN reqsize = rowsetSize; - MYLOG(ES_TRACE, "entering stmt=%p rowsetSize=" FORMAT_LEN "\n", stmt, + MYLOG(OPENSEARCH_TRACE, "entering stmt=%p rowsetSize=" FORMAT_LEN "\n", stmt, rowsetSize); if (!stmt) { @@ -1269,7 +1272,7 @@ RETCODE SQL_API ESAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, if (!(res = SC_get_Curres(stmt), res)) { SC_set_error(stmt, STMT_INVALID_CURSOR_STATE_ERROR, - "Null statement result in ESAPI_ExtendedFetch.", func); + "Null statement result in OPENSEARCHAPI_ExtendedFetch.", func); return SQL_ERROR; } @@ -1323,7 +1326,7 @@ RETCODE SQL_API ESAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, if (useCursor && !reached_eof) num_tuples = INT_MAX; - MYLOG(ES_ALL, "num_tuples=" FORMAT_LEN "\n", num_tuples); + MYLOG(OPENSEARCH_ALL, "num_tuples=" FORMAT_LEN "\n", num_tuples); /* Save and discard the saved rowset size */ save_rowset_size = stmt->save_rowset_size; stmt->save_rowset_size = -1; @@ -1354,14 +1357,14 @@ RETCODE SQL_API ESAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, } } else SC_inc_rowset_start(stmt, progress_size); - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "SQL_FETCH_NEXT: num_tuples=" FORMAT_LEN ", currtuple=" FORMAT_LEN ", rowst=" FORMAT_LEN "\n", num_tuples, stmt->currTuple, rowset_start); break; default: SC_set_error(stmt, STMT_FETCH_OUT_OF_RANGE, - "Unsupported ESAPI_ExtendedFetch Direction", func); + "Unsupported OPENSEARCHAPI_ExtendedFetch Direction", func); return SQL_ERROR; } @@ -1432,7 +1435,7 @@ RETCODE SQL_API ESAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, /* Physical Row advancement occurs for each row fetched below */ - MYLOG(ES_DEBUG, "new currTuple = " FORMAT_LEN "\n", stmt->currTuple); + MYLOG(OPENSEARCH_DEBUG, "new currTuple = " FORMAT_LEN "\n", stmt->currTuple); truncated = error = FALSE; @@ -1443,10 +1446,10 @@ RETCODE SQL_API ESAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, goto cleanup; if (SQL_NO_DATA_FOUND != result && res->keyset) { currp = GIdx2KResIdx(SC_get_rowset_start(stmt), stmt, res); - MYLOG(ES_ALL, "currp=" FORMAT_LEN "\n", currp); + MYLOG(OPENSEARCH_ALL, "currp=" FORMAT_LEN "\n", currp); if (currp < 0) { result = SQL_ERROR; - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "rowset_start=" FORMAT_LEN " but currp=" FORMAT_LEN "\n", SC_get_rowset_start(stmt), currp); SC_set_error(stmt, STMT_INTERNAL_ERROR, @@ -1464,14 +1467,14 @@ RETCODE SQL_API ESAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, res->keyset[currp].status &= ~CURS_IN_ROWSET; /* Off the flag first */ } else { - MYLOG(ES_DEBUG, "Umm current row is out of keyset\n"); + MYLOG(OPENSEARCH_DEBUG, "Umm current row is out of keyset\n"); break; } } - MYLOG(ES_ALL, "ExtFetch result=%d\n", result); + MYLOG(OPENSEARCH_ALL, "ExtFetch result=%d\n", result); if (currp_is_valid && SQL_SUCCESS_WITH_INFO == result && 0 == stmt->last_fetch_count) { - MYLOG(ES_ALL, "just skipping deleted row " FORMAT_LEN "\n", currp); + MYLOG(OPENSEARCH_ALL, "just skipping deleted row " FORMAT_LEN "\n", currp); if (rowsetSize - i + fc_io > reqsize) QR_set_reqsize(res, (Int4)(rowsetSize - i + fc_io)); result = SC_fetch(stmt); @@ -1537,7 +1540,7 @@ RETCODE SQL_API ESAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, /* Set the number of rows retrieved */ if (pcrow) *pcrow = i; - MYLOG(ES_ALL, "pcrow=" FORMAT_LEN "\n", i); + MYLOG(OPENSEARCH_ALL, "pcrow=" FORMAT_LEN "\n", i); if (i == 0) /* Only DeclareFetch should wind up here */ @@ -1561,12 +1564,12 @@ RETCODE SQL_API ESAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, * the "hstmt". */ /* CC: return SQL_NO_DATA_FOUND since we do not support multiple result sets */ -RETCODE SQL_API ESAPI_MoreResults(HSTMT hstmt) { +RETCODE SQL_API OPENSEARCHAPI_MoreResults(HSTMT hstmt) { StatementClass *stmt = (StatementClass *)hstmt; QResultClass *res; RETCODE ret = SQL_SUCCESS; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); res = SC_get_Curres(stmt); if (res) { res = res->next; @@ -1576,7 +1579,7 @@ RETCODE SQL_API ESAPI_MoreResults(HSTMT hstmt) { SQLSMALLINT num_p; if (stmt->multi_statement < 0) - ESAPI_NumParams(stmt, &num_p); + OPENSEARCHAPI_NumParams(stmt, &num_p); if (stmt->multi_statement > 0) { const char *cmdstr; @@ -1591,10 +1594,10 @@ RETCODE SQL_API ESAPI_MoreResults(HSTMT hstmt) { SC_set_rowset_start(stmt, -1, FALSE); stmt->currTuple = -1; } else { - ESAPI_FreeStmt(hstmt, SQL_CLOSE); + OPENSEARCHAPI_FreeStmt(hstmt, SQL_CLOSE); ret = SQL_NO_DATA_FOUND; } - MYLOG(ES_DEBUG, "leaving %d\n", ret); + MYLOG(OPENSEARCH_DEBUG, "leaving %d\n", ret); return ret; } @@ -1603,7 +1606,7 @@ SQLLEN ClearCachedRows(TupleField *tuple, int num_fields, SQLLEN num_rows) { for (i = 0; i < num_fields * num_rows; i++, tuple++) { if (tuple->value) { - MYLOG(ES_ALL, + MYLOG(OPENSEARCH_ALL, "freeing tuple[" FORMAT_LEN "][" FORMAT_LEN "].value=%p\n", i / num_fields, i % num_fields, tuple->value); free(tuple->value); @@ -1615,12 +1618,12 @@ SQLLEN ClearCachedRows(TupleField *tuple, int num_fields, SQLLEN num_rows) { } /* Set the cursor name on a statement handle */ -RETCODE SQL_API ESAPI_SetCursorName(HSTMT hstmt, const SQLCHAR *szCursor, +RETCODE SQL_API OPENSEARCHAPI_SetCursorName(HSTMT hstmt, const SQLCHAR *szCursor, SQLSMALLINT cbCursor) { - CSTR func = "ESAPI_SetCursorName"; + CSTR func = "OPENSEARCHAPI_SetCursorName"; StatementClass *stmt = (StatementClass *)hstmt; - MYLOG(ES_TRACE, "entering hstmt=%p, szCursor=%p, cbCursorMax=%d\n", hstmt, + MYLOG(OPENSEARCH_TRACE, "entering hstmt=%p, szCursor=%p, cbCursorMax=%d\n", hstmt, szCursor, cbCursor); if (!stmt) { @@ -1634,15 +1637,15 @@ RETCODE SQL_API ESAPI_SetCursorName(HSTMT hstmt, const SQLCHAR *szCursor, } /* Return the cursor name for a statement handle */ -RETCODE SQL_API ESAPI_GetCursorName(HSTMT hstmt, SQLCHAR *szCursor, +RETCODE SQL_API OPENSEARCHAPI_GetCursorName(HSTMT hstmt, SQLCHAR *szCursor, SQLSMALLINT cbCursorMax, SQLSMALLINT *pcbCursor) { - CSTR func = "ESAPI_GetCursorName"; + CSTR func = "OPENSEARCHAPI_GetCursorName"; StatementClass *stmt = (StatementClass *)hstmt; size_t len = 0; RETCODE result; - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "entering hstmt=%p, szCursor=%p, cbCursorMax=%d, pcbCursor=%p\n", hstmt, szCursor, cbCursorMax, pcbCursor); diff --git a/sql-odbc/src/odfesqlodbc/setup.c b/sql-odbc/src/odfesqlodbc/setup.c index 0f9cc0bc51..7e678b21e1 100644 --- a/sql-odbc/src/odfesqlodbc/setup.c +++ b/sql-odbc/src/odfesqlodbc/setup.c @@ -15,8 +15,8 @@ */ #ifdef WIN32 -#include "elasticenlist.h" -#include "es_odbc.h" +#include "opensearch_enlist.h" +#include "opensearch_odbc.h" #include "loadlib.h" #include "misc.h" // strncpy_null @@ -28,7 +28,7 @@ #include #include "dlg_specific.h" -#include "es_apifunc.h" +#include "opensearch_apifunc.h" #include "resource.h" #include "win_setup.h" @@ -129,7 +129,7 @@ BOOL CALLBACK ConfigDSN(HWND hwnd, WORD fRequest, LPCSTR lpszDriver, == DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_CONFIG), hwnd, ConfigDlgProc, (LPARAM)lpsetupdlg)); } else if (lpsetupdlg->ci.dsn[0]) { - MYLOG(ES_DEBUG, "SetDSNAttributes\n"); + MYLOG(OPENSEARCH_DEBUG, "SetDSNAttributes\n"); fSuccess = SetDSNAttributes(hwnd, lpsetupdlg, NULL); } else fSuccess = FALSE; @@ -437,7 +437,7 @@ void test_connection(HANDLE hwnd, ConnInfo *ci, BOOL withDTC) { dsn_1st = ci->dsn[0]; ci->dsn[0] = '\0'; makeConnectString(out_conn, ci, sizeof(out_conn)); - MYLOG(ES_DEBUG, "conn_string=%s\n", out_conn); + MYLOG(OPENSEARCH_DEBUG, "conn_string=%s\n", out_conn); #ifdef UNICODE_SUPPORT MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, out_conn, -1, wout_conn, sizeof(wout_conn) / sizeof(wout_conn[0])); @@ -581,7 +581,7 @@ static void ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg) { /* lpsetupdlg->aAttr[iElement].fSupplied = TRUE; */ memcpy(value, lpszStart, MIN(lpsz - lpszStart + 1, MAXESPATH)); - MYLOG(ES_DEBUG, "aszKey='%s', value='%s'\n", aszKey, value); + MYLOG(OPENSEARCH_DEBUG, "aszKey='%s', value='%s'\n", aszKey, value); /* Copy the appropriate value to the conninfo */ copyConnAttributes(&lpsetupdlg->ci, aszKey, value); @@ -696,7 +696,7 @@ BOOL INTFUNC ChangeDriverName(HWND hwndParent, LPSETUPDLG lpsetupdlg, if (!ci->dsn[0]) { err = IDS_BADDSN; - } else if (!driver_name || strnicmp(driver_name, "elasticsearch", 13)) { + } else if (!driver_name || strnicmp(driver_name, "opensearch", 10)) { err = IDS_BADDSN; } else { LPCSTR lpszDrvr = lpsetupdlg->lpszDrvr; diff --git a/sql-odbc/src/odfesqlodbc/statement.c b/sql-odbc/src/odfesqlodbc/statement.c index 9e6e8e6334..b84befab84 100644 --- a/sql-odbc/src/odfesqlodbc/statement.c +++ b/sql-odbc/src/odfesqlodbc/statement.c @@ -19,7 +19,7 @@ #include "misc.h" // strncpy_null #include "bind.h" -#include "es_connection.h" +#include "opensearch_connection.h" #include "multibyte.h" #include "qresult.h" #include "convert.h" @@ -30,9 +30,9 @@ #include #include -#include "es_apifunc.h" -#include "es_helper.h" -#include "es_statement.h" +#include "opensearch_apifunc.h" +#include "opensearch_helper.h" +#include "opensearch_statement.h" // clang-format on /* Map sql commands to statement types */ @@ -94,13 +94,13 @@ static const struct { static void SC_set_error_if_not_set(StatementClass *self, int errornumber, const char *errmsg, const char *func); -RETCODE SQL_API ESAPI_AllocStmt(HDBC hdbc, HSTMT *phstmt, UDWORD flag) { - CSTR func = "ESAPI_AllocStmt"; +RETCODE SQL_API OPENSEARCHAPI_AllocStmt(HDBC hdbc, HSTMT *phstmt, UDWORD flag) { + CSTR func = "OPENSEARCHAPI_AllocStmt"; ConnectionClass *conn = (ConnectionClass *)hdbc; StatementClass *stmt; ARDFields *ardopts; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); if (!conn) { CC_log_error(func, "", NULL); @@ -109,7 +109,7 @@ RETCODE SQL_API ESAPI_AllocStmt(HDBC hdbc, HSTMT *phstmt, UDWORD flag) { stmt = SC_Constructor(conn); - MYLOG(ES_DEBUG, "**** : hdbc = %p, stmt = %p\n", hdbc, stmt); + MYLOG(OPENSEARCH_DEBUG, "**** : hdbc = %p, stmt = %p\n", hdbc, stmt); if (!stmt) { CC_set_error(conn, CONN_STMT_ALLOC_ERROR, @@ -148,11 +148,11 @@ RETCODE SQL_API ESAPI_AllocStmt(HDBC hdbc, HSTMT *phstmt, UDWORD flag) { return SQL_SUCCESS; } -RETCODE SQL_API ESAPI_FreeStmt(HSTMT hstmt, SQLUSMALLINT fOption) { - CSTR func = "ESAPI_FreeStmt"; +RETCODE SQL_API OPENSEARCHAPI_FreeStmt(HSTMT hstmt, SQLUSMALLINT fOption) { + CSTR func = "OPENSEARCHAPI_FreeStmt"; StatementClass *stmt = (StatementClass *)hstmt; - MYLOG(ES_TRACE, "entering...hstmt=%p, fOption=%hi\n", hstmt, fOption); + MYLOG(OPENSEARCH_TRACE, "entering...hstmt=%p, fOption=%hi\n", hstmt, fOption); if (!stmt) { SC_log_error(func, "", NULL); @@ -163,7 +163,7 @@ RETCODE SQL_API ESAPI_FreeStmt(HSTMT hstmt, SQLUSMALLINT fOption) { if (fOption == SQL_DROP) { ConnectionClass *conn = stmt->hdbc; - ESStopRetrieval(conn->esconn); + OpenSearchStopRetrieval(conn->opensearchconn); /* Remove the statement from the connection's statement list */ if (conn) { @@ -191,7 +191,7 @@ RETCODE SQL_API ESAPI_FreeStmt(HSTMT hstmt, SQLUSMALLINT fOption) { } if (stmt->execute_delegate) { - ESAPI_FreeStmt(stmt->execute_delegate, SQL_DROP); + OPENSEARCHAPI_FreeStmt(stmt->execute_delegate, SQL_DROP); stmt->execute_delegate = NULL; } if (stmt->execute_parent) @@ -201,7 +201,7 @@ RETCODE SQL_API ESAPI_FreeStmt(HSTMT hstmt, SQLUSMALLINT fOption) { } else if (fOption == SQL_UNBIND) SC_unbind_cols(stmt); else if (fOption == SQL_CLOSE) { - ESStopRetrieval(stmt->hdbc->esconn); + OpenSearchStopRetrieval(stmt->hdbc->opensearchconn); /* * this should discard all the results, but leave the statement @@ -209,7 +209,7 @@ RETCODE SQL_API ESAPI_FreeStmt(HSTMT hstmt, SQLUSMALLINT fOption) { */ stmt->transition_status = STMT_TRANSITION_ALLOCATED; if (stmt->execute_delegate) { - ESAPI_FreeStmt(stmt->execute_delegate, SQL_DROP); + OPENSEARCHAPI_FreeStmt(stmt->execute_delegate, SQL_DROP); stmt->execute_delegate = NULL; } if (!SC_recycle_statement(stmt)) { @@ -220,7 +220,7 @@ RETCODE SQL_API ESAPI_FreeStmt(HSTMT hstmt, SQLUSMALLINT fOption) { ; else { SC_set_error(stmt, STMT_OPTION_OUT_OF_RANGE_ERROR, - "Invalid option passed to ESAPI_FreeStmt.", func); + "Invalid option passed to OPENSEARCHAPI_FreeStmt.", func); return SQL_ERROR; } @@ -287,7 +287,7 @@ StatementClass *SC_Constructor(ConnectionClass *conn) { rv->__error_message = NULL; rv->__error_number = 0; - rv->eserror = NULL; + rv->opensearch_error = NULL; rv->statement = NULL; rv->load_statement = NULL; @@ -354,7 +354,7 @@ char SC_Destructor(StatementClass *self) { CSTR func = "SC_Destructor"; QResultClass *res = SC_get_Result(self); - MYLOG(ES_TRACE, "entering self=%p, self->result=%p, self->hdbc=%p\n", self, + MYLOG(OPENSEARCH_TRACE, "entering self=%p, self->result=%p, self->hdbc=%p\n", self, res, self->hdbc); SC_clear_error(self); if (STMT_EXECUTING == self->status) { @@ -386,8 +386,8 @@ char SC_Destructor(StatementClass *self) { if (self->__error_message) free(self->__error_message); - if (self->eserror) - ER_Destructor(self->eserror); + if (self->opensearch_error) + ER_Destructor(self->opensearch_error); cancelNeedDataState(self); if (self->callbacks) free(self->callbacks); @@ -395,19 +395,19 @@ char SC_Destructor(StatementClass *self) { DELETE_STMT_CS(self); free(self); - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); return TRUE; } void SC_init_Result(StatementClass *self) { self->result = self->curres = NULL; - MYLOG(ES_TRACE, "leaving(%p)\n", self); + MYLOG(OPENSEARCH_TRACE, "leaving(%p)\n", self); } void SC_set_Result(StatementClass *self, QResultClass *res) { if (res != self->result) { - MYLOG(ES_DEBUG, "(%p, %p)\n", self, res); + MYLOG(OPENSEARCH_DEBUG, "(%p, %p)\n", self, res); QR_Destructor(self->result); self->result = self->curres = res; } @@ -441,11 +441,11 @@ void SC_set_rowset_start(StatementClass *stmt, SQLLEN start, BOOL valid_base) { QResultClass *res = SC_get_Curres(stmt); SQLLEN incr = start - stmt->rowset_start; - MYLOG(ES_DEBUG, "%p->SC_set_rowstart " FORMAT_LEN "->" FORMAT_LEN "(%s) ", + MYLOG(OPENSEARCH_DEBUG, "%p->SC_set_rowstart " FORMAT_LEN "->" FORMAT_LEN "(%s) ", stmt, stmt->rowset_start, start, valid_base ? "valid" : "unknown"); if (res != NULL) { BOOL valid = QR_has_valid_base(res); - MYPRINTF(ES_DEBUG, ":(%p)QR is %s", res, + MYPRINTF(OPENSEARCH_DEBUG, ":(%p)QR is %s", res, QR_has_valid_base(res) ? "valid" : "unknown"); if (valid) { @@ -462,12 +462,12 @@ void SC_set_rowset_start(StatementClass *stmt, SQLLEN start, BOOL valid_base) { } if (!QR_get_cursor(res)) res->key_base = start; - MYPRINTF(ES_DEBUG, ":(%p)QR result=" FORMAT_LEN "(%s)", res, + MYPRINTF(OPENSEARCH_DEBUG, ":(%p)QR result=" FORMAT_LEN "(%s)", res, QR_get_rowstart_in_cache(res), QR_has_valid_base(res) ? "valid" : "unknown"); } stmt->rowset_start = start; - MYPRINTF(ES_DEBUG, ":stmt result=" FORMAT_LEN "\n", stmt->rowset_start); + MYPRINTF(OPENSEARCH_DEBUG, ":stmt result=" FORMAT_LEN "\n", stmt->rowset_start); } void SC_inc_rowset_start(StatementClass *stmt, SQLLEN inc) { SQLLEN start = stmt->rowset_start + inc; @@ -554,7 +554,7 @@ BOOL SC_opencheck(StatementClass *self, const char *func) { * We can dispose the result of Describe-only any time. */ if (self->prepare && self->status == STMT_DESCRIBED) { - MYLOG(ES_DEBUG, "self->prepare && self->status == STMT_DESCRIBED\n"); + MYLOG(OPENSEARCH_DEBUG, "self->prepare && self->status == STMT_DESCRIBED\n"); return FALSE; } if (res = SC_get_Curres(self), NULL != res) { @@ -603,7 +603,7 @@ char SC_recycle_statement(StatementClass *self) { CSTR func = "SC_recycle_statement"; ConnectionClass *conn; - MYLOG(ES_TRACE, "entering self=%p\n", self); + MYLOG(OPENSEARCH_TRACE, "entering self=%p\n", self); SC_clear_error(self); /* This would not happen */ @@ -643,7 +643,7 @@ char SC_recycle_statement(StatementClass *self) { /* Free the parsed table/field information */ SC_initialize_cols_info(self, TRUE, TRUE); - MYLOG(ES_DEBUG, "SC_clear_parse_status\n"); + MYLOG(OPENSEARCH_DEBUG, "SC_clear_parse_status\n"); SC_clear_parse_status(self, conn); break; } @@ -665,7 +665,7 @@ char SC_recycle_statement(StatementClass *self) { SC_set_rowset_start(self, -1, FALSE); SC_set_current_col(self, -1); self->bind_row = 0; - MYLOG(ES_DEBUG, "statement=%p ommitted=0\n", self); + MYLOG(OPENSEARCH_DEBUG, "statement=%p ommitted=0\n", self); self->last_fetch_count = self->last_fetch_count_include_ommitted = 0; self->__error_message = NULL; @@ -712,9 +712,9 @@ void SC_clear_error(StatementClass *self) { free(self->__error_message); self->__error_message = NULL; } - if (self->eserror) { - ER_Destructor(self->eserror); - self->eserror = NULL; + if (self->opensearch_error) { + ER_Destructor(self->opensearch_error); + self->opensearch_error = NULL; } self->diag_row_count = 0; if (res = SC_get_Curres(self), res) { @@ -788,8 +788,7 @@ static const struct { {STMT_NO_RESPONSE, "08S01", "08S01"}, {STMT_COMMUNICATION_ERROR, "08S01", "08S01"}}; -static ES_ErrorInfo *SC_create_errorinfo(const StatementClass *self, - ES_ErrorInfo *eserror_fail_safe) { +static OpenSearch_ErrorInfo *SC_create_errorinfo(const StatementClass *self, OpenSearch_ErrorInfo *opensearch_error_fail_safe) { QResultClass *res = SC_get_Curres(self); ConnectionClass *conn = SC_get_conn(self); Int4 errornum; @@ -798,10 +797,10 @@ static ES_ErrorInfo *SC_create_errorinfo(const StatementClass *self, BOOL looponce, loopend; char msg[4096], *wmsg; char *ermsg = NULL, *sqlstate = NULL; - ES_ErrorInfo *eserror; + OpenSearch_ErrorInfo *opensearch_error; - if (self->eserror) - return self->eserror; + if (self->opensearch_error) + return self->opensearch_error; errornum = self->__error_number; if (errornum == 0) return NULL; @@ -861,23 +860,23 @@ static ES_ErrorInfo *SC_create_errorinfo(const StatementClass *self, ermsg = msg; } - eserror = ER_Constructor(self->__error_number, ermsg); - if (!eserror) { - if (eserror_fail_safe) { - memset(eserror_fail_safe, 0, sizeof(*eserror_fail_safe)); - eserror = eserror_fail_safe; - eserror->status = self->__error_number; - eserror->errorsize = sizeof(eserror->__error_message); - STRCPY_FIXED(eserror->__error_message, ermsg); - eserror->recsize = -1; + opensearch_error = ER_Constructor(self->__error_number, ermsg); + if (!opensearch_error) { + if (opensearch_error_fail_safe) { + memset(opensearch_error_fail_safe, 0, sizeof(*opensearch_error_fail_safe)); + opensearch_error = opensearch_error_fail_safe; + opensearch_error->status = self->__error_number; + opensearch_error->errorsize = sizeof(opensearch_error->__error_message); + STRCPY_FIXED(opensearch_error->__error_message, ermsg); + opensearch_error->recsize = -1; } else return NULL; } if (sqlstate) - STRCPY_FIXED(eserror->sqlstate, sqlstate); + STRCPY_FIXED(opensearch_error->sqlstate, sqlstate); else if (conn) { if (!msgend && conn->sqlstate[0]) - STRCPY_FIXED(eserror->sqlstate, conn->sqlstate); + STRCPY_FIXED(opensearch_error->sqlstate, conn->sqlstate); else { EnvironmentClass *env = (EnvironmentClass *)CC_get_env(conn); @@ -888,14 +887,14 @@ static ES_ErrorInfo *SC_create_errorinfo(const StatementClass *self, / sizeof(Statement_sqlstate[0])) { errornum = 1 - LOWEST_STMT_ERROR; } - STRCPY_FIXED(eserror->sqlstate, + STRCPY_FIXED(opensearch_error->sqlstate, EN_is_odbc3(env) ? Statement_sqlstate[errornum].ver3str : Statement_sqlstate[errornum].ver2str); } } - return eserror; + return opensearch_error; } void SC_reset_delegate(RETCODE retcode, StatementClass *stmt) { @@ -904,7 +903,7 @@ void SC_reset_delegate(RETCODE retcode, StatementClass *stmt) { if (!delegate) return; - ESAPI_FreeStmt(delegate, SQL_DROP); + OPENSEARCHAPI_FreeStmt(delegate, SQL_DROP); } void SC_set_error(StatementClass *self, int number, const char *message, @@ -928,7 +927,7 @@ void SC_error_copy(StatementClass *self, const StatementClass *from, QResultClass *self_res, *from_res; BOOL repstate; - MYLOG(ES_TRACE, "entering %p->%p check=%i\n", from, self, check); + MYLOG(OPENSEARCH_TRACE, "entering %p->%p check=%i\n", from, self, check); if (!from) return; /* for safety */ if (self == from) @@ -947,9 +946,9 @@ void SC_error_copy(StatementClass *self, const StatementClass *from, self->__error_message = from->__error_message ? strdup(from->__error_message) : NULL; } - if (self->eserror) { - ER_Destructor(self->eserror); - self->eserror = NULL; + if (self->opensearch_error) { + ER_Destructor(self->opensearch_error); + self->opensearch_error = NULL; } self_res = SC_get_Curres(self); from_res = SC_get_Curres(from); @@ -972,9 +971,9 @@ void SC_error_copy(StatementClass *self, const StatementClass *from, void SC_full_error_copy(StatementClass *self, const StatementClass *from, BOOL allres) { - ES_ErrorInfo *eserror; + OpenSearch_ErrorInfo *opensearch_error; - MYLOG(ES_TRACE, "entering %p->%p\n", from, self); + MYLOG(OPENSEARCH_TRACE, "entering %p->%p\n", from, self); if (!from) return; /* for safety */ if (self == from) @@ -986,40 +985,40 @@ void SC_full_error_copy(StatementClass *self, const StatementClass *from, if (from->__error_message) self->__error_message = strdup(from->__error_message); self->__error_number = from->__error_number; - if (from->eserror) { - if (self->eserror) - ER_Destructor(self->eserror); - self->eserror = ER_Dup(from->eserror); + if (from->opensearch_error) { + if (self->opensearch_error) + ER_Destructor(self->opensearch_error); + self->opensearch_error = ER_Dup(from->opensearch_error); return; } else if (!allres) return; - eserror = SC_create_errorinfo(from, NULL); - if (!eserror || !eserror->__error_message[0]) { - ER_Destructor(eserror); + opensearch_error = SC_create_errorinfo(from, NULL); + if (!opensearch_error || !opensearch_error->__error_message[0]) { + ER_Destructor(opensearch_error); return; } - if (self->eserror) - ER_Destructor(self->eserror); - self->eserror = eserror; + if (self->opensearch_error) + ER_Destructor(self->opensearch_error); + self->opensearch_error = opensearch_error; } /* Returns the next SQL error information. */ -RETCODE SQL_API ESAPI_StmtError(SQLHSTMT hstmt, SQLSMALLINT RecNumber, +RETCODE SQL_API OPENSEARCHAPI_StmtError(SQLHSTMT hstmt, SQLSMALLINT RecNumber, SQLCHAR *szSqlState, SQLINTEGER *pfNativeError, SQLCHAR *szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT *pcbErrorMsg, UWORD flag) { /* CC: return an error of a hdesc */ - ES_ErrorInfo *eserror, error; + OpenSearch_ErrorInfo *opensearch_error, error; StatementClass *stmt = (StatementClass *)hstmt; int errnum = SC_get_errornumber(stmt); - if (eserror = SC_create_errorinfo(stmt, &error), NULL == eserror) + if (opensearch_error = SC_create_errorinfo(stmt, &error), NULL == opensearch_error) return SQL_NO_DATA_FOUND; - if (eserror != &error) - stmt->eserror = eserror; - if (STMT_NO_MEMORY_ERROR == errnum && !eserror->__error_message[0]) - STRCPY_FIXED(eserror->__error_message, "Memory Allocation Error??"); - return ER_ReturnError(eserror, RecNumber, szSqlState, pfNativeError, + if (opensearch_error != &error) + stmt->opensearch_error = opensearch_error; + if (STMT_NO_MEMORY_ERROR == errnum && !opensearch_error->__error_message[0]) + STRCPY_FIXED(opensearch_error->__error_message, "Memory Allocation Error??"); + return ER_ReturnError(opensearch_error, RecNumber, szSqlState, pfNativeError, szErrorMsg, cbErrorMsgMax, pcbErrorMsg, flag); } @@ -1069,13 +1068,13 @@ SC_fetch(StatementClass *self) { /* TupleField *tupleField; */ - MYLOG(ES_TRACE, "entering statement=%p res=%p ommitted=0\n", self, res); + MYLOG(OPENSEARCH_TRACE, "entering statement=%p res=%p ommitted=0\n", self, res); self->last_fetch_count = self->last_fetch_count_include_ommitted = 0; if (!res) return SQL_ERROR; coli = QR_get_fields(res); /* the column info */ - MYLOG(ES_DEBUG, "fetch_cursor=%d, %p->total_read=" FORMAT_LEN "\n", + MYLOG(OPENSEARCH_DEBUG, "fetch_cursor=%d, %p->total_read=" FORMAT_LEN "\n", SC_is_fetchcursor(self), res, res->num_total_read); if (self->currTuple >= (Int4)QR_get_num_total_tuples(res) - 1 @@ -1089,14 +1088,14 @@ SC_fetch(StatementClass *self) { return SQL_NO_DATA_FOUND; } - MYLOG(ES_DEBUG, "**** : non-cursor_result\n"); + MYLOG(OPENSEARCH_DEBUG, "**** : non-cursor_result\n"); (self->currTuple)++; num_cols = QR_NumPublicResultCols(res); result = SQL_SUCCESS; self->last_fetch_count++; - MYLOG(ES_DEBUG, "stmt=%p ommitted++\n", self); + MYLOG(OPENSEARCH_DEBUG, "stmt=%p ommitted++\n", self); self->last_fetch_count_include_ommitted++; opts = SC_get_ARDF(self); @@ -1121,7 +1120,7 @@ SC_fetch(StatementClass *self) { if (gdata->allocated != opts->allocated) extend_getdata_info(gdata, opts->allocated, TRUE); for (lf = 0; lf < num_cols; lf++) { - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "fetch: cols=%d, lf=%d, opts = %p, opts->bindings = %p, buffer[] " "= %p\n", num_cols, lf, opts, opts->bindings, opts->bindings[lf].buffer); @@ -1138,28 +1137,28 @@ SC_fetch(StatementClass *self) { type = CI_get_oid(coli, lf); /* speed things up */ atttypmod = CI_get_atttypmod(coli, lf); /* speed things up */ - MYLOG(ES_DEBUG, "type = %d, atttypmod = %d\n", type, atttypmod); + MYLOG(OPENSEARCH_DEBUG, "type = %d, atttypmod = %d\n", type, atttypmod); if (useCursor) value = QR_get_value_backend(res, lf); else { SQLLEN curt = GIdx2CacheIdx(self->currTuple, self, res); - MYLOG(ES_DEBUG, + MYLOG(OPENSEARCH_DEBUG, "%p->base=" FORMAT_LEN " curr=" FORMAT_LEN " st=" FORMAT_LEN " valid=%d\n", res, QR_get_rowstart_in_cache(res), self->currTuple, SC_get_rowset_start(self), QR_has_valid_base(res)); - MYLOG(ES_DEBUG, "curt=" FORMAT_LEN "\n", curt); + MYLOG(OPENSEARCH_DEBUG, "curt=" FORMAT_LEN "\n", curt); value = QR_get_value_backend_row(res, curt, lf); } - MYLOG(ES_DEBUG, "value = '%s'\n", + MYLOG(OPENSEARCH_DEBUG, "value = '%s'\n", (value == NULL) ? "" : value); retval = copy_and_convert_field_bindinfo(self, type, atttypmod, value, lf); - MYLOG(ES_DEBUG, "copy_and_convert: retval = %d\n", retval); + MYLOG(OPENSEARCH_DEBUG, "copy_and_convert: retval = %d\n", retval); switch (retval) { case COPY_OK: @@ -1168,7 +1167,7 @@ SC_fetch(StatementClass *self) { case COPY_UNSUPPORTED_TYPE: SC_set_error( self, STMT_RESTRICTED_DATA_TYPE_ERROR, - "Received an unsupported type from Elasticsearch.", + "Received an unsupported type from OpenSearch.", func); result = SQL_ERROR; break; @@ -1184,10 +1183,10 @@ SC_fetch(StatementClass *self) { case COPY_RESULT_TRUNCATED: SC_set_error(self, STMT_TRUNCATED, "Fetched item was truncated.", func); - MYLOG(ES_DEBUG, "The %dth item was truncated\n", lf + 1); - MYLOG(ES_DEBUG, "The buffer size = " FORMAT_LEN, + MYLOG(OPENSEARCH_DEBUG, "The %dth item was truncated\n", lf + 1); + MYLOG(OPENSEARCH_DEBUG, "The buffer size = " FORMAT_LEN, opts->bindings[lf].buflen); - MYLOG(ES_DEBUG, " and the value is '%s'\n", value); + MYLOG(OPENSEARCH_DEBUG, " and the value is '%s'\n", value); result = SQL_SUCCESS_WITH_INFO; break; @@ -1230,7 +1229,7 @@ RETCODE dequeueNeedDataCallback(RETCODE retcode, StatementClass *stmt) { void *data; int i, cnt; - MYLOG(ES_TRACE, "entering ret=%d count=%d\n", retcode, stmt->num_callbacks); + MYLOG(OPENSEARCH_TRACE, "entering ret=%d count=%d\n", retcode, stmt->num_callbacks); if (SQL_NEED_DATA == retcode) return retcode; if (stmt->num_callbacks <= 0) @@ -1280,7 +1279,7 @@ void SC_log_error(const char *func, const char *desc, head, func, desc, self->__error_number, NULLCHECK(self->__error_message)); } - MYLOG(ES_DEBUG, "%s: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", + MYLOG(OPENSEARCH_DEBUG, "%s: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", head, func, desc, self->__error_number, NULLCHECK(self->__error_message)); if (SC_get_errornumber(self) > 0) { @@ -1342,7 +1341,7 @@ void SC_log_error(const char *func, const char *desc, CC_log_error(func, desc, self->hdbc); } } else { - MYLOG(ES_DEBUG, "INVALID STATEMENT HANDLE ERROR: func=%s, desc='%s'\n", + MYLOG(OPENSEARCH_DEBUG, "INVALID STATEMENT HANDLE ERROR: func=%s, desc='%s'\n", func, desc); } } @@ -1448,21 +1447,21 @@ int SC_Create_bookmark(StatementClass *self, BindInfoClass *bookmark, SQLUINTEGER bind_size = opts->bind_size; SQLULEN offset = opts->row_offset_ptr ? *opts->row_offset_ptr : 0; size_t cvtlen = sizeof(Int4); - ES_BM ES_bm; + OPENSEARCH_BM opensearch_bm; - MYLOG(ES_TRACE, "entering type=%d buflen=" FORMAT_LEN " buf=%p\n", + MYLOG(OPENSEARCH_TRACE, "entering type=%d buflen=" FORMAT_LEN " buf=%p\n", bookmark->returntype, bookmark->buflen, bookmark->buffer); - memset(&ES_bm, 0, sizeof(ES_bm)); + memset(&opensearch_bm, 0, sizeof(opensearch_bm)); if (SQL_C_BOOKMARK == bookmark->returntype) ; - else if (bookmark->buflen >= (SQLLEN)sizeof(ES_bm)) - cvtlen = sizeof(ES_bm); + else if (bookmark->buflen >= (SQLLEN)sizeof(opensearch_bm)) + cvtlen = sizeof(opensearch_bm); else if (bookmark->buflen >= 12) cvtlen = 12; - ES_bm.index = SC_make_int4_bookmark(currTuple); + opensearch_bm.index = SC_make_int4_bookmark(currTuple); if (keyset) - ES_bm.keys = *keyset; - memcpy(CALC_BOOKMARK_ADDR(bookmark, offset, bind_size, bind_row), &ES_bm, + opensearch_bm.keys = *keyset; + memcpy(CALC_BOOKMARK_ADDR(bookmark, offset, bind_size, bind_row), &opensearch_bm, cvtlen); if (bookmark->used) { SQLLEN *used = LENADDR_SHIFT(bookmark->used, offset); @@ -1473,8 +1472,10 @@ int SC_Create_bookmark(StatementClass *self, BindInfoClass *bookmark, used = (SQLLEN *)((char *)used + (bind_row * sizeof(SQLLEN))); *used = cvtlen; } - MYLOG(ES_TRACE, "leaving cvtlen=" FORMAT_SIZE_T " ix(bl,of)=%d(%d,%d)\n", - cvtlen, ES_bm.index, ES_bm.keys.blocknum, ES_bm.keys.offset); + MYLOG(OPENSEARCH_TRACE, "leaving cvtlen=" FORMAT_SIZE_T " ix(bl,of)=%d(%d,%d)\n", + cvtlen, + opensearch_bm.index, opensearch_bm.keys.blocknum, + opensearch_bm.keys.offset); return COPY_OK; } diff --git a/sql-odbc/src/odfesqlodbc/statement.h b/sql-odbc/src/odfesqlodbc/statement.h index 1654cc4031..b80254da3f 100644 --- a/sql-odbc/src/odfesqlodbc/statement.h +++ b/sql-odbc/src/odfesqlodbc/statement.h @@ -21,9 +21,9 @@ #include "bind.h" #include "descriptor.h" -#include "es_helper.h" -#include "es_odbc.h" -#include "es_types.h" +#include "opensearch_helper.h" +#include "opensearch_odbc.h" +#include "opensearch_types.h" #include "tuple.h" // C Interface @@ -179,7 +179,7 @@ enum { /* Result style */ enum { STMT_FETCH_NONE = 0, STMT_FETCH_NORMAL, STMT_FETCH_EXTENDED }; -#define ES_NUM_NORMAL_KEYS 2 +#define OPENSEARCH_NUM_NORMAL_KEYS 2 typedef RETCODE (*NeedDataCallfunc)(RETCODE, void *); typedef struct { @@ -224,7 +224,7 @@ struct StatementClass_ { STMT_Status status; char *__error_message; int __error_number; - ES_ErrorInfo *eserror; + OpenSearch_ErrorInfo *opensearch_error; SQLLEN currTuple; /* current absolute row number (GetData, * SetPos, SQLFetch) */ @@ -256,7 +256,7 @@ struct StatementClass_ { Int2 statement_type; /* According to the defines above */ Int2 num_params; Int2 data_at_exec; /* Number of params needing SQLPutData */ - UDWORD iflag; /* ESAPI_AllocStmt parameter */ + UDWORD iflag; /* OPENSEARCHAPI_AllocStmt parameter */ PutDataInfo pdata_info; po_ind_t parse_status; po_ind_t proc_return; @@ -276,7 +276,7 @@ struct StatementClass_ { po_ind_t lock_CC_for_rb; /* lock CC for statement rollback ? */ po_ind_t join_info; /* have joins ? */ po_ind_t parse_method; /* parse_statement is forced or ? */ - esNAME cursor_name; + opensearchNAME cursor_name; char *plan_name; unsigned char miscinfo; unsigned char execinfo; diff --git a/sql-odbc/src/odfesqlodbc/tuple.h b/sql-odbc/src/odfesqlodbc/tuple.h index c9623a82ca..749fc8313a 100644 --- a/sql-odbc/src/odfesqlodbc/tuple.h +++ b/sql-odbc/src/odfesqlodbc/tuple.h @@ -17,7 +17,7 @@ #ifndef __TUPLE_H__ #define __TUPLE_H__ -#include "es_odbc.h" +#include "opensearch_odbc.h" // C Interface #ifdef __cplusplus @@ -73,10 +73,10 @@ void set_tuplefield_int2(TupleField *tuple_field, Int2 value); void set_tuplefield_int4(TupleField *tuple_field, Int4 value); SQLLEN ClearCachedRows(TupleField *tuple, int num_fields, SQLLEN num_rows); -typedef struct _ES_BM_ { +typedef struct _OPENSEARCH_BM_ { Int4 index; KeySet keys; -} ES_BM; +} OPENSEARCH_BM; #ifdef __cplusplus } diff --git a/sql-odbc/src/odfesqlodbc/unicode_support.h b/sql-odbc/src/odfesqlodbc/unicode_support.h index 1e73e8c65d..dce8574615 100644 --- a/sql-odbc/src/odfesqlodbc/unicode_support.h +++ b/sql-odbc/src/odfesqlodbc/unicode_support.h @@ -17,7 +17,7 @@ #ifndef __UNICODE_SUPPORT_H__ #define __UNICODE_SUPPORT_H__ -#include "es_odbc.h" +#include "opensearch_odbc.h" #ifdef UNICODE_SUPPORT #define WCLEN sizeof(SQLWCHAR) diff --git a/sql-odbc/src/odfesqlodbc/version.h b/sql-odbc/src/odfesqlodbc/version.h index fa68acea22..4206010899 100644 --- a/sql-odbc/src/odfesqlodbc/version.h +++ b/sql-odbc/src/odfesqlodbc/version.h @@ -19,20 +19,20 @@ /* * BuildAll may pass ELASTICDRIVERVERSION, ELASTIC_RESOURCE_VERSION - * and ES_DRVFILE_VERSION via winbuild/elasticodbc.vcxproj. + * and OPENSEARCH_DRVFILE_VERSION via winbuild/elasticodbc.vcxproj. */ -#ifdef ES_ODBC_VERSION +#ifdef OPENSEARCH_ODBC_VERSION -#ifndef ELASTICSEARCHDRIVERVERSION -#define ELASTICSEARCHDRIVERVERSION ES_ODBC_VERSION +#ifndef OPENSEARCHDRIVERVERSION +#define OPENSEARCHDRIVERVERSION OPENSEARCH_ODBC_VERSION #endif -#ifndef ELASTICSEARCH_RESOURCE_VERSION -#define ELASTICSEARCH_RESOURCE_VERSION ELASTICSEARCHDRIVERVERSION +#ifndef OPENSEARCH_RESOURCE_VERSION +#define OPENSEARCH_RESOURCE_VERSION OPENSEARCHDRIVERVERSION #endif -#ifndef ES_DRVFILE_VERSION -#define ES_DRVFILE_VERSION ES_ODBC_DRVFILE_VERSION +#ifndef OPENSEARCH_DRVFILE_VERSION +#define OPENSEARCH_DRVFILE_VERSION OPENSEARCH_ODBC_DRVFILE_VERSION #endif -#endif // ES_ODBC_VERSION +#endif // OPENSEARCH_ODBC_VERSION #endif diff --git a/sql-odbc/src/odfesqlodbc/win_unicode.c b/sql-odbc/src/odfesqlodbc/win_unicode.c index 729238c85a..e289bbd9db 100644 --- a/sql-odbc/src/odfesqlodbc/win_unicode.c +++ b/sql-odbc/src/odfesqlodbc/win_unicode.c @@ -56,7 +56,7 @@ int get_convtype(void) { case 2: if ('a' == cdt[0] && '\0' == cdt[1] && '\0' == cdt[2] && '\0' == cdt[3]) { - MYLOG(ES_DEBUG, " UTF-16LE detected\n"); + MYLOG(OPENSEARCH_DEBUG, " UTF-16LE detected\n"); convtype = WCSTYPE_UTF16_LE; use_wcs = TRUE; } @@ -65,7 +65,7 @@ int get_convtype(void) { if ('a' == cdt[0] && '\0' == cdt[1] && '\0' == cdt[2] && '\0' == cdt[3] && '\0' == cdt[4] && '\0' == cdt[5] && '\0' == cdt[6] && '\0' == cdt[7]) { - MYLOG(ES_DEBUG, " UTF32-LE detected\n"); + MYLOG(OPENSEARCH_DEBUG, " UTF32-LE detected\n"); convtype = WCSTYPE_UTF32_LE; use_wcs = TRUE; } @@ -80,7 +80,7 @@ int get_convtype(void) { cdt = (UCHAR *)c16dt; if ('a' == cdt[0] && '\0' == cdt[1] && '\0' == cdt[2] && '\0' == cdt[3]) { - MYLOG(ES_DEBUG, " C16_UTF-16LE detected\n"); + MYLOG(OPENSEARCH_DEBUG, " C16_UTF-16LE detected\n"); convtype = C16TYPE_UTF16_LE; use_c16 = TRUE; } @@ -123,7 +123,7 @@ char *ucs2_to_utf8(const SQLWCHAR *ucs2str, SQLLEN ilen, SQLLEN *olen, BOOL lower_identifier) { char *utf8str; int len = 0; - MYLOG(ES_DEBUG, "%p ilen=" FORMAT_LEN " ", ucs2str, ilen); + MYLOG(OPENSEARCH_DEBUG, "%p ilen=" FORMAT_LEN " ", ucs2str, ilen); if (!ucs2str) { if (olen) @@ -240,11 +240,11 @@ utf8_to_ucs2_lf(const char *utf8str, SQLLEN ilen, BOOL lfconv, SQLULEN rtn, ocount, wcode; const UCHAR *str; - MYLOG(ES_DEBUG, "ilen=" FORMAT_LEN " bufcount=" FORMAT_ULEN, ilen, + MYLOG(OPENSEARCH_DEBUG, "ilen=" FORMAT_LEN " bufcount=" FORMAT_ULEN, ilen, bufcount); if (!utf8str) return 0; - MYPRINTF(ES_DEBUG, " string=%s", utf8str); + MYPRINTF(OPENSEARCH_DEBUG, " string=%s", utf8str); if (!bufcount) ucs2str = NULL; @@ -254,10 +254,10 @@ utf8_to_ucs2_lf(const char *utf8str, SQLLEN ilen, BOOL lfconv, ilen = strlen(utf8str); for (i = 0, ocount = 0, str = (SQLCHAR *)utf8str; i < ilen && *str;) { if ((*str & 0x80) == 0) { - if (lfconv && ES_LINEFEED == *str - && (i == 0 || ES_CARRIAGE_RETURN != str[-1])) { + if (lfconv && OPENSEARCH_LINEFEED == *str + && (i == 0 || OPENSEARCH_CARRIAGE_RETURN != str[-1])) { if (ocount < bufcount) - ucs2str[ocount] = ES_CARRIAGE_RETURN; + ucs2str[ocount] = OPENSEARCH_CARRIAGE_RETURN; ocount++; } if (ocount < bufcount) @@ -342,7 +342,7 @@ utf8_to_ucs2_lf(const char *utf8str, SQLLEN ilen, BOOL lfconv, } if (ocount < bufcount && ucs2str) ucs2str[ocount] = 0; - MYPRINTF(ES_ALL, " ocount=" FORMAT_ULEN "\n", ocount); + MYPRINTF(OPENSEARCH_ALL, " ocount=" FORMAT_ULEN "\n", ocount); return rtn; } @@ -369,7 +369,7 @@ static char *ucs4_to_utf8(const UInt4 *ucs4str, SQLLEN ilen, SQLLEN *olen, BOOL lower_identifier) { char *utf8str; int len = 0; - MYLOG(ES_DEBUG, " %p ilen=" FORMAT_LEN "\n", ucs4str, ilen); + MYLOG(OPENSEARCH_DEBUG, " %p ilen=" FORMAT_LEN "\n", ucs4str, ilen); if (!ucs4str) { if (olen) @@ -382,7 +382,7 @@ static char *ucs4_to_utf8(const UInt4 *ucs4str, SQLLEN ilen, SQLLEN *olen, } if (ilen < 0) ilen = ucs4strlen(ucs4str); - MYLOG(ES_DEBUG, " newlen=" FORMAT_LEN "\n", ilen); + MYLOG(OPENSEARCH_DEBUG, " newlen=" FORMAT_LEN "\n", ilen); utf8str = (char *)malloc(ilen * 4 + 1); if (utf8str) { int i; @@ -427,7 +427,7 @@ static char *ucs4_to_utf8(const UInt4 *ucs4str, SQLLEN ilen, SQLLEN *olen, | ((byte4_mask2 & *wstr) >> 4) | ((byte4_mask3 & *wstr) << 10) | ((byte4_mask4 & *wstr) << 24); - /* MYLOG(ES_DEBUG, " %08x->%08x\n", *wstr, byte4code); */ + /* MYLOG(OPENSEARCH_DEBUG, " %08x->%08x\n", *wstr, byte4code); */ if (little_endian) memcpy(utf8str + len, (char *)&byte4code, sizeof(byte4code)); @@ -444,7 +444,7 @@ static char *ucs4_to_utf8(const UInt4 *ucs4str, SQLLEN ilen, SQLLEN *olen, if (olen) *olen = len; } - MYLOG(ES_DEBUG, " olen=%d %s\n", len, utf8str ? utf8str : ""); + MYLOG(OPENSEARCH_DEBUG, " olen=%d %s\n", len, utf8str ? utf8str : ""); return utf8str; } @@ -469,7 +469,7 @@ static SQLULEN utf8_to_ucs4_lf(const char *utf8str, SQLLEN ilen, BOOL lfconv, SQLULEN rtn, ocount, wcode; const UCHAR *str; - MYLOG(ES_DEBUG, " ilen=" FORMAT_LEN " bufcount=" FORMAT_ULEN "\n", ilen, bufcount); + MYLOG(OPENSEARCH_DEBUG, " ilen=" FORMAT_LEN " bufcount=" FORMAT_ULEN "\n", ilen, bufcount); if (!utf8str) return 0; MYLOG(99, " string=%s\n", utf8str); @@ -482,10 +482,10 @@ static SQLULEN utf8_to_ucs4_lf(const char *utf8str, SQLLEN ilen, BOOL lfconv, ilen = strlen(utf8str); for (i = 0, ocount = 0, str = (SQLCHAR *)utf8str; i < ilen && *str;) { if ((*str & 0x80) == 0) { - if (lfconv && ES_LINEFEED == *str - && (i == 0 || ES_CARRIAGE_RETURN != str[-1])) { + if (lfconv && OPENSEARCH_LINEFEED == *str + && (i == 0 || OPENSEARCH_CARRIAGE_RETURN != str[-1])) { if (ocount < bufcount) - ucs4str[ocount] = ES_CARRIAGE_RETURN; + ucs4str[ocount] = OPENSEARCH_CARRIAGE_RETURN; ocount++; } if (ocount < bufcount) @@ -564,7 +564,7 @@ static SQLULEN utf8_to_ucs4_lf(const char *utf8str, SQLLEN ilen, BOOL lfconv, } if (ocount < bufcount && ucs4str) ucs4str[ocount] = 0; - MYLOG(ES_DEBUG, " ocount=" FORMAT_ULEN "\n", ocount); + MYLOG(OPENSEARCH_DEBUG, " ocount=" FORMAT_ULEN "\n", ocount); return rtn; } @@ -580,18 +580,18 @@ static int ucs4_to_ucs2_lf(const unsigned int *ucs4str, SQLLEN ilen, UCHAR *const udt = (UCHAR *)&dmy_wchar; unsigned int uintdt; - MYLOG(ES_DEBUG, " ilen=" FORMAT_LEN " bufcount=%d\n", ilen, bufcount); + MYLOG(OPENSEARCH_DEBUG, " ilen=" FORMAT_LEN " bufcount=%d\n", ilen, bufcount); if (ilen < 0) ilen = ucs4strlen(ucs4str); for (i = 0; i < ilen && (uintdt = ucs4str[i], uintdt); i++) { sqlwdt = (SQLWCHAR *)&uintdt; ucdt = (UCHAR *)&uintdt; if (0 == sqlwdt[1]) { - if (lfconv && ES_LINEFEED == ucdt[0] + if (lfconv && OPENSEARCH_LINEFEED == ucdt[0] && (i == 0 - || ES_CARRIAGE_RETURN != *((UCHAR *)&ucs4str[i - 1]))) { + || OPENSEARCH_CARRIAGE_RETURN != *((UCHAR *)&ucs4str[i - 1]))) { if (outlen < bufcount) { - udt[0] = ES_CARRIAGE_RETURN; + udt[0] = OPENSEARCH_CARRIAGE_RETURN; udt[1] = 0; ucs2str[outlen] = *((SQLWCHAR *)udt); } @@ -631,7 +631,7 @@ static int ucs2_to_ucs4(const SQLWCHAR *ucs2str, SQLLEN ilen, unsigned int dmy_uint; UCHAR *const udt = (UCHAR *)&dmy_uint; - MYLOG(ES_DEBUG, " ilen=" FORMAT_LEN " bufcount=%d\n", ilen, bufcount); + MYLOG(OPENSEARCH_DEBUG, " ilen=" FORMAT_LEN " bufcount=%d\n", ilen, bufcount); if (ilen < 0) ilen = ucs2strlen(ucs2str); udt[3] = 0; /* always */ @@ -708,7 +708,7 @@ static char *wcs_to_utf8(const wchar_t *wcsstr, SQLLEN ilen, SQLLEN *olen, static int msgtowstr(const char *inmsg, wchar_t *outmsg, int buflen) { int outlen = -1; - MYLOG(ES_DEBUG, " inmsg=%p buflen=%d\n", inmsg, buflen); + MYLOG(OPENSEARCH_DEBUG, " inmsg=%p buflen=%d\n", inmsg, buflen); #ifdef WIN32 if (NULL == outmsg) buflen = 0; @@ -731,9 +731,9 @@ static int msgtowstr(const char *inmsg, wchar_t *outmsg, int buflen) { #endif /* WIN32 */ if (outmsg && outlen >= buflen) { outmsg[buflen - 1] = 0; - MYLOG(ES_DEBUG, " out=%dchars truncated to %d\n", outlen, buflen - 1); + MYLOG(OPENSEARCH_DEBUG, " out=%dchars truncated to %d\n", outlen, buflen - 1); } - MYLOG(ES_DEBUG, " buf=%dchars out=%dchars\n", buflen, outlen); + MYLOG(OPENSEARCH_DEBUG, " buf=%dchars out=%dchars\n", buflen, outlen); return outlen; } @@ -750,7 +750,7 @@ static int msgtowstr(const char *inmsg, wchar_t *outmsg, int buflen) { static int wstrtomsg(const wchar_t *wstr, char *outmsg, int buflen) { int outlen = -1; - MYLOG(ES_DEBUG, " wstr=%p buflen=%d\n", wstr, buflen); + MYLOG(OPENSEARCH_DEBUG, " wstr=%p buflen=%d\n", wstr, buflen); #ifdef WIN32 if (NULL == outmsg) buflen = 0; @@ -770,9 +770,9 @@ static int wstrtomsg(const wchar_t *wstr, char *outmsg, int buflen) { #endif /* WIN32 */ if (outmsg && outlen >= buflen) { outmsg[buflen - 1] = 0; - MYLOG(ES_DEBUG, " out=%dbytes truncated to %d\n", outlen, buflen - 1); + MYLOG(OPENSEARCH_DEBUG, " out=%dbytes truncated to %d\n", outlen, buflen - 1); } - MYLOG(ES_DEBUG, " buf=%dbytes outlen=%dbytes\n", buflen, outlen); + MYLOG(OPENSEARCH_DEBUG, " buf=%dbytes outlen=%dbytes\n", buflen, outlen); return outlen; } @@ -789,12 +789,12 @@ static SQLLEN mbstoc16_lf(char16_t *c16dt, const char *c8dt, size_t n, const char *cdt; mbstate_t mbst = initial_state; - MYLOG(ES_DEBUG, " c16dt=%p size=" FORMAT_SIZE_T "\n", c16dt, n); + MYLOG(OPENSEARCH_DEBUG, " c16dt=%p size=" FORMAT_SIZE_T "\n", c16dt, n); for (i = 0, cdt = c8dt; i < n || (!c16dt); i++) { - if (lf_conv && ES_LINEFEED == *cdt && i > 0 - && ES_CARRIAGE_RETURN != cdt[-1]) { + if (lf_conv && OPENSEARCH_LINEFEED == *cdt && i > 0 + && OPENSEARCH_CARRIAGE_RETURN != cdt[-1]) { if (c16dt) - c16dt[i] = ES_CARRIAGE_RETURN; + c16dt[i] = OPENSEARCH_CARRIAGE_RETURN; i++; } brtn = mbrtoc16(c16dt ? c16dt + i : NULL, cdt, 4, &mbst); @@ -819,7 +819,7 @@ static SQLLEN c16tombs(char *c8dt, const char16_t *c16dt, size_t n) { char *cdt, c4byte[4]; mbstate_t mbst = initial_state; - MYLOG(ES_DEBUG, " c8dt=%p size=" FORMAT_SIZE_T "u\n", c8dt, n); + MYLOG(OPENSEARCH_DEBUG, " c8dt=%p size=" FORMAT_SIZE_T "u\n", c8dt, n); if (!c8dt) n = 0; for (i = 0, cdt = c8dt; c16dt[i] && (result < n || (!cdt)); i++) { @@ -889,7 +889,7 @@ SQLLEN bindpara_msg_to_utf8(const char *ldt, char **wcsbuf, SQLLEN used) { } get_convtype(); - MYLOG(ES_DEBUG, " \n"); + MYLOG(OPENSEARCH_DEBUG, " \n"); #if defined(__WCS_ISO10646__) if (use_wcs) { wchar_t *wcsdt = (wchar_t *)malloc((count + 1) * sizeof(wchar_t)); @@ -949,7 +949,7 @@ SQLLEN bindpara_wchar_to_msg(const SQLWCHAR *utf16, char **wcsbuf, } get_convtype(); - MYLOG(ES_DEBUG, "\n"); + MYLOG(OPENSEARCH_DEBUG, "\n"); #if defined(__WCS_ISO10646__) if (use_wcs) { #pragma warning(push) @@ -999,7 +999,7 @@ SQLLEN bindcol_hybrid_estimate(const char *ldt, BOOL lf_conv, char **wcsbuf) { SQLLEN l = (-2); get_convtype(); - MYLOG(ES_DEBUG, " lf_conv=%d\n", lf_conv); + MYLOG(OPENSEARCH_DEBUG, " lf_conv=%d\n", lf_conv); #if defined(__WCS_ISO10646__) if (use_wcs) { unsigned int *utf32 = NULL; @@ -1048,7 +1048,7 @@ SQLLEN bindcol_hybrid_exec(SQLWCHAR *utf16, const char *ldt, size_t n, SQLLEN l = (-2); get_convtype(); - MYLOG(ES_DEBUG, " size=" FORMAT_SIZE_T " lf_conv=%d\n", n, lf_conv); + MYLOG(OPENSEARCH_DEBUG, " size=" FORMAT_SIZE_T " lf_conv=%d\n", n, lf_conv); #if defined(__WCS_ISO10646__) if (use_wcs) { unsigned int *utf32 = NULL; @@ -1106,7 +1106,7 @@ SQLLEN bindcol_localize_estimate(const char *utf8dt, BOOL lf_conv, char *convalc = NULL; get_convtype(); - MYLOG(ES_DEBUG, " lf_conv=%d\n", lf_conv); + MYLOG(OPENSEARCH_DEBUG, " lf_conv=%d\n", lf_conv); #if defined(__WCS_ISO10646__) if (use_wcs) { wchar_t *wcsalc = NULL; @@ -1134,7 +1134,7 @@ SQLLEN bindcol_localize_estimate(const char *utf8dt, BOOL lf_conv, else if (NULL != convalc) *wcsbuf = (char *)convalc; - MYLOG(ES_DEBUG, " return=" FORMAT_LEN "\n", l); + MYLOG(OPENSEARCH_DEBUG, " return=" FORMAT_LEN "\n", l); return l; } @@ -1143,7 +1143,7 @@ SQLLEN bindcol_localize_exec(char *ldt, size_t n, BOOL lf_conv, char **wcsbuf) { SQLLEN l = (-2); get_convtype(); - MYLOG(ES_DEBUG, " size=" FORMAT_SIZE_T "\n", n); + MYLOG(OPENSEARCH_DEBUG, " size=" FORMAT_SIZE_T "\n", n); #if defined(__WCS_ISO10646__) if (use_wcs) { wchar_t *wcsalc = (wchar_t *)*wcsbuf; @@ -1161,7 +1161,7 @@ SQLLEN bindcol_localize_exec(char *ldt, size_t n, BOOL lf_conv, char **wcsbuf) { free(*wcsbuf); *wcsbuf = NULL; - MYLOG(ES_DEBUG, " return=" FORMAT_LEN "\n", l); + MYLOG(OPENSEARCH_DEBUG, " return=" FORMAT_LEN "\n", l); return l; }