From 7cb34e3fbd56543133c1255211d832866dd2520a Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 09:05:30 -0700 Subject: [PATCH 01/36] Rename Elasticsearch --- sql-odbc/README.md | 2 +- sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md | 2 +- sql-odbc/docs/dev/Pagination.md | 4 +- .../example_config_files/example_tdc_file.tdc | 2 +- .../docs/dev/example_config_files/kibana.yml | 6 +-- .../sequence_diagrams/SQLDriverConnect.txt | 6 +-- .../dev/sequence_diagrams/SQLExecDirect.txt | 6 +-- sql-odbc/docs/test/excel_connection.md | 2 +- sql-odbc/docs/test/query_wizard_connection.md | 2 +- .../docs/user/power_bi_service_support.md | 2 +- .../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 | 2 +- .../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 | 2 +- .../ITODBCHelper/it_odbc_helper.h | 2 +- .../ITODBCInfo/test_odbc_info.cpp | 4 +- .../ITODBCPagination/test_odbc_pagination.cpp | 8 ++-- .../TableauConnector/odfe_sql_odbc/README.md | 2 +- .../odfe_sql_odbc/manifest.xml | 2 +- .../src/UnitTests/UTRabbit/test_rabbit.cpp | 4 +- sql-odbc/src/installer/Resources/README.txt | 6 +-- .../src/installer/Resources/odfe_sql_odbc.tdc | 2 +- sql-odbc/src/odfesqlodbc/convert.c | 4 +- sql-odbc/src/odfesqlodbc/dlg_specific.c | 2 +- sql-odbc/src/odfesqlodbc/dlg_specific.h | 6 +-- sql-odbc/src/odfesqlodbc/dlg_wingui.c | 2 +- sql-odbc/src/odfesqlodbc/drvconn.c | 2 +- sql-odbc/src/odfesqlodbc/es_communication.cpp | 8 ++-- sql-odbc/src/odfesqlodbc/es_connection.h | 2 +- sql-odbc/src/odfesqlodbc/es_info.cpp | 2 +- sql-odbc/src/odfesqlodbc/es_odbc.h | 8 ++-- sql-odbc/src/odfesqlodbc/es_odbc.rc | 8 ++-- sql-odbc/src/odfesqlodbc/es_types.c | 6 +-- sql-odbc/src/odfesqlodbc/info.c | 8 ++-- sql-odbc/src/odfesqlodbc/loadlib.c | 2 +- sql-odbc/src/odfesqlodbc/loadlib.h | 2 +- sql-odbc/src/odfesqlodbc/odbcapi.c | 12 ++--- sql-odbc/src/odfesqlodbc/odbcapi30.c | 2 +- sql-odbc/src/odfesqlodbc/results.c | 2 +- sql-odbc/src/odfesqlodbc/setup.c | 2 +- sql-odbc/src/odfesqlodbc/statement.c | 2 +- sql-odbc/src/odfesqlodbc/version.h | 8 ++-- 48 files changed, 120 insertions(+), 117 deletions(-) diff --git a/sql-odbc/README.md b/sql-odbc/README.md index b5e19449355..29e5dee6df0 100644 --- a/sql-odbc/README.md +++ b/sql-odbc/README.md @@ -1,6 +1,6 @@ # Open Distro for Elasticsearch 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 Open Distro for Elasticsearch SQL support. ## Specifications diff --git a/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md b/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md index 41dbf888ba6..0ac9d3f935c 100644 --- a/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md +++ b/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md @@ -113,7 +113,7 @@ 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). diff --git a/sql-odbc/docs/dev/Pagination.md b/sql-odbc/docs/dev/Pagination.md index 10a937e39c7..b05018c854a 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 ## 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/opendistro-for-elasticsearch/sql/blob/master/docs/dev/Pagination.md). ## Data Flow

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 629b2b924d1..9aca123470f 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/kibana.yml b/sql-odbc/docs/dev/example_config_files/kibana.yml index db311013aed..48d2c9b677f 100644 --- a/sql-odbc/docs/dev/example_config_files/kibana.yml +++ b/sql-odbc/docs/dev/example_config_files/kibana.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/sequence_diagrams/SQLDriverConnect.txt b/sql-odbc/docs/dev/sequence_diagrams/SQLDriverConnect.txt index 0d8bc880ecd..411cc3d9e8d 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 9917433ac23..1c6a3df3cd9 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/test/excel_connection.md b/sql-odbc/docs/test/excel_connection.md index 8491085f9eb..9d34c7515ac 100644 --- a/sql-odbc/docs/test/excel_connection.md +++ b/sql-odbc/docs/test/excel_connection.md @@ -8,7 +8,7 @@ ## 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) diff --git a/sql-odbc/docs/test/query_wizard_connection.md b/sql-odbc/docs/test/query_wizard_connection.md index 3e22e82d012..e14a94b1252 100644 --- a/sql-odbc/docs/test/query_wizard_connection.md +++ b/sql-odbc/docs/test/query_wizard_connection.md @@ -15,7 +15,7 @@ -* 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**. diff --git a/sql-odbc/docs/user/power_bi_service_support.md b/sql-odbc/docs/user/power_bi_service_support.md index 46edbf01bd3..1f2a1d8e50d 100644 --- a/sql-odbc/docs/user/power_bi_service_support.md +++ b/sql-odbc/docs/user/power_bi_service_support.md @@ -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 Open Distro For Elasticsearch Data connector. * Click on **Publish** to publish the report on Power BI service. 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 30458e432da..872dec2d3a5 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 c5116456f07..61c2516cb0d 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 999efaca345..35c7dd5ddd8 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 283dd729375..03aedf8bb1b 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 fc928c15fa5..34428b88a13 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp @@ -92,7 +92,7 @@ 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_catalog_elas = "opensearch"; const std::string flights_table_name = "kibana_sample_data_flights"; const std::string flights_decimal_digits = "10"; const std::string flights_num_prec_radix = "2"; diff --git a/sql-odbc/src/IntegrationTests/ITODBCConnection/test_dsn.reg b/sql-odbc/src/IntegrationTests/ITODBCConnection/test_dsn.reg index 59b0f91c2bd..cfdfffaa7ed 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 f1b38ef215f..b514035af99 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 1779835f333..0693a207213 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 283dd729375..9868d27e066 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 39295583376..e47e326b7fa 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCDescriptors/test_odbc_descriptors.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCDescriptors/test_odbc_descriptors.cpp @@ -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, diff --git a/sql-odbc/src/IntegrationTests/ITODBCHelper/it_odbc_helper.h b/sql-odbc/src/IntegrationTests/ITODBCHelper/it_odbc_helper.h index f9835be378c..d05bba92c92 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 0e8808e4d90..21dc7a16a24 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 5acbb02c1ed..25d0259174c 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCPagination/test_odbc_pagination.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCPagination/test_odbc_pagination.cpp @@ -91,12 +91,12 @@ TEST_F(TestPagination, EnablePagination) { //Total number of rows in kibana_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/TableauConnector/odfe_sql_odbc/README.md b/sql-odbc/src/TableauConnector/odfe_sql_odbc/README.md index 6498f886a5a..c1a8a8a9944 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 0493b5c2866..f835f545617 100644 --- a/sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml +++ b/sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml @@ -37,7 +37,7 @@ diff --git a/sql-odbc/src/UnitTests/UTRabbit/test_rabbit.cpp b/sql-odbc/src/UnitTests/UTRabbit/test_rabbit.cpp index 9a3647b01a0..7fb6bf3edf7 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/Resources/README.txt b/sql-odbc/src/installer/Resources/README.txt index c311b0cbbc8..30ef5eb42a2 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 diff --git a/sql-odbc/src/installer/Resources/odfe_sql_odbc.tdc b/sql-odbc/src/installer/Resources/odfe_sql_odbc.tdc index 8603f7149ed..7c36b1b72c4 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/odfesqlodbc/convert.c b/sql-odbc/src/odfesqlodbc/convert.c index 7a03f6fa73f..2afed1e45f1 100644 --- a/sql-odbc/src/odfesqlodbc/convert.c +++ b/sql-odbc/src/odfesqlodbc/convert.c @@ -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 @@ -1344,7 +1344,7 @@ 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 diff --git a/sql-odbc/src/odfesqlodbc/dlg_specific.c b/sql-odbc/src/odfesqlodbc/dlg_specific.c index 5578bb64efd..cd7cb50109c 100644 --- a/sql-odbc/src/odfesqlodbc/dlg_specific.c +++ b/sql-odbc/src/odfesqlodbc/dlg_specific.c @@ -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;", diff --git a/sql-odbc/src/odfesqlodbc/dlg_specific.h b/sql-odbc/src/odfesqlodbc/dlg_specific.h index 02af631ae2f..6ac9f8ef77f 100644 --- a/sql-odbc/src/odfesqlodbc/dlg_specific.h +++ b/sql-odbc/src/odfesqlodbc/dlg_specific.h @@ -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 "" diff --git a/sql-odbc/src/odfesqlodbc/dlg_wingui.c b/sql-odbc/src/odfesqlodbc/dlg_wingui.c index 62f76abe0a9..076fd4ecbd1 100644 --- a/sql-odbc/src/odfesqlodbc/dlg_wingui.c +++ b/sql-odbc/src/odfesqlodbc/dlg_wingui.c @@ -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); diff --git a/sql-odbc/src/odfesqlodbc/drvconn.c b/sql-odbc/src/odfesqlodbc/drvconn.c index b0008459027..de4f65ba180 100644 --- a/sql-odbc/src/odfesqlodbc/drvconn.c +++ b/sql-odbc/src/odfesqlodbc/drvconn.c @@ -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); diff --git a/sql-odbc/src/odfesqlodbc/es_communication.cpp b/sql-odbc/src/odfesqlodbc/es_communication.cpp index e40f170c792..e21f0f92713 100644 --- a/sql-odbc/src/odfesqlodbc/es_communication.cpp +++ b/sql-odbc/src/odfesqlodbc/es_communication.cpp @@ -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] "; 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\" }," @@ -479,7 +479,7 @@ bool ESCommunication::EstablishConnection() { 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"); std::shared_ptr< Aws::Http::HttpResponse > response = diff --git a/sql-odbc/src/odfesqlodbc/es_connection.h b/sql-odbc/src/odfesqlodbc/es_connection.h index b523a126f79..4f8b34bd247 100644 --- a/sql-odbc/src/odfesqlodbc/es_connection.h +++ b/sql-odbc/src/odfesqlodbc/es_connection.h @@ -283,7 +283,7 @@ 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 es_version[MAX_INFO_STRING]; /* Version of OpenSearch driver * we're connected to - * DJP 25-1-2001 */ Int2 es_version_major; diff --git a/sql-odbc/src/odfesqlodbc/es_info.cpp b/sql-odbc/src/odfesqlodbc/es_info.cpp index 648a0d967f7..de1b295d826 100644 --- a/sql-odbc/src/odfesqlodbc/es_info.cpp +++ b/sql-odbc/src/odfesqlodbc/es_info.cpp @@ -25,7 +25,7 @@ #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' } diff --git a/sql-odbc/src/odfesqlodbc/es_odbc.h b/sql-odbc/src/odfesqlodbc/es_odbc.h index d5dff8e683e..8e207b4a4e3 100644 --- a/sql-odbc/src/odfesqlodbc/es_odbc.h +++ b/sql-odbc/src/odfesqlodbc/es_odbc.h @@ -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 diff --git a/sql-odbc/src/odfesqlodbc/es_odbc.rc b/sql-odbc/src/odfesqlodbc/es_odbc.rc index 6bf66d9af15..f559357b5ed 100644 --- a/sql-odbc/src/odfesqlodbc/es_odbc.rc +++ b/sql-odbc/src/odfesqlodbc/es_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 @@ -180,15 +180,15 @@ 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 "FileDescription", "OpenSearch ODBC Driver (English)" VALUE "FileVersion", ES_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 "ProductName", "OpenSearch" VALUE "ProductVersion", ES_ODBC_VERSION END END diff --git a/sql-odbc/src/odfesqlodbc/es_types.c b/sql-odbc/src/odfesqlodbc/es_types.c index d6da15cac9e..a5cb8b5f660 100644 --- a/sql-odbc/src/odfesqlodbc/es_types.c +++ b/sql-odbc/src/odfesqlodbc/es_types.c @@ -189,7 +189,7 @@ 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); @@ -513,7 +513,7 @@ const char *estype_attr_to_name(const ConnectionClass *conn, OID type, } } -Int4 /* Elasticsearch restriction */ +Int4 /* OpenSearch restriction */ estype_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); @@ -1133,7 +1133,7 @@ const char *estype_to_name(const StatementClass *stmt, OID type, int col, * 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 */ +Int4 /* OpenSearch restriction */ estype_column_size(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as) { int atttypmod, adtsize_or_longestlen; diff --git a/sql-odbc/src/odfesqlodbc/info.c b/sql-odbc/src/odfesqlodbc/info.c index 45e1bad0e32..ffc20acdaaf 100644 --- a/sql-odbc/src/odfesqlodbc/info.c +++ b/sql-odbc/src/odfesqlodbc/info.c @@ -192,7 +192,7 @@ 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 */ @@ -218,7 +218,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 */ @@ -453,7 +453,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 +577,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; diff --git a/sql-odbc/src/odfesqlodbc/loadlib.c b/sql-odbc/src/odfesqlodbc/loadlib.c index 628681aa9ca..2e5631d3259 100644 --- a/sql-odbc/src/odfesqlodbc/loadlib.c +++ b/sql-odbc/src/odfesqlodbc/loadlib.c @@ -155,7 +155,7 @@ static FARPROC WINAPI DliErrorHook(unsigned dliNotify, PDelayLoadInfo pdli) { return (FARPROC)hmodule; } -void AlreadyLoadedElasticsearchodbc(void) { +void AlreadyLoadedOpenSearchodbc(void) { loaded_elasticodbc = TRUE; } diff --git a/sql-odbc/src/odfesqlodbc/loadlib.h b/sql-odbc/src/odfesqlodbc/loadlib.h index 718e78140f8..4890f8ef338 100644 --- a/sql-odbc/src/odfesqlodbc/loadlib.h +++ b/sql-odbc/src/odfesqlodbc/loadlib.h @@ -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/odbcapi.c b/sql-odbc/src/odfesqlodbc/odbcapi.c index cdbf714719c..ffa0032710e 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi.c @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } diff --git a/sql-odbc/src/odfesqlodbc/odbcapi30.c b/sql-odbc/src/odfesqlodbc/odbcapi30.c index 0cde75ea31b..fd9a323b240 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi30.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi30.c @@ -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; } diff --git a/sql-odbc/src/odfesqlodbc/results.c b/sql-odbc/src/odfesqlodbc/results.c index bc37adae145..46618d82938 100644 --- a/sql-odbc/src/odfesqlodbc/results.c +++ b/sql-odbc/src/odfesqlodbc/results.c @@ -968,7 +968,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; diff --git a/sql-odbc/src/odfesqlodbc/setup.c b/sql-odbc/src/odfesqlodbc/setup.c index 0f9cc0bc51d..2ec388f987d 100644 --- a/sql-odbc/src/odfesqlodbc/setup.c +++ b/sql-odbc/src/odfesqlodbc/setup.c @@ -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 9e6e8e6334e..5287cdae762 100644 --- a/sql-odbc/src/odfesqlodbc/statement.c +++ b/sql-odbc/src/odfesqlodbc/statement.c @@ -1168,7 +1168,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; diff --git a/sql-odbc/src/odfesqlodbc/version.h b/sql-odbc/src/odfesqlodbc/version.h index fa68acea22e..07287bdc4f1 100644 --- a/sql-odbc/src/odfesqlodbc/version.h +++ b/sql-odbc/src/odfesqlodbc/version.h @@ -23,11 +23,11 @@ */ #ifdef ES_ODBC_VERSION -#ifndef ELASTICSEARCHDRIVERVERSION -#define ELASTICSEARCHDRIVERVERSION ES_ODBC_VERSION +#ifndef OPENSEARCHDRIVERVERSION +#define OPENSEARCHDRIVERVERSION ES_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 From 5b2193f08a4f38ade9d1ee7dafd0910734ecf025 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 14:37:40 -0700 Subject: [PATCH 02/36] Bump plugin version to 1.15 --- .github/workflows/sql-odbc-release-workflow.yml | 2 +- .github/workflows/sql-odbc-rename-and-release-workflow.yml | 2 +- sql-odbc/src/CMakeLists.txt | 4 ++-- sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml | 2 +- sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/manifest.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/sql-odbc-release-workflow.yml b/.github/workflows/sql-odbc-release-workflow.yml index fb0026b46f0..2d70355bd89 100644 --- a/.github/workflows/sql-odbc-release-workflow.yml +++ b/.github/workflows/sql-odbc-release-workflow.yml @@ -12,7 +12,7 @@ env: 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 + OD_VERSION: 1.15.0.0 jobs: build-mac: diff --git a/.github/workflows/sql-odbc-rename-and-release-workflow.yml b/.github/workflows/sql-odbc-rename-and-release-workflow.yml index 1ce207491cf..775b498b5ac 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: diff --git a/sql-odbc/src/CMakeLists.txt b/sql-odbc/src/CMakeLists.txt index 97f7fde5d23..de9d50d3392 100644 --- a/sql-odbc/src/CMakeLists.txt +++ b/sql-odbc/src/CMakeLists.txt @@ -78,8 +78,8 @@ 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") +set(DRIVER_PACKAGE_VERSION "1.15.0.0") +set(DRIVER_PACKAGE_VERSION_COMMA_SEPARATED "1,15,0,0") add_compile_definitions( ES_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} ) diff --git a/sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml b/sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml index f835f545617..72e96108d96 100644 --- a/sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml +++ b/sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml @@ -1,6 +1,6 @@ - + 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 8ba3c4a33a7..f58e8eccf2e 100644 --- a/sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/manifest.xml +++ b/sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/manifest.xml @@ -1,6 +1,6 @@ - + From 5c0f4311c2d33eeb3c5c354d1c4392a7965c8d60 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 15:01:07 -0700 Subject: [PATCH 03/36] Rename es_api30 --- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 2 +- sql-odbc/src/odfesqlodbc/{es_api30.c => opensearch_api30.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename sql-odbc/src/odfesqlodbc/{es_api30.c => opensearch_api30.c} (100%) diff --git a/sql-odbc/src/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index 2910d4cf32b..0a82365b929 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -22,7 +22,7 @@ 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 + qresult.c odbcapi30w.c opensearch_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 diff --git a/sql-odbc/src/odfesqlodbc/es_api30.c b/sql-odbc/src/odfesqlodbc/opensearch_api30.c similarity index 100% rename from sql-odbc/src/odfesqlodbc/es_api30.c rename to sql-odbc/src/odfesqlodbc/opensearch_api30.c From 0288ff16aada1b2317111c769ce3ee4874e7b3d8 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 15:09:17 -0700 Subject: [PATCH 04/36] Rename es_apifunc --- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 4 ++-- sql-odbc/src/odfesqlodbc/bind.c | 2 +- sql-odbc/src/odfesqlodbc/columninfo.c | 5 +++-- sql-odbc/src/odfesqlodbc/connection.c | 2 +- sql-odbc/src/odfesqlodbc/convert.c | 2 +- sql-odbc/src/odfesqlodbc/descriptor.c | 2 +- sql-odbc/src/odfesqlodbc/dlg_specific.c | 2 +- sql-odbc/src/odfesqlodbc/drvconn.c | 2 +- sql-odbc/src/odfesqlodbc/drvconn.h | 2 +- sql-odbc/src/odfesqlodbc/environ.c | 2 +- sql-odbc/src/odfesqlodbc/es_connection.cpp | 2 +- sql-odbc/src/odfesqlodbc/es_driver_connect.cpp | 2 +- sql-odbc/src/odfesqlodbc/es_info.h | 2 +- sql-odbc/src/odfesqlodbc/es_statement.cpp | 2 +- sql-odbc/src/odfesqlodbc/execute.c | 2 +- sql-odbc/src/odfesqlodbc/info.c | 7 ++----- sql-odbc/src/odfesqlodbc/multibyte.c | 6 ++++-- sql-odbc/src/odfesqlodbc/odbcapi.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapi30.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapi30w.c | 6 +++--- sql-odbc/src/odfesqlodbc/odbcapiw.c | 2 +- sql-odbc/src/odfesqlodbc/opensearch_api30.c | 2 +- .../{es_apifunc.h => opensearch_apifunc.h} | 6 +++--- sql-odbc/src/odfesqlodbc/options.c | 2 +- sql-odbc/src/odfesqlodbc/parse.c | 12 +++++------- sql-odbc/src/odfesqlodbc/results.c | 4 ++-- sql-odbc/src/odfesqlodbc/statement.c | 2 +- 27 files changed, 43 insertions(+), 45 deletions(-) rename sql-odbc/src/odfesqlodbc/{es_apifunc.h => opensearch_apifunc.h} (99%) diff --git a/sql-odbc/src/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index 0a82365b929..e9835fc501a 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -35,12 +35,12 @@ 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 + environ.h opensearch_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 resource.h statement.h tuple.h unicode_support.h - es_apifunc.h es_odbc.h es_semaphore.h qresult.h + opensearch_apifunc.h es_odbc.h es_semaphore.h qresult.h version.h win_setup.h es_result_queue.h ) diff --git a/sql-odbc/src/odfesqlodbc/bind.c b/sql-odbc/src/odfesqlodbc/bind.c index a4795203c11..79f498e9bd3 100644 --- a/sql-odbc/src/odfesqlodbc/bind.c +++ b/sql-odbc/src/odfesqlodbc/bind.c @@ -21,10 +21,10 @@ #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 "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/columninfo.c b/sql-odbc/src/odfesqlodbc/columninfo.c index 5512a628b72..db9838ff20f 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 "es_types.h" +#include "opensearch_apifunc.h" ColumnInfoClass *CI_Constructor(void) { ColumnInfoClass *rv; diff --git a/sql-odbc/src/odfesqlodbc/connection.c b/sql-odbc/src/odfesqlodbc/connection.c index 4c151ac3b60..33a454eb05f 100644 --- a/sql-odbc/src/odfesqlodbc/connection.c +++ b/sql-odbc/src/odfesqlodbc/connection.c @@ -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 "qresult.h" #include "statement.h" #ifndef WIN32 diff --git a/sql-odbc/src/odfesqlodbc/convert.c b/sql-odbc/src/odfesqlodbc/convert.c index 2afed1e45f1..c251a2d5b34 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_apifunc.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/descriptor.c b/sql-odbc/src/odfesqlodbc/descriptor.c index 7f3902473dd..01122766959 100644 --- a/sql-odbc/src/odfesqlodbc/descriptor.c +++ b/sql-odbc/src/odfesqlodbc/descriptor.c @@ -21,9 +21,9 @@ #include #include "environ.h" -#include "es_apifunc.h" #include "es_connection.h" #include "misc.h" +#include "opensearch_apifunc.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/dlg_specific.c b/sql-odbc/src/odfesqlodbc/dlg_specific.c index cd7cb50109c..4b4879f5f8d 100644 --- a/sql-odbc/src/odfesqlodbc/dlg_specific.c +++ b/sql-odbc/src/odfesqlodbc/dlg_specific.c @@ -18,8 +18,8 @@ #include -#include "es_apifunc.h" #include "misc.h" +#include "opensearch_apifunc.h" #define NULL_IF_NULL(a) ((a) ? ((const char *)(a)) : "(null)") diff --git a/sql-odbc/src/odfesqlodbc/drvconn.c b/sql-odbc/src/odfesqlodbc/drvconn.c index de4f65ba180..f044d4b670d 100644 --- a/sql-odbc/src/odfesqlodbc/drvconn.c +++ b/sql-odbc/src/odfesqlodbc/drvconn.c @@ -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, diff --git a/sql-odbc/src/odfesqlodbc/drvconn.h b/sql-odbc/src/odfesqlodbc/drvconn.h index f85ebe6f59a..00fdf275bd6 100644 --- a/sql-odbc/src/odfesqlodbc/drvconn.h +++ b/sql-odbc/src/odfesqlodbc/drvconn.h @@ -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 f5e28df0d9c..468d4d7d0b2 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 "statement.h" #ifdef WIN32 #include diff --git a/sql-odbc/src/odfesqlodbc/es_connection.cpp b/sql-odbc/src/odfesqlodbc/es_connection.cpp index fb13d3131ff..e82c4d96aa9 100644 --- a/sql-odbc/src/odfesqlodbc/es_connection.cpp +++ b/sql-odbc/src/odfesqlodbc/es_connection.cpp @@ -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 "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/es_driver_connect.cpp b/sql-odbc/src/odfesqlodbc/es_driver_connect.cpp index cb91984f7cd..8ece2af1bea 100644 --- a/sql-odbc/src/odfesqlodbc/es_driver_connect.cpp +++ b/sql-odbc/src/odfesqlodbc/es_driver_connect.cpp @@ -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, diff --git a/sql-odbc/src/odfesqlodbc/es_info.h b/sql-odbc/src/odfesqlodbc/es_info.h index 17db5847ccd..032d1408926 100644 --- a/sql-odbc/src/odfesqlodbc/es_info.h +++ b/sql-odbc/src/odfesqlodbc/es_info.h @@ -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 "qresult.h" #include "statement.h" #include "tuple.h" diff --git a/sql-odbc/src/odfesqlodbc/es_statement.cpp b/sql-odbc/src/odfesqlodbc/es_statement.cpp index afedd5e066d..ac21223199e 100644 --- a/sql-odbc/src/odfesqlodbc/es_statement.cpp +++ b/sql-odbc/src/odfesqlodbc/es_statement.cpp @@ -17,9 +17,9 @@ #include "es_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 "statement.h" extern "C" void *common_cs; diff --git a/sql-odbc/src/odfesqlodbc/execute.c b/sql-odbc/src/odfesqlodbc/execute.c index 5d14b6dd65b..e0b4f197b39 100644 --- a/sql-odbc/src/odfesqlodbc/execute.c +++ b/sql-odbc/src/odfesqlodbc/execute.c @@ -27,10 +27,10 @@ #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_apifunc.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/info.c b/sql-odbc/src/odfesqlodbc/info.c index ffc20acdaaf..b4fb519ffa0 100644 --- a/sql-odbc/src/odfesqlodbc/info.c +++ b/sql-odbc/src/odfesqlodbc/info.c @@ -24,19 +24,16 @@ #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 "misc.h" #include "multibyte.h" +#include "opensearch_apifunc.h" #include "qresult.h" #include "statement.h" #include "tuple.h" diff --git a/sql-odbc/src/odfesqlodbc/multibyte.c b/sql-odbc/src/odfesqlodbc/multibyte.c index 9199f84a497..eea26e0b02b 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" #ifndef WIN32 #include #endif diff --git a/sql-odbc/src/odfesqlodbc/odbcapi.c b/sql-odbc/src/odfesqlodbc/odbcapi.c index ffa0032710e..681df8dfceb 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi.c @@ -18,7 +18,6 @@ #include #include "environ.h" -#include "es_apifunc.h" #include "es_connection.h" #include "es_driver_connect.h" #include "es_info.h" @@ -26,6 +25,7 @@ #include "es_statement.h" #include "loadlib.h" #include "misc.h" +#include "opensearch_apifunc.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/odbcapi30.c b/sql-odbc/src/odfesqlodbc/odbcapi30.c index fd9a323b240..4264533bf81 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 "misc.h" +#include "opensearch_apifunc.h" #include "statement.h" /* SQLAllocConnect/SQLAllocEnv/SQLAllocStmt -> SQLAllocHandle */ diff --git a/sql-odbc/src/odfesqlodbc/odbcapi30w.c b/sql-odbc/src/odfesqlodbc/odbcapi30w.c index b0731eb6961..baf098c5612 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 "es_odbc.h" #include "misc.h" +#include "opensearch_apifunc.h" #include "statement.h" +#include "unicode_support.h" RETCODE SQL_API SQLGetStmtAttrW(SQLHSTMT hstmt, SQLINTEGER fAttribute, PTR rgbValue, SQLINTEGER cbValueMax, diff --git a/sql-odbc/src/odfesqlodbc/odbcapiw.c b/sql-odbc/src/odfesqlodbc/odbcapiw.c index 9a7e5d66dbc..6f7cf79eb55 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_apifunc.h" #include "statement.h" #include "unicode_support.h" diff --git a/sql-odbc/src/odfesqlodbc/opensearch_api30.c b/sql-odbc/src/odfesqlodbc/opensearch_api30.c index cd2571506de..cac67daf6f5 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_api30.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_api30.c @@ -20,11 +20,11 @@ #include "descriptor.h" #include "dlg_specific.h" #include "environ.h" -#include "es_apifunc.h" #include "es_connection.h" #include "es_odbc.h" #include "loadlib.h" #include "misc.h" +#include "opensearch_apifunc.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/es_apifunc.h b/sql-odbc/src/odfesqlodbc/opensearch_apifunc.h similarity index 99% rename from sql-odbc/src/odfesqlodbc/es_apifunc.h rename to sql-odbc/src/odfesqlodbc/opensearch_apifunc.h index 8a248abf4a7..32b350ab378 100644 --- a/sql-odbc/src/odfesqlodbc/es_apifunc.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_apifunc.h @@ -14,8 +14,8 @@ * */ -#ifndef _ES_API_FUNC_H__ -#define _ES_API_FUNC_H__ +#ifndef _OPENSEARCH_API_FUNC_H__ +#define _OPENSEARCH_API_FUNC_H__ #include #include @@ -240,4 +240,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/options.c b/sql-odbc/src/odfesqlodbc/options.c index 2210fdf784f..aefe397ee1b 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 "misc.h" +#include "opensearch_apifunc.h" #include "qresult.h" #include "statement.h" #include "unicode_support.h" diff --git a/sql-odbc/src/odfesqlodbc/parse.c b/sql-odbc/src/odfesqlodbc/parse.c index 4fde3f0b4f1..acad84cdbe2 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 "es_odbc.h" +#include "es_types.h" #include "misc.h" #include "multibyte.h" +#include "opensearch_apifunc.h" +#include "qresult.h" +#include "statement.h" Int4 FI_precision(const FIELD_INFO *fi) { OID ftype; diff --git a/sql-odbc/src/odfesqlodbc/results.c b/sql-odbc/src/odfesqlodbc/results.c index 46618d82938..d41a6910bea 100644 --- a/sql-odbc/src/odfesqlodbc/results.c +++ b/sql-odbc/src/odfesqlodbc/results.c @@ -22,14 +22,14 @@ #include "convert.h" #include "dlg_specific.h" #include "environ.h" -#include "es_apifunc.h" #include "es_connection.h" #include "es_odbc.h" +#include "es_statement.h" #include "es_types.h" #include "misc.h" +#include "opensearch_apifunc.h" #include "qresult.h" #include "statement.h" -#include "es_statement.h" /* Helper macro */ #define getEffectiveOid(conn, fi) \ diff --git a/sql-odbc/src/odfesqlodbc/statement.c b/sql-odbc/src/odfesqlodbc/statement.c index 5287cdae762..cc3d49cbf68 100644 --- a/sql-odbc/src/odfesqlodbc/statement.c +++ b/sql-odbc/src/odfesqlodbc/statement.c @@ -30,7 +30,7 @@ #include #include -#include "es_apifunc.h" +#include "opensearch_apifunc.h" #include "es_helper.h" #include "es_statement.h" // clang-format on From 3bbe24f0b47a69e313e2d612261955179ec823f4 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 15:17:47 -0700 Subject: [PATCH 05/36] Rename es_communication --- .../PTODBCInfo/performance_odbc_info.cpp | 4 +- sql-odbc/src/UnitTests/UTConn/test_conn.cpp | 14 ++-- .../UnitTests/UTConn/test_query_execution.cpp | 16 ++--- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 4 +- sql-odbc/src/odfesqlodbc/dlg_wingui.c | 2 +- sql-odbc/src/odfesqlodbc/es_helper.cpp | 32 ++++----- ...ation.cpp => opensearch_communication.cpp} | 67 ++++++++++--------- ...unication.h => opensearch_communication.h} | 10 +-- sql-odbc/src/odfesqlodbc/setup.c | 2 +- 9 files changed, 76 insertions(+), 75 deletions(-) rename sql-odbc/src/odfesqlodbc/{es_communication.cpp => opensearch_communication.cpp} (94%) rename sql-odbc/src/odfesqlodbc/{es_communication.h => opensearch_communication.h} (95%) diff --git a/sql-odbc/src/PerformanceTests/PTODBCInfo/performance_odbc_info.cpp b/sql-odbc/src/PerformanceTests/PTODBCInfo/performance_odbc_info.cpp index b5755ea9cc4..b3e924928db 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,7 +78,7 @@ runtime_options rt_opts = []() { void GetVersionInfoString(std::string& version_info) { // Connect to DB - ESCommunication es_comm; + OpenSearchCommunication es_comm; es_comm.ConnectionOptions(rt_opts, false, 0, 0); ASSERT_TRUE(es_comm.ConnectDBStart()); diff --git a/sql-odbc/src/UnitTests/UTConn/test_conn.cpp b/sql-odbc/src/UnitTests/UTConn/test_conn.cpp index 69ea55e612a..7790d11b689 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; @@ -45,13 +45,13 @@ runtime_options missing_opt_val = {{"", "", "1", "0"}, {use_ssl, false, "", "", "", ""}}; TEST(TestESConnConnectionOptions, ValidParameters) { - ESCommunication conn; + OpenSearchCommunication conn; EXPECT_EQ(true, conn.ConnectionOptions(valid_opt_val, 1, 1, valid_option_count)); } TEST(TestESConnConnectionOptions, MissingParameters) { - ESCommunication conn; + OpenSearchCommunication conn; EXPECT_EQ(false, conn.ConnectionOptions(missing_opt_val, 1, 1, missing_option_count)); } @@ -72,7 +72,7 @@ class TestESConnConnectDBStart : public testing::Test { // cleanup any pending stuff, but no exceptions allowed } - ESCommunication m_conn; + OpenSearchCommunication m_conn; }; TEST_F(TestESConnConnectDBStart, ValidParameters) { @@ -97,7 +97,7 @@ TEST_F(TestESConnConnectDBStart, MissingParameters) { } TEST(TestESConnDropDBConnection, InvalidParameters) { - ESCommunication conn; + OpenSearchCommunication conn; ASSERT_EQ(CONNECTION_BAD, conn.GetConnectionStatus()); ASSERT_TRUE( conn.ConnectionOptions(invalid_opt_val, 1, 1, invalid_option_count)); @@ -108,7 +108,7 @@ TEST(TestESConnDropDBConnection, InvalidParameters) { } TEST(TestESConnDropDBConnection, MissingParameters) { - ESCommunication conn; + OpenSearchCommunication conn; ASSERT_EQ(CONNECTION_BAD, conn.GetConnectionStatus()); ASSERT_NE(true, conn.ConnectionOptions(missing_opt_val, 1, 1, missing_option_count)); @@ -119,7 +119,7 @@ TEST(TestESConnDropDBConnection, MissingParameters) { } TEST(TestESConnDropDBConnection, ValidParameters) { - ESCommunication conn; + 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 e2af4d40a0f..bca210ece2e 100644 --- a/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp +++ b/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp @@ -17,7 +17,7 @@ // clang-format off #include "pch.h" #include "unit_test_helper.h" -#include "es_communication.h" +#include "opensearch_communication.h" #include "es_helper.h" // clang-format on @@ -44,7 +44,7 @@ runtime_options valid_conn_opt_val = { {use_ssl, false, "", "", "", ""}}; TEST(TestESExecDirect, ValidQuery) { - ESCommunication conn; + OpenSearchCommunication conn; ASSERT_TRUE(conn.ConnectionOptions(valid_conn_opt_val, false, 0, 0)); ASSERT_TRUE(conn.ConnectDBStart()); EXPECT_EQ(EXECUTION_SUCCESS, @@ -52,7 +52,7 @@ TEST(TestESExecDirect, ValidQuery) { } TEST(TestESExecDirect, MissingQuery) { - ESCommunication conn; + 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())); @@ -66,7 +66,7 @@ TEST(TestESExecDirect, MissingConnection) { // Conn::ExecDirect TEST(TestConnExecDirect, ValidQueryAllColumns) { - ESCommunication conn; + OpenSearchCommunication conn; ASSERT_TRUE(conn.ConnectionOptions(valid_conn_opt_val, false, 0, 0)); ASSERT_TRUE(conn.ConnectDBStart()); @@ -79,7 +79,7 @@ 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()); @@ -92,7 +92,7 @@ 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()); @@ -104,7 +104,7 @@ TEST(TestConnExecDirect, InvalidQuery) { // Conn::PopResult TEST(TestConnPopResult, PopEmptyQueue) { - ESCommunication conn; + OpenSearchCommunication conn; ASSERT_TRUE(conn.ConnectionOptions(valid_conn_opt_val, false, 0, 0)); ASSERT_TRUE(conn.ConnectDBStart()); @@ -113,7 +113,7 @@ TEST(TestConnPopResult, PopEmptyQueue) { } TEST(TestConnPopResult, PopTwoQueryResults) { - ESCommunication conn; + OpenSearchCommunication conn; ASSERT_TRUE(conn.ConnectionOptions(valid_conn_opt_val, false, 0, 0)); ASSERT_TRUE(conn.ConnectDBStart()); diff --git a/sql-odbc/src/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index e9835fc501a..683cca3f33f 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -23,7 +23,7 @@ set( SOURCE_FILES misc.c multibyte.c mylog.c tuple.c parse.c results.c statement.c odbcapi30.c qresult.c odbcapi30w.c opensearch_api30.c es_types.c - es_utility.cpp es_communication.cpp es_connection.cpp es_odbc.c + es_utility.cpp opensearch_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 @@ -35,7 +35,7 @@ endif() set( HEADER_FILES bind.h catfunc.h columninfo.h convert.h descriptor.h dlg_specific.h drvconn.h - environ.h opensearch_apifunc.h es_communication.h es_parse_result.h + environ.h opensearch_apifunc.h opensearch_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 diff --git a/sql-odbc/src/odfesqlodbc/dlg_wingui.c b/sql-odbc/src/odfesqlodbc/dlg_wingui.c index 076fd4ecbd1..75414f63cc8 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" diff --git a/sql-odbc/src/odfesqlodbc/es_helper.cpp b/sql-odbc/src/odfesqlodbc/es_helper.cpp index 529ebfe9584..d1a8a5eb474 100644 --- a/sql-odbc/src/odfesqlodbc/es_helper.cpp +++ b/sql-odbc/src/odfesqlodbc/es_helper.cpp @@ -20,12 +20,12 @@ #include #include -#include "es_communication.h" +#include "opensearch_communication.h" void* ESConnectDBParams(runtime_options& rt_opts, int expand_dbname, unsigned int option_count) { // Initialize Connection - ESCommunication* conn = static_cast< ESCommunication* >(InitializeESConn()); + OpenSearchCommunication* conn = static_cast< OpenSearchCommunication* >(InitializeESConn()); if (!conn) return NULL; @@ -48,66 +48,66 @@ void* ESConnectDBParams(runtime_options& rt_opts, int expand_dbname, ConnStatusType ESStatus(void* es_conn) { return es_conn - ? static_cast< ESCommunication* >(es_conn)->GetConnectionStatus() + ? static_cast< OpenSearchCommunication* >(es_conn)->GetConnectionStatus() : ConnStatusType::CONNECTION_BAD; } std::string GetErrorMsg(void* es_conn) { - return es_conn ? static_cast< ESCommunication* >(es_conn)->GetErrorMessage() + return es_conn ? static_cast< OpenSearchCommunication* >(es_conn)->GetErrorMessage() : NULL; } ConnErrorType GetErrorType(void* es_conn) { - return es_conn ? static_cast< ESCommunication* >(es_conn)->GetErrorType() + return es_conn ? static_cast< OpenSearchCommunication* >(es_conn)->GetErrorType() : ConnErrorType::CONN_ERROR_SUCCESS; } std::string GetServerVersion(void* es_conn) { return es_conn - ? static_cast< ESCommunication* >(es_conn)->GetServerVersion() + ? static_cast< OpenSearchCommunication* >(es_conn)->GetServerVersion() : ""; } std::string GetClusterName(void* es_conn) { - return es_conn ? static_cast< ESCommunication* >(es_conn)->GetClusterName() + return es_conn ? static_cast< OpenSearchCommunication* >(es_conn)->GetClusterName() : ""; } void* InitializeESConn() { - return new ESCommunication(); + 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( + ? static_cast< OpenSearchCommunication* >(es_conn)->ExecDirect( statement, fetch_size) : -1; } void ESSendCursorQueries(void* es_conn, const char* cursor) { - static_cast< ESCommunication* >(es_conn)->SendCursorQueries(cursor); + static_cast< OpenSearchCommunication* >(es_conn)->SendCursorQueries(cursor); } ESResult* ESGetResult(void* es_conn) { - return es_conn ? static_cast< ESCommunication* >(es_conn)->PopResult() + return es_conn ? static_cast< OpenSearchCommunication* >(es_conn)->PopResult() : NULL; } std::string ESGetClientEncoding(void* es_conn) { return es_conn - ? static_cast< ESCommunication* >(es_conn)->GetClientEncoding() + ? static_cast< OpenSearchCommunication* >(es_conn)->GetClientEncoding() : ""; } bool ESSetClientEncoding(void* es_conn, std::string& encoding) { return es_conn - ? static_cast< ESCommunication* >(es_conn)->SetClientEncoding( + ? static_cast< OpenSearchCommunication* >(es_conn)->SetClientEncoding( encoding) : false; } void ESDisconnect(void* es_conn) { - delete static_cast< ESCommunication* >(es_conn); + delete static_cast< OpenSearchCommunication* >(es_conn); } void ESClearResult(ESResult* es_result) { @@ -115,12 +115,12 @@ void ESClearResult(ESResult* es_result) { } void ESStopRetrieval(void* es_conn) { - static_cast< ESCommunication* >(es_conn)->StopResultRetrieval(); + static_cast< OpenSearchCommunication* >(es_conn)->StopResultRetrieval(); } std::vector< std::string > ESGetColumnsWithSelectQuery( void* es_conn, const std::string table_name) { - return static_cast< ESCommunication* >(es_conn)->GetColumnsWithSelectQuery( + return static_cast< OpenSearchCommunication* >(es_conn)->GetColumnsWithSelectQuery( table_name); } diff --git a/sql-odbc/src/odfesqlodbc/es_communication.cpp b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp similarity index 94% rename from sql-odbc/src/odfesqlodbc/es_communication.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_communication.cpp index e21f0f92713..7025ad04d20 100644 --- a/sql-odbc/src/odfesqlodbc/es_communication.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp @@ -14,7 +14,7 @@ * */ -#include "es_communication.h" +#include "opensearch_communication.h" // odfesqlodbc needs to be included before mylog, otherwise mylog will generate // compiler warnings @@ -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,7 +131,7 @@ void ESCommunication::AwsHttpResponseToString( output.assign(buf.data(), avail); } -void ESCommunication::PrepareCursorResult(ESResult& es_result) { +void OpenSearchCommunication::PrepareCursorResult(ESResult& es_result) { // Prepare document and validate result try { LogMsg(ES_DEBUG, "Parsing result JSON with cursor."); @@ -147,7 +147,7 @@ void ESCommunication::PrepareCursorResult(ESResult& es_result) { } } -std::shared_ptr< ErrorDetails > ESCommunication::ParseErrorResponse( +std::shared_ptr< ErrorDetails > OpenSearchCommunication::ParseErrorResponse( ESResult& es_result) { // Prepare document and validate schema try { @@ -173,7 +173,7 @@ std::shared_ptr< ErrorDetails > ESCommunication::ParseErrorResponse( } } -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,13 +184,13 @@ 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(ESResult& es_result) { // Prepare document and validate schema try { LogMsg(ES_DEBUG, "Parsing result JSON with schema."); @@ -205,7 +205,7 @@ void ESCommunication::GetJsonSchema(ESResult& es_result) { } } -ESCommunication::ESCommunication() +OpenSearchCommunication::OpenSearchCommunication() #ifdef __APPLE__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wreorder" @@ -225,12 +225,12 @@ ESCommunication::ESCommunication() Aws::InitAPI(m_options); } -ESCommunication::~ESCommunication() { +OpenSearchCommunication::~OpenSearchCommunication() { LogMsg(ES_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 +243,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,11 +257,11 @@ bool ESCommunication::ConnectionOptions(runtime_options& rt_opts, return CheckConnectionOptions(); } -bool ESCommunication::ConnectionOptions2() { +bool OpenSearchCommunication::ConnectionOptions2() { return true; } -bool ESCommunication::ConnectDBStart() { +bool OpenSearchCommunication::ConnectDBStart() { LogMsg(ES_ALL, "Starting DB connection."); m_status = ConnStatusType::CONNECTION_BAD; if (!m_valid_connection_options) { @@ -290,11 +290,11 @@ bool ESCommunication::ConnectDBStart() { return true; } -ConnStatusType ESCommunication::GetConnectionStatus() { +ConnStatusType OpenSearchCommunication::GetConnectionStatus() { return m_status; } -void ESCommunication::DropDBConnection() { +void OpenSearchCommunication::DropDBConnection() { LogMsg(ES_ALL, "Dropping DB connection."); if (m_http_client) { m_http_client.reset(); @@ -304,7 +304,7 @@ void ESCommunication::DropDBConnection() { StopResultRetrieval(); } -bool ESCommunication::CheckConnectionOptions() { +bool OpenSearchCommunication::CheckConnectionOptions() { LogMsg(ES_ALL, "Verifying connection options."); m_error_message = ""; if (m_rt_opts.auth.auth_type != AUTHTYPE_NONE @@ -340,7 +340,7 @@ bool ESCommunication::CheckConnectionOptions() { 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 +358,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 +419,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); @@ -472,7 +473,7 @@ bool ESCommunication::IsSQLPluginInstalled(const std::string& plugin_response) { 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."); if (!m_http_client) { @@ -522,7 +523,7 @@ bool ESCommunication::EstablishConnection() { 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()) { @@ -589,7 +590,7 @@ 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"; @@ -683,7 +684,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; } @@ -739,7 +740,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); @@ -753,12 +754,12 @@ void ESCommunication::SendCloseCursorRequest(const std::string& cursor) { } } -void ESCommunication::StopResultRetrieval() { +void OpenSearchCommunication::StopResultRetrieval() { m_is_retrieving = false; m_result_queue.clear(); } -void ESCommunication::ConstructESResult(ESResult& result) { +void OpenSearchCommunication::ConstructESResult(ESResult& result) { GetJsonSchema(result); rabbit::array schema_array = result.es_result_doc["schema"]; for (rabbit::array::iterator it = schema_array.begin(); @@ -783,7 +784,7 @@ void ESCommunication::ConstructESResult(ESResult& result) { result.num_fields = (uint16_t)schema_array.size(); } -inline void ESCommunication::LogMsg(ESLogLevel level, const char* msg) { +inline void OpenSearchCommunication::LogMsg(ESLogLevel level, const char* msg) { #if WIN32 #pragma warning(push) #pragma warning(disable : 4551) @@ -796,7 +797,7 @@ inline void ESCommunication::LogMsg(ESLogLevel level, const char* msg) { #endif // WIN32 } -ESResult* ESCommunication::PopResult() { +ESResult* OpenSearchCommunication::PopResult() { ESResult* result = NULL; while (!m_result_queue.pop(QUEUE_TIMEOUT, result) && m_is_retrieving) { } @@ -805,12 +806,12 @@ 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()) { @@ -822,7 +823,7 @@ bool ESCommunication::SetClientEncoding(std::string& encoding) { return false; } -std::string ESCommunication::GetServerVersion() { +std::string OpenSearchCommunication::GetServerVersion() { if (!m_http_client) { InitializeConnection(); } @@ -878,7 +879,7 @@ std::string ESCommunication::GetServerVersion() { return ""; } -std::string ESCommunication::GetClusterName() { +std::string OpenSearchCommunication::GetClusterName() { if (!m_http_client) { InitializeConnection(); } diff --git a/sql-odbc/src/odfesqlodbc/es_communication.h b/sql-odbc/src/odfesqlodbc/opensearch_communication.h similarity index 95% rename from sql-odbc/src/odfesqlodbc/es_communication.h rename to sql-odbc/src/odfesqlodbc/opensearch_communication.h index f910d0aec78..5a625221ae7 100644 --- a/sql-odbc/src/odfesqlodbc/es_communication.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.h @@ -14,8 +14,8 @@ * */ -#ifndef ES_COMMUNICATION -#define ES_COMMUNICATION +#ifndef OPENSEARCH_COMMUNICATION +#define OPENSEARCH_COMMUNICATION // clang-format off #include @@ -44,10 +44,10 @@ #include // clang-format on -class ESCommunication { +class OpenSearchCommunication { public: - ESCommunication(); - ~ESCommunication(); + OpenSearchCommunication(); + ~OpenSearchCommunication(); // Create function for factory std::string GetErrorMessage(); diff --git a/sql-odbc/src/odfesqlodbc/setup.c b/sql-odbc/src/odfesqlodbc/setup.c index 2ec388f987d..a6ae4607b2b 100644 --- a/sql-odbc/src/odfesqlodbc/setup.c +++ b/sql-odbc/src/odfesqlodbc/setup.c @@ -28,7 +28,7 @@ #include #include "dlg_specific.h" -#include "es_apifunc.h" +#include "opensearch_apifunc.h" #include "resource.h" #include "win_setup.h" From 4213a5dd02fe223672158b8d643cd3de83581d8c Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 15:29:44 -0700 Subject: [PATCH 06/36] Rename es_connection --- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 4 +- sql-odbc/src/odfesqlodbc/columninfo.c | 2 +- sql-odbc/src/odfesqlodbc/connection.c | 8 ++-- sql-odbc/src/odfesqlodbc/convert.c | 2 +- sql-odbc/src/odfesqlodbc/descriptor.c | 2 +- sql-odbc/src/odfesqlodbc/drvconn.c | 2 +- sql-odbc/src/odfesqlodbc/drvconn.h | 2 +- sql-odbc/src/odfesqlodbc/environ.c | 2 +- .../src/odfesqlodbc/es_driver_connect.cpp | 4 +- sql-odbc/src/odfesqlodbc/es_driver_connect.h | 2 +- sql-odbc/src/odfesqlodbc/es_info.h | 2 +- sql-odbc/src/odfesqlodbc/es_types.c | 6 +-- sql-odbc/src/odfesqlodbc/execute.c | 2 +- sql-odbc/src/odfesqlodbc/info.c | 6 +-- sql-odbc/src/odfesqlodbc/multibyte.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapi.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapi30.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapi30w.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapiw.c | 2 +- sql-odbc/src/odfesqlodbc/opensearch_api30.c | 2 +- ...nnection.cpp => opensearch_connection.cpp} | 12 +++--- ...s_connection.h => opensearch_connection.h} | 38 +++++++++---------- sql-odbc/src/odfesqlodbc/options.c | 2 +- sql-odbc/src/odfesqlodbc/parse.c | 2 +- sql-odbc/src/odfesqlodbc/qresult.h | 2 +- sql-odbc/src/odfesqlodbc/results.c | 2 +- sql-odbc/src/odfesqlodbc/statement.c | 2 +- 27 files changed, 59 insertions(+), 59 deletions(-) rename sql-odbc/src/odfesqlodbc/{es_connection.cpp => opensearch_connection.cpp} (95%) rename sql-odbc/src/odfesqlodbc/{es_connection.h => opensearch_connection.h} (94%) diff --git a/sql-odbc/src/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index 683cca3f33f..10cf85476f4 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -23,7 +23,7 @@ set( SOURCE_FILES misc.c multibyte.c mylog.c tuple.c parse.c results.c statement.c odbcapi30.c qresult.c odbcapi30w.c opensearch_api30.c es_types.c - es_utility.cpp opensearch_communication.cpp es_connection.cpp es_odbc.c + es_utility.cpp opensearch_communication.cpp opensearch_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 @@ -36,7 +36,7 @@ set( HEADER_FILES bind.h catfunc.h columninfo.h convert.h descriptor.h dlg_specific.h drvconn.h environ.h opensearch_apifunc.h opensearch_communication.h es_parse_result.h - es_connection.h es_driver_connect.h es_helper.h es_info.h + opensearch_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 resource.h statement.h tuple.h unicode_support.h diff --git a/sql-odbc/src/odfesqlodbc/columninfo.c b/sql-odbc/src/odfesqlodbc/columninfo.c index db9838ff20f..95149b4317f 100644 --- a/sql-odbc/src/odfesqlodbc/columninfo.c +++ b/sql-odbc/src/odfesqlodbc/columninfo.c @@ -19,9 +19,9 @@ #include #include -#include "es_connection.h" #include "es_types.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" ColumnInfoClass *CI_Constructor(void) { ColumnInfoClass *rv; diff --git a/sql-odbc/src/odfesqlodbc/connection.c b/sql-odbc/src/odfesqlodbc/connection.c index 33a454eb05f..36e5abe78b6 100644 --- a/sql-odbc/src/odfesqlodbc/connection.c +++ b/sql-odbc/src/odfesqlodbc/connection.c @@ -23,8 +23,8 @@ #include #include -#include "es_connection.h" #include "misc.h" +#include "opensearch_connection.h" /* for htonl */ #ifdef WIN32 @@ -35,11 +35,11 @@ #include "dlg_specific.h" #include "environ.h" -#include "es_connection.h" #include "es_helper.h" #include "loadlib.h" #include "multibyte.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" #ifndef WIN32 @@ -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 diff --git a/sql-odbc/src/odfesqlodbc/convert.c b/sql-odbc/src/odfesqlodbc/convert.c index c251a2d5b34..6d49f038caf 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_connection.h" #include "es_types.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/descriptor.c b/sql-odbc/src/odfesqlodbc/descriptor.c index 01122766959..b89840b2020 100644 --- a/sql-odbc/src/odfesqlodbc/descriptor.c +++ b/sql-odbc/src/odfesqlodbc/descriptor.c @@ -21,9 +21,9 @@ #include #include "environ.h" -#include "es_connection.h" #include "misc.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/drvconn.c b/sql-odbc/src/odfesqlodbc/drvconn.c index f044d4b670d..b65bef10c1c 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 "misc.h" +#include "opensearch_connection.h" #ifndef WIN32 #include diff --git a/sql-odbc/src/odfesqlodbc/drvconn.h b/sql-odbc/src/odfesqlodbc/drvconn.h index 00fdf275bd6..83cb9c4ba82 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 "misc.h" +#include "opensearch_connection.h" #ifndef WIN32 #include diff --git a/sql-odbc/src/odfesqlodbc/environ.c b/sql-odbc/src/odfesqlodbc/environ.c index 468d4d7d0b2..5a3a1f4372d 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_connection.h" #include "misc.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "statement.h" #ifdef WIN32 #include diff --git a/sql-odbc/src/odfesqlodbc/es_driver_connect.cpp b/sql-odbc/src/odfesqlodbc/es_driver_connect.cpp index 8ece2af1bea..a6c18d4ceaf 100644 --- a/sql-odbc/src/odfesqlodbc/es_driver_connect.cpp +++ b/sql-odbc/src/odfesqlodbc/es_driver_connect.cpp @@ -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/es_driver_connect.h index be6bb2d6ca7..e4ca80ac4f3 100644 --- a/sql-odbc/src/odfesqlodbc/es_driver_connect.h +++ b/sql-odbc/src/odfesqlodbc/es_driver_connect.h @@ -16,7 +16,7 @@ #ifndef __ES_DRIVER_CONNECT_H__ #define __ES_DRIVER_CONNECT_H__ -#include "es_connection.h" +#include "opensearch_connection.h" // C Interface #ifdef __cplusplus diff --git a/sql-odbc/src/odfesqlodbc/es_info.h b/sql-odbc/src/odfesqlodbc/es_info.h index 032d1408926..2953a4dbb83 100644 --- a/sql-odbc/src/odfesqlodbc/es_info.h +++ b/sql-odbc/src/odfesqlodbc/es_info.h @@ -28,11 +28,11 @@ #include "catfunc.h" #include "dlg_specific.h" #include "environ.h" -#include "es_connection.h" #include "es_types.h" #include "misc.h" #include "multibyte.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" #include "tuple.h" diff --git a/sql-odbc/src/odfesqlodbc/es_types.c b/sql-odbc/src/odfesqlodbc/es_types.c index a5cb8b5f660..38983eda1ac 100644 --- a/sql-odbc/src/odfesqlodbc/es_types.c +++ b/sql-odbc/src/odfesqlodbc/es_types.c @@ -18,7 +18,7 @@ #include "dlg_specific.h" #include "environ.h" -#include "es_connection.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" #ifndef WIN32 @@ -901,7 +901,7 @@ const char *sqltype_to_escast(const ConnectionClass *conn, esCast = "::timestamp"; break; case SQL_GUID: - if (ES_VERSION_GE(conn, 8.3)) + if (OPENSEARCH_VERSION_GE(conn, 8.3)) esCast = "::uuid"; break; case SQL_INTERVAL_MONTH: @@ -1016,7 +1016,7 @@ OID sqltype_to_estype(const ConnectionClass *conn, SQLSMALLINT fSqlType) { #endif /* UNICODE_SUPPORT */ case SQL_GUID: - if (ES_VERSION_GE(conn, 8.3)) + if (OPENSEARCH_VERSION_GE(conn, 8.3)) esType = ES_TYPE_UUID; break; diff --git a/sql-odbc/src/odfesqlodbc/execute.c b/sql-odbc/src/odfesqlodbc/execute.c index e0b4f197b39..181367b78cb 100644 --- a/sql-odbc/src/odfesqlodbc/execute.c +++ b/sql-odbc/src/odfesqlodbc/execute.c @@ -27,10 +27,10 @@ #include "bind.h" #include "convert.h" #include "environ.h" -#include "es_connection.h" #include "es_statement.h" #include "es_types.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/info.c b/sql-odbc/src/odfesqlodbc/info.c index b4fb519ffa0..a7544185a74 100644 --- a/sql-odbc/src/odfesqlodbc/info.c +++ b/sql-odbc/src/odfesqlodbc/info.c @@ -28,12 +28,12 @@ #include "catfunc.h" #include "dlg_specific.h" #include "environ.h" -#include "es_connection.h" #include "es_info.h" #include "es_types.h" #include "misc.h" #include "multibyte.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" #include "tuple.h" @@ -193,7 +193,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, break; case SQL_DBMS_VER: /* ODBC 1.0 */ - STRCPY_FIXED(tmp, conn->es_version); + STRCPY_FIXED(tmp, conn->opensearch_version); p = tmp; break; @@ -353,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 diff --git a/sql-odbc/src/odfesqlodbc/multibyte.c b/sql-odbc/src/odfesqlodbc/multibyte.c index eea26e0b02b..fe871499c07 100644 --- a/sql-odbc/src/odfesqlodbc/multibyte.c +++ b/sql-odbc/src/odfesqlodbc/multibyte.c @@ -21,9 +21,9 @@ #include #include -#include "es_connection.h" #include "misc.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #ifndef WIN32 #include #endif diff --git a/sql-odbc/src/odfesqlodbc/odbcapi.c b/sql-odbc/src/odfesqlodbc/odbcapi.c index 681df8dfceb..bc6dbd21c14 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi.c @@ -18,7 +18,6 @@ #include #include "environ.h" -#include "es_connection.h" #include "es_driver_connect.h" #include "es_info.h" #include "es_odbc.h" @@ -26,6 +25,7 @@ #include "loadlib.h" #include "misc.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/odbcapi30.c b/sql-odbc/src/odfesqlodbc/odbcapi30.c index 4264533bf81..63b6dc10146 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_connection.h" #include "es_odbc.h" #include "misc.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "statement.h" /* SQLAllocConnect/SQLAllocEnv/SQLAllocStmt -> SQLAllocHandle */ diff --git a/sql-odbc/src/odfesqlodbc/odbcapi30w.c b/sql-odbc/src/odfesqlodbc/odbcapi30w.c index baf098c5612..504c21219c4 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi30w.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi30w.c @@ -17,10 +17,10 @@ #include #include -#include "es_connection.h" #include "es_odbc.h" #include "misc.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "statement.h" #include "unicode_support.h" diff --git a/sql-odbc/src/odfesqlodbc/odbcapiw.c b/sql-odbc/src/odfesqlodbc/odbcapiw.c index 6f7cf79eb55..29a91ea0cbb 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapiw.c +++ b/sql-odbc/src/odfesqlodbc/odbcapiw.c @@ -17,11 +17,11 @@ #include #include -#include "es_connection.h" #include "es_driver_connect.h" #include "es_info.h" #include "es_odbc.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "statement.h" #include "unicode_support.h" diff --git a/sql-odbc/src/odfesqlodbc/opensearch_api30.c b/sql-odbc/src/odfesqlodbc/opensearch_api30.c index cac67daf6f5..3a930df1747 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_api30.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_api30.c @@ -20,11 +20,11 @@ #include "descriptor.h" #include "dlg_specific.h" #include "environ.h" -#include "es_connection.h" #include "es_odbc.h" #include "loadlib.h" #include "misc.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/es_connection.cpp b/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp similarity index 95% rename from sql-odbc/src/odfesqlodbc/es_connection.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_connection.cpp index e82c4d96aa9..7ba71b79e15 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 @@ -138,7 +138,7 @@ int LIBES_connect(ConnectionClass *self) { // Set server version std::string server_version = GetServerVersion(esconn); - STRCPY_FIXED(self->es_version, server_version.c_str()); + STRCPY_FIXED(self->opensearch_version, server_version.c_str()); std::string cluster_name = GetClusterName(esconn); STRCPY_FIXED(self->cluster_name, cluster_name.c_str()); @@ -195,10 +195,10 @@ int CC_send_client_encoding(ConnectionClass *self, const char *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) { diff --git a/sql-odbc/src/odfesqlodbc/es_connection.h b/sql-odbc/src/odfesqlodbc/opensearch_connection.h similarity index 94% rename from sql-odbc/src/odfesqlodbc/es_connection.h rename to sql-odbc/src/odfesqlodbc/opensearch_connection.h index 4f8b34bd247..db971e7328e 100644 --- a/sql-odbc/src/odfesqlodbc/es_connection.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_connection.h @@ -14,8 +14,8 @@ * */ -#ifndef __ESCONNECTION_H__ -#define __ESCONNECTION_H__ +#ifndef __OPENSEARCHCONNECTION_H__ +#define __OPENSEARCHCONNECTION_H__ #include #include @@ -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,14 +205,14 @@ 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 { @@ -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 OpenSearch 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; @@ -413,7 +413,7 @@ int LIBES_connect(ConnectionClass *self); void LIBES_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/options.c b/sql-odbc/src/odfesqlodbc/options.c index aefe397ee1b..0f3ae63b0c4 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_connection.h" #include "es_odbc.h" #include "misc.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" #include "unicode_support.h" diff --git a/sql-odbc/src/odfesqlodbc/parse.c b/sql-odbc/src/odfesqlodbc/parse.c index acad84cdbe2..3ba5d6f97dd 100644 --- a/sql-odbc/src/odfesqlodbc/parse.c +++ b/sql-odbc/src/odfesqlodbc/parse.c @@ -19,13 +19,13 @@ #include #include "catfunc.h" -#include "es_connection.h" #include "es_info.h" #include "es_odbc.h" #include "es_types.h" #include "misc.h" #include "multibyte.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/qresult.h b/sql-odbc/src/odfesqlodbc/qresult.h index 1b30e5709a7..9089452390f 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 "tuple.h" #ifdef __cplusplus diff --git a/sql-odbc/src/odfesqlodbc/results.c b/sql-odbc/src/odfesqlodbc/results.c index d41a6910bea..749989a76f3 100644 --- a/sql-odbc/src/odfesqlodbc/results.c +++ b/sql-odbc/src/odfesqlodbc/results.c @@ -22,12 +22,12 @@ #include "convert.h" #include "dlg_specific.h" #include "environ.h" -#include "es_connection.h" #include "es_odbc.h" #include "es_statement.h" #include "es_types.h" #include "misc.h" #include "opensearch_apifunc.h" +#include "opensearch_connection.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/statement.c b/sql-odbc/src/odfesqlodbc/statement.c index cc3d49cbf68..d0f329befda 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" From 8311ba951578dd11849e04b204cb578c96a29ee6 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 15:43:27 -0700 Subject: [PATCH 07/36] Fix connection.c --- sql-odbc/src/odfesqlodbc/connection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-odbc/src/odfesqlodbc/connection.c b/sql-odbc/src/odfesqlodbc/connection.c index 36e5abe78b6..067ceeded2b 100644 --- a/sql-odbc/src/odfesqlodbc/connection.c +++ b/sql-odbc/src/odfesqlodbc/connection.c @@ -23,8 +23,8 @@ #include #include -#include "misc.h" #include "opensearch_connection.h" +#include "misc.h" /* for htonl */ #ifdef WIN32 From e92631b2fef99225d5d6d4b91c6b3696082bc0c5 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 15:51:28 -0700 Subject: [PATCH 08/36] Rename es_driver_connect and es_semaphore --- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 8 ++++---- sql-odbc/src/odfesqlodbc/es_result_queue.h | 9 +++++---- sql-odbc/src/odfesqlodbc/odbcapi.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapiw.c | 2 +- ...ver_connect.cpp => opensearch_driver_connect.cpp} | 2 +- ..._driver_connect.h => opensearch_driver_connect.h} | 6 +++--- .../{es_semaphore.cpp => opensearch_semaphore.cpp} | 12 ++++++------ .../{es_semaphore.h => opensearch_semaphore.h} | 10 +++++----- 8 files changed, 26 insertions(+), 25 deletions(-) rename sql-odbc/src/odfesqlodbc/{es_driver_connect.cpp => opensearch_driver_connect.cpp} (99%) rename sql-odbc/src/odfesqlodbc/{es_driver_connect.h => opensearch_driver_connect.h} (89%) rename sql-odbc/src/odfesqlodbc/{es_semaphore.cpp => opensearch_semaphore.cpp} (88%) rename sql-odbc/src/odfesqlodbc/{es_semaphore.h => opensearch_semaphore.h} (84%) diff --git a/sql-odbc/src/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index 10cf85476f4..fe9819933c2 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -24,8 +24,8 @@ set( SOURCE_FILES parse.c results.c statement.c odbcapi30.c qresult.c odbcapi30w.c opensearch_api30.c es_types.c es_utility.cpp opensearch_communication.cpp opensearch_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 + opensearch_driver_connect.cpp es_helper.cpp es_info.cpp es_parse_result.cpp + opensearch_semaphore.cpp es_statement.cpp win_unicode.c odbcapi.c odbcapiw.c es_result_queue.cpp ) if(WIN32) @@ -36,11 +36,11 @@ set( HEADER_FILES bind.h catfunc.h columninfo.h convert.h descriptor.h dlg_specific.h drvconn.h environ.h opensearch_apifunc.h opensearch_communication.h es_parse_result.h - opensearch_connection.h es_driver_connect.h es_helper.h es_info.h + opensearch_connection.h opensearch_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 resource.h statement.h tuple.h unicode_support.h - opensearch_apifunc.h es_odbc.h es_semaphore.h qresult.h + opensearch_apifunc.h es_odbc.h opensearch_semaphore.h qresult.h version.h win_setup.h es_result_queue.h ) diff --git a/sql-odbc/src/odfesqlodbc/es_result_queue.h b/sql-odbc/src/odfesqlodbc/es_result_queue.h index d624d389347..2ed4e9ec75c 100644 --- a/sql-odbc/src/odfesqlodbc/es_result_queue.h +++ b/sql-odbc/src/odfesqlodbc/es_result_queue.h @@ -16,9 +16,10 @@ #ifndef ES_RESULT_QUEUE #define ES_RESULT_QUEUE -#include #include -#include "es_semaphore.h" +#include + +#include "opensearch_semaphore.h" #define QUEUE_TIMEOUT 20 // milliseconds @@ -36,8 +37,8 @@ class ESResultQueue { private: std::queue 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/odbcapi.c b/sql-odbc/src/odfesqlodbc/odbcapi.c index bc6dbd21c14..79d12ca50a7 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi.c @@ -18,7 +18,6 @@ #include #include "environ.h" -#include "es_driver_connect.h" #include "es_info.h" #include "es_odbc.h" #include "es_statement.h" @@ -26,6 +25,7 @@ #include "misc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" +#include "opensearch_driver_connect.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/odbcapiw.c b/sql-odbc/src/odfesqlodbc/odbcapiw.c index 29a91ea0cbb..72924c2d172 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapiw.c +++ b/sql-odbc/src/odfesqlodbc/odbcapiw.c @@ -17,11 +17,11 @@ #include #include -#include "es_driver_connect.h" #include "es_info.h" #include "es_odbc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" +#include "opensearch_driver_connect.h" #include "statement.h" #include "unicode_support.h" diff --git a/sql-odbc/src/odfesqlodbc/es_driver_connect.cpp b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp similarity index 99% rename from sql-odbc/src/odfesqlodbc/es_driver_connect.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp index a6c18d4ceaf..143c9f0c06b 100644 --- a/sql-odbc/src/odfesqlodbc/es_driver_connect.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp @@ -14,7 +14,7 @@ * */ -#include "es_driver_connect.h" +#include "opensearch_driver_connect.h" #include #include diff --git a/sql-odbc/src/odfesqlodbc/es_driver_connect.h b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.h similarity index 89% rename from sql-odbc/src/odfesqlodbc/es_driver_connect.h rename to sql-odbc/src/odfesqlodbc/opensearch_driver_connect.h index e4ca80ac4f3..f938aebe695 100644 --- a/sql-odbc/src/odfesqlodbc/es_driver_connect.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.h @@ -14,8 +14,8 @@ * */ -#ifndef __ES_DRIVER_CONNECT_H__ -#define __ES_DRIVER_CONNECT_H__ +#ifndef __OPENSEARCH_DRIVER_CONNECT_H__ +#define __OPENSEARCH_DRIVER_CONNECT_H__ #include "opensearch_connection.h" // C Interface @@ -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_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 eaf15325644..e61cfacc19a 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 980e4cd6eba..d171162b428 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(); From 3c319ac03f32c3553dd180e40acde9ddcc18482d Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 16:27:37 -0700 Subject: [PATCH 09/36] Rename es_helper --- .../UnitTests/UTConn/test_query_execution.cpp | 2 +- .../test_critical_section.cpp | 2 +- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 4 +- sql-odbc/src/odfesqlodbc/connection.c | 2 +- sql-odbc/src/odfesqlodbc/environ.h | 2 +- sql-odbc/src/odfesqlodbc/es_helper.h | 55 -------------- sql-odbc/src/odfesqlodbc/es_info.cpp | 2 +- sql-odbc/src/odfesqlodbc/es_info.h | 2 +- sql-odbc/src/odfesqlodbc/es_parse_result.cpp | 2 +- sql-odbc/src/odfesqlodbc/es_parse_result.h | 2 +- sql-odbc/src/odfesqlodbc/es_statement.cpp | 15 ++-- sql-odbc/src/odfesqlodbc/mylog.c | 2 +- .../src/odfesqlodbc/opensearch_connection.cpp | 16 ++-- .../src/odfesqlodbc/opensearch_connection.h | 2 +- .../{es_helper.cpp => opensearch_helper.cpp} | 76 ++++++++++--------- sql-odbc/src/odfesqlodbc/opensearch_helper.h | 55 ++++++++++++++ sql-odbc/src/odfesqlodbc/statement.c | 6 +- sql-odbc/src/odfesqlodbc/statement.h | 2 +- 18 files changed, 127 insertions(+), 122 deletions(-) delete mode 100644 sql-odbc/src/odfesqlodbc/es_helper.h rename sql-odbc/src/odfesqlodbc/{es_helper.cpp => opensearch_helper.cpp} (69%) create mode 100644 sql-odbc/src/odfesqlodbc/opensearch_helper.h diff --git a/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp b/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp index bca210ece2e..293c8b49ca5 100644 --- a/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp +++ b/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp @@ -18,7 +18,7 @@ #include "pch.h" #include "unit_test_helper.h" #include "opensearch_communication.h" -#include "es_helper.h" +#include "opensearch_helper.h" // clang-format on const std::string valid_host = (use_ssl ? "https://localhost" : "localhost"); diff --git a/sql-odbc/src/UnitTests/UTCriticalSection/test_critical_section.cpp b/sql-odbc/src/UnitTests/UTCriticalSection/test_critical_section.cpp index 5d729ffd83e..5cb06386ec4 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/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index fe9819933c2..b01d51f41f8 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -24,7 +24,7 @@ set( SOURCE_FILES parse.c results.c statement.c odbcapi30.c qresult.c odbcapi30w.c opensearch_api30.c es_types.c es_utility.cpp opensearch_communication.cpp opensearch_connection.cpp es_odbc.c - opensearch_driver_connect.cpp es_helper.cpp es_info.cpp es_parse_result.cpp + opensearch_driver_connect.cpp opensearch_helper.cpp es_info.cpp es_parse_result.cpp opensearch_semaphore.cpp es_statement.cpp win_unicode.c odbcapi.c odbcapiw.c es_result_queue.cpp ) @@ -36,7 +36,7 @@ set( HEADER_FILES bind.h catfunc.h columninfo.h convert.h descriptor.h dlg_specific.h drvconn.h environ.h opensearch_apifunc.h opensearch_communication.h es_parse_result.h - opensearch_connection.h opensearch_driver_connect.h es_helper.h es_info.h + opensearch_connection.h opensearch_driver_connect.h opensearch_helper.h es_info.h es_statement.h es_types.h loadlib.h misc.h multibyte.h mylog.h es_utility.h resource.h statement.h tuple.h unicode_support.h diff --git a/sql-odbc/src/odfesqlodbc/connection.c b/sql-odbc/src/odfesqlodbc/connection.c index 067ceeded2b..ba5d1611545 100644 --- a/sql-odbc/src/odfesqlodbc/connection.c +++ b/sql-odbc/src/odfesqlodbc/connection.c @@ -35,11 +35,11 @@ #include "dlg_specific.h" #include "environ.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 diff --git a/sql-odbc/src/odfesqlodbc/environ.h b/sql-odbc/src/odfesqlodbc/environ.h index c4dc26a53d3..e701d6461fb 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" #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 9aa05f93020..00000000000 --- 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/es_info.cpp b/sql-odbc/src/odfesqlodbc/es_info.cpp index de1b295d826..3fe5ecaa28f 100644 --- a/sql-odbc/src/odfesqlodbc/es_info.cpp +++ b/sql-odbc/src/odfesqlodbc/es_info.cpp @@ -841,7 +841,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->esconn, table_name); } // TODO #324 (SQL Plugin)- evaluate catalog & schema support diff --git a/sql-odbc/src/odfesqlodbc/es_info.h b/sql-odbc/src/odfesqlodbc/es_info.h index 2953a4dbb83..2ea8cbe28f8 100644 --- a/sql-odbc/src/odfesqlodbc/es_info.h +++ b/sql-odbc/src/odfesqlodbc/es_info.h @@ -16,8 +16,8 @@ #ifndef __ES_INFO_H__ #define __ES_INFO_H__ -#include "es_helper.h" #include "es_odbc.h" +#include "opensearch_helper.h" #include "unicode_support.h" #ifndef WIN32 diff --git a/sql-odbc/src/odfesqlodbc/es_parse_result.cpp b/sql-odbc/src/odfesqlodbc/es_parse_result.cpp index e111bb37f3d..55dfccadad8 100644 --- a/sql-odbc/src/odfesqlodbc/es_parse_result.cpp +++ b/sql-odbc/src/odfesqlodbc/es_parse_result.cpp @@ -18,8 +18,8 @@ #include -#include "es_helper.h" #include "es_types.h" +#include "opensearch_helper.h" #ifdef __APPLE__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-parameter" diff --git a/sql-odbc/src/odfesqlodbc/es_parse_result.h b/sql-odbc/src/odfesqlodbc/es_parse_result.h index 0543c6ac0da..91c7978d1e2 100644 --- a/sql-odbc/src/odfesqlodbc/es_parse_result.h +++ b/sql-odbc/src/odfesqlodbc/es_parse_result.h @@ -27,7 +27,7 @@ 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 diff --git a/sql-odbc/src/odfesqlodbc/es_statement.cpp b/sql-odbc/src/odfesqlodbc/es_statement.cpp index ac21223199e..453ff51902f 100644 --- a/sql-odbc/src/odfesqlodbc/es_statement.cpp +++ b/sql-odbc/src/odfesqlodbc/es_statement.cpp @@ -17,9 +17,9 @@ #include "es_statement.h" #include "environ.h" // Critical section for statment -#include "es_helper.h" #include "misc.h" #include "opensearch_apifunc.h" +#include "opensearch_helper.h" #include "statement.h" extern "C" void *common_cs; @@ -171,7 +171,7 @@ SQLRETURN GetNextResultSet(StatementClass *stmt) { return SQL_ERROR; } - ESResult *es_res = ESGetResult(conn->esconn); + ESResult *es_res = OpenSearchGetResult(conn->esconn); if (es_res != NULL) { // Save server cursor id to fetch more pages later if (es_res->es_result_doc.has("cursor")) { @@ -245,7 +245,8 @@ 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->esconn, stmt->statement, + conn->connInfo.fetch_size) != 0) { QR_Destructor(res); return NULL; @@ -253,7 +254,7 @@ QResultClass *SendQueryGetResult(StatementClass *stmt, BOOL commit) { res->rstatus = PORES_COMMAND_OK; // Get ESResult - ESResult *es_res = ESGetResult(conn->esconn); + ESResult *es_res = OpenSearchGetResult(conn->esconn); if (es_res == NULL) { QR_Destructor(res); return NULL; @@ -272,7 +273,7 @@ QResultClass *SendQueryGetResult(StatementClass *stmt, BOOL commit) { if (commit) { // Deallocate ESResult - ESClearResult(es_res); + OpenSearchClearResult(es_res); res->es_result = NULL; } else { // Set ESResult into connection class so it can be used later @@ -300,7 +301,7 @@ RETCODE AssignResult(StatementClass *stmt) { GetNextResultSet(stmt); // Deallocate and return result - ESClearResult(es_res); + OpenSearchClearResult(es_res); res->es_result = NULL; return SQL_SUCCESS; } @@ -308,7 +309,7 @@ RETCODE AssignResult(StatementClass *stmt) { void ClearESResult(void *es_result) { if (es_result != NULL) { ESResult *es_res = static_cast< ESResult * >(es_result); - ESClearResult(es_res); + OpenSearchClearResult(es_res); } } diff --git a/sql-odbc/src/odfesqlodbc/mylog.c b/sql-odbc/src/odfesqlodbc/mylog.c index ebd93bf81ef..646c96a7468 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 "misc.h" +#include "opensearch_helper.h" #ifndef WIN32 #include diff --git a/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp b/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp index 7ba71b79e15..530a289be9f 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp @@ -39,10 +39,10 @@ #include "dlg_specific.h" #include "environ.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" @@ -111,17 +111,17 @@ 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); + void *esconn = OpenSearchConnectDBParams(rt_opts, FALSE, OPTION_COUNT); if (esconn == NULL) { std::string err = GetErrorMsg(esconn); CC_set_error(self, CONN_OPENDB_ERROR, - (err.empty()) ? "ESConnectDBParams error" : err.c_str(), + (err.empty()) ? "OpenSearchConnectDBParams error" : err.c_str(), "LIBES_connect"); return 0; } // Check connection status - if (ESStatus(esconn) != CONNECTION_OK) { + if (OpenSearchStatus(esconn) != CONNECTION_OK) { std::string msg = GetErrorMsg(esconn); char error_message_out[ERROR_BUFF_SIZE] = ""; if (!msg.empty()) @@ -132,7 +132,7 @@ int LIBES_connect(ConnectionClass *self) { "Connection error: No message available."); CC_set_error(self, CONN_OPENDB_ERROR, error_message_out, "LIBES_connect"); - ESDisconnect(esconn); + OpenSearchDisconnect(esconn); return 0; } @@ -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->esconn); if (des_db_encoding != cur_db_encoding) { - if (!ESSetClientEncoding(self->esconn, des_db_encoding)) { + if (!OpenSearchSetClientEncoding(self->esconn, des_db_encoding)) { return SQL_ERROR; } } @@ -202,5 +202,5 @@ void CC_initialize_opensearch_version(ConnectionClass *self) { } void LIBES_disconnect(void *conn) { - ESDisconnect(conn); + OpenSearchDisconnect(conn); } diff --git a/sql-odbc/src/odfesqlodbc/opensearch_connection.h b/sql-odbc/src/odfesqlodbc/opensearch_connection.h index db971e7328e..2596c94b6d7 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_connection.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_connection.h @@ -22,9 +22,9 @@ #include #include "descriptor.h" -#include "es_helper.h" #include "es_odbc.h" #include "es_utility.h" +#include "opensearch_helper.h" #ifdef __cplusplus extern "C" { diff --git a/sql-odbc/src/odfesqlodbc/es_helper.cpp b/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp similarity index 69% rename from sql-odbc/src/odfesqlodbc/es_helper.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_helper.cpp index d1a8a5eb474..9966640954f 100644 --- a/sql-odbc/src/odfesqlodbc/es_helper.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp @@ -14,7 +14,7 @@ * */ -#include "es_helper.h" +#include "opensearch_helper.h" #include #include @@ -22,10 +22,10 @@ #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 - OpenSearchCommunication* conn = static_cast< OpenSearchCommunication* >(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< OpenSearchCommunication* >(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< OpenSearchCommunication* >(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< OpenSearchCommunication* >(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< OpenSearchCommunication* >(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< OpenSearchCommunication* >(es_conn)->GetClusterName() +std::string GetClusterName(void* opensearch_conn) { + return opensearch_conn + ? static_cast< OpenSearchCommunication* >(opensearch_conn)->GetClusterName() : ""; } -void* InitializeESConn() { +void* InitializeOpenSearchConn() { return new OpenSearchCommunication(); } -int ESExecDirect(void* es_conn, const char* statement, const char* fetch_size) { +int OpenSearchExecDirect(void* es_conn, const char* statement, const char* fetch_size) { return (es_conn && statement) ? static_cast< OpenSearchCommunication* >(es_conn)->ExecDirect( statement, fetch_size) : -1; } -void ESSendCursorQueries(void* es_conn, const char* cursor) { - static_cast< OpenSearchCommunication* >(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< OpenSearchCommunication* >(es_conn)->PopResult() +ESResult* 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< OpenSearchCommunication* >(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< OpenSearchCommunication* >(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< OpenSearchCommunication* >(es_conn); +void OpenSearchDisconnect(void* opensearch_conn) { + delete static_cast< OpenSearchCommunication* >(opensearch_conn); } -void ESClearResult(ESResult* es_result) { - delete es_result; +void OpenSearchClearResult(ESResult* opensearch_result) { + delete opensearch_result; } -void ESStopRetrieval(void* es_conn) { - static_cast< OpenSearchCommunication* >(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< OpenSearchCommunication* >(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); } diff --git a/sql-odbc/src/odfesqlodbc/opensearch_helper.h b/sql-odbc/src/odfesqlodbc/opensearch_helper.h new file mode 100644 index 00000000000..85bf3dd0276 --- /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 "es_types.h" + +#ifdef __cplusplus +// C++ interface +std::string OpenSearchGetClientEncoding(void* opensearch_conn); +bool OpenSearchSetClientEncoding(void* opensearch_conn, std::string& encoding); +ESResult* OpenSearchGetResult(void* opensearch_conn); +void OpenSearchClearResult(ESResult* 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* es_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/statement.c b/sql-odbc/src/odfesqlodbc/statement.c index d0f329befda..57761f48b46 100644 --- a/sql-odbc/src/odfesqlodbc/statement.c +++ b/sql-odbc/src/odfesqlodbc/statement.c @@ -31,7 +31,7 @@ #include #include "opensearch_apifunc.h" -#include "es_helper.h" +#include "opensearch_helper.h" #include "es_statement.h" // clang-format on @@ -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->esconn); /* Remove the statement from the connection's statement list */ if (conn) { @@ -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->esconn); /* * this should discard all the results, but leave the statement diff --git a/sql-odbc/src/odfesqlodbc/statement.h b/sql-odbc/src/odfesqlodbc/statement.h index 1654cc40310..59e165e4063 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 "tuple.h" // C Interface From d6920f70e03f926a580c6f34ab70a24b055633d2 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 16:34:58 -0700 Subject: [PATCH 10/36] Fix test and rename es_info --- .../src/UnitTests/UTConn/test_query_execution.cpp | 13 +++++++------ sql-odbc/src/odfesqlodbc/CMakeLists.txt | 4 ++-- sql-odbc/src/odfesqlodbc/info.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapi.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapiw.c | 2 +- .../{es_info.cpp => opensearch_info.cpp} | 2 +- .../odfesqlodbc/{es_info.h => opensearch_info.h} | 6 +++--- sql-odbc/src/odfesqlodbc/parse.c | 2 +- 8 files changed, 17 insertions(+), 16 deletions(-) rename sql-odbc/src/odfesqlodbc/{es_info.cpp => opensearch_info.cpp} (99%) rename sql-odbc/src/odfesqlodbc/{es_info.h => opensearch_info.h} (95%) diff --git a/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp b/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp index 293c8b49ca5..ffa47b37702 100644 --- a/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp +++ b/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp @@ -43,24 +43,25 @@ runtime_options valid_conn_opt_val = { {"BASIC", valid_user, valid_pw, valid_region}, {use_ssl, false, "", "", "", ""}}; -TEST(TestESExecDirect, ValidQuery) { +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) { +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 diff --git a/sql-odbc/src/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index b01d51f41f8..0fbab076f52 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -24,7 +24,7 @@ set( SOURCE_FILES parse.c results.c statement.c odbcapi30.c qresult.c odbcapi30w.c opensearch_api30.c es_types.c es_utility.cpp opensearch_communication.cpp opensearch_connection.cpp es_odbc.c - opensearch_driver_connect.cpp opensearch_helper.cpp es_info.cpp es_parse_result.cpp + opensearch_driver_connect.cpp opensearch_helper.cpp opensearch_info.cpp es_parse_result.cpp opensearch_semaphore.cpp es_statement.cpp win_unicode.c odbcapi.c odbcapiw.c es_result_queue.cpp ) @@ -36,7 +36,7 @@ set( HEADER_FILES bind.h catfunc.h columninfo.h convert.h descriptor.h dlg_specific.h drvconn.h environ.h opensearch_apifunc.h opensearch_communication.h es_parse_result.h - opensearch_connection.h opensearch_driver_connect.h opensearch_helper.h es_info.h + opensearch_connection.h opensearch_driver_connect.h opensearch_helper.h opensearch_info.h es_statement.h es_types.h loadlib.h misc.h multibyte.h mylog.h es_utility.h resource.h statement.h tuple.h unicode_support.h diff --git a/sql-odbc/src/odfesqlodbc/info.c b/sql-odbc/src/odfesqlodbc/info.c index a7544185a74..f5ce1b70eb6 100644 --- a/sql-odbc/src/odfesqlodbc/info.c +++ b/sql-odbc/src/odfesqlodbc/info.c @@ -28,12 +28,12 @@ #include "catfunc.h" #include "dlg_specific.h" #include "environ.h" -#include "es_info.h" #include "es_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" diff --git a/sql-odbc/src/odfesqlodbc/odbcapi.c b/sql-odbc/src/odfesqlodbc/odbcapi.c index 79d12ca50a7..040315fdd18 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi.c @@ -18,7 +18,6 @@ #include #include "environ.h" -#include "es_info.h" #include "es_odbc.h" #include "es_statement.h" #include "loadlib.h" @@ -26,6 +25,7 @@ #include "opensearch_apifunc.h" #include "opensearch_connection.h" #include "opensearch_driver_connect.h" +#include "opensearch_info.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/odbcapiw.c b/sql-odbc/src/odfesqlodbc/odbcapiw.c index 72924c2d172..683bcfd1f82 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapiw.c +++ b/sql-odbc/src/odfesqlodbc/odbcapiw.c @@ -17,11 +17,11 @@ #include #include -#include "es_info.h" #include "es_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" diff --git a/sql-odbc/src/odfesqlodbc/es_info.cpp b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp similarity index 99% rename from sql-odbc/src/odfesqlodbc/es_info.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_info.cpp index 3fe5ecaa28f..64cc0bd09dd 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 diff --git a/sql-odbc/src/odfesqlodbc/es_info.h b/sql-odbc/src/odfesqlodbc/opensearch_info.h similarity index 95% rename from sql-odbc/src/odfesqlodbc/es_info.h rename to sql-odbc/src/odfesqlodbc/opensearch_info.h index 2ea8cbe28f8..c356c94c088 100644 --- a/sql-odbc/src/odfesqlodbc/es_info.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_info.h @@ -14,8 +14,8 @@ * */ -#ifndef __ES_INFO_H__ -#define __ES_INFO_H__ +#ifndef __OPENSEARCH_INFO_H__ +#define __OPENSEARCH_INFO_H__ #include "es_odbc.h" #include "opensearch_helper.h" #include "unicode_support.h" @@ -62,4 +62,4 @@ RETCODE SQL_API ESAPI_GetTypeInfo(HSTMT hstmt, SQLSMALLINT fSqlType); } #endif -#endif /* __ES_INFO_H__ */ +#endif /* __OPENSEARCH_INFO_H__ */ diff --git a/sql-odbc/src/odfesqlodbc/parse.c b/sql-odbc/src/odfesqlodbc/parse.c index 3ba5d6f97dd..b708fea124c 100644 --- a/sql-odbc/src/odfesqlodbc/parse.c +++ b/sql-odbc/src/odfesqlodbc/parse.c @@ -19,13 +19,13 @@ #include #include "catfunc.h" -#include "es_info.h" #include "es_odbc.h" #include "es_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" From 9f2f5d328786129e62329bd85d7cf60993686419 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 16:47:05 -0700 Subject: [PATCH 11/36] Rename es_parse_result --- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 4 +- sql-odbc/src/odfesqlodbc/columninfo.h | 2 +- sql-odbc/src/odfesqlodbc/es_statement.cpp | 8 +- sql-odbc/src/odfesqlodbc/es_statement.h | 2 +- ...result.cpp => opensearch_parse_result.cpp} | 111 +++++++++--------- ...rse_result.h => opensearch_parse_result.h} | 18 +-- 6 files changed, 75 insertions(+), 70 deletions(-) rename sql-odbc/src/odfesqlodbc/{es_parse_result.cpp => opensearch_parse_result.cpp} (78%) rename sql-odbc/src/odfesqlodbc/{es_parse_result.h => opensearch_parse_result.h} (67%) diff --git a/sql-odbc/src/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index 0fbab076f52..353c610627c 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -24,7 +24,7 @@ set( SOURCE_FILES parse.c results.c statement.c odbcapi30.c qresult.c odbcapi30w.c opensearch_api30.c es_types.c es_utility.cpp opensearch_communication.cpp opensearch_connection.cpp es_odbc.c - opensearch_driver_connect.cpp opensearch_helper.cpp opensearch_info.cpp es_parse_result.cpp + opensearch_driver_connect.cpp opensearch_helper.cpp opensearch_info.cpp opensearch_parse_result.cpp opensearch_semaphore.cpp es_statement.cpp win_unicode.c odbcapi.c odbcapiw.c es_result_queue.cpp ) @@ -35,7 +35,7 @@ endif() set( HEADER_FILES bind.h catfunc.h columninfo.h convert.h descriptor.h dlg_specific.h drvconn.h - environ.h opensearch_apifunc.h opensearch_communication.h es_parse_result.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 es_statement.h es_types.h loadlib.h misc.h multibyte.h mylog.h es_utility.h diff --git a/sql-odbc/src/odfesqlodbc/columninfo.h b/sql-odbc/src/odfesqlodbc/columninfo.h index c66b93d7170..c1e9a0ec30b 100644 --- a/sql-odbc/src/odfesqlodbc/columninfo.h +++ b/sql-odbc/src/odfesqlodbc/columninfo.h @@ -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/es_statement.cpp b/sql-odbc/src/odfesqlodbc/es_statement.cpp index 453ff51902f..183ce9378cf 100644 --- a/sql-odbc/src/odfesqlodbc/es_statement.cpp +++ b/sql-odbc/src/odfesqlodbc/es_statement.cpp @@ -262,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) { @@ -294,7 +295,8 @@ RETCODE AssignResult(StatementClass *stmt) { // Commit result to QResultClass ESResult *es_res = static_cast< ESResult * >(res->es_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; } diff --git a/sql-odbc/src/odfesqlodbc/es_statement.h b/sql-odbc/src/odfesqlodbc/es_statement.h index 455f226664a..4fff04ec598 100644 --- a/sql-odbc/src/odfesqlodbc/es_statement.h +++ b/sql-odbc/src/odfesqlodbc/es_statement.h @@ -17,7 +17,7 @@ #ifndef _ES_STATEMENT_H_ #define _ES_STATEMENT_H_ -#include "es_parse_result.h" +#include "opensearch_parse_result.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/es_parse_result.cpp b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp similarity index 78% rename from sql-odbc/src/odfesqlodbc/es_parse_result.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp index 55dfccadad8..026b3da0da0 100644 --- a/sql-odbc/src/odfesqlodbc/es_parse_result.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp @@ -14,7 +14,7 @@ * */ -#include "es_parse_result.h" +#include "opensearch_parse_result.h" #include @@ -34,16 +34,16 @@ 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, ESResult &opensearch_result); +bool _CC_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, ESResult &opensearch_result); +bool _CC_No_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, ESResult &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 ESResult &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, @@ -111,54 +111,56 @@ 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, ESResult &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, ESResult &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, ESResult &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, ESResult &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.es_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.es_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 +171,15 @@ 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, ESResult &opensearch_result) { // Note - NULL conn and/or cursor is valid if (q_res == NULL) return false; @@ -185,14 +187,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.es_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 +208,15 @@ 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, ESResult &opensearch_result) { // Note - NULL conn and/or cursor is valid if (q_res == NULL) return false; @@ -222,18 +224,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.es_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.es_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 +246,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 +266,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 ESResult &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; @@ -282,9 +284,10 @@ bool AssignColumnHeaders(const schema_type &doc_schema, QResultClass *q_res, : 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 +297,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 67% rename from sql-odbc/src/odfesqlodbc/es_parse_result.h rename to sql-odbc/src/odfesqlodbc/opensearch_parse_result.h index 91c7978d1e2..d3281bdfcfd 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 @@ -32,13 +32,13 @@ 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, ESResult &opensearch_result); +BOOL CC_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, ESResult &opensearch_result); +BOOL CC_No_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, + const char *cursor, ESResult &opensearch_result); +BOOL CC_Append_Table_Data(json_doc &opensearch_result_doc, QResultClass *q_res, size_t doc_schema_size, ColumnInfoClass &fields); #endif #endif From 4873929570e1209b4373a605d244d7f7e0e61601 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 16:52:00 -0700 Subject: [PATCH 12/36] Rename es_statement --- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 4 ++-- sql-odbc/src/odfesqlodbc/execute.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapi.c | 2 +- .../{es_statement.cpp => opensearch_statement.cpp} | 8 ++++---- .../{es_statement.h => opensearch_statement.h} | 6 +++--- sql-odbc/src/odfesqlodbc/qresult.c | 4 ++-- sql-odbc/src/odfesqlodbc/results.c | 2 +- sql-odbc/src/odfesqlodbc/statement.c | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) rename sql-odbc/src/odfesqlodbc/{es_statement.cpp => opensearch_statement.cpp} (98%) rename sql-odbc/src/odfesqlodbc/{es_statement.h => opensearch_statement.h} (90%) diff --git a/sql-odbc/src/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index 353c610627c..e75c35022ff 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -25,7 +25,7 @@ set( SOURCE_FILES qresult.c odbcapi30w.c opensearch_api30.c es_types.c es_utility.cpp opensearch_communication.cpp opensearch_connection.cpp es_odbc.c opensearch_driver_connect.cpp opensearch_helper.cpp opensearch_info.cpp opensearch_parse_result.cpp - opensearch_semaphore.cpp es_statement.cpp win_unicode.c odbcapi.c + opensearch_semaphore.cpp opensearch_statement.cpp win_unicode.c odbcapi.c odbcapiw.c es_result_queue.cpp ) if(WIN32) @@ -37,7 +37,7 @@ set( HEADER_FILES convert.h descriptor.h dlg_specific.h drvconn.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 - es_statement.h es_types.h loadlib.h + opensearch_statement.h es_types.h loadlib.h misc.h multibyte.h mylog.h es_utility.h resource.h statement.h tuple.h unicode_support.h opensearch_apifunc.h es_odbc.h opensearch_semaphore.h qresult.h diff --git a/sql-odbc/src/odfesqlodbc/execute.c b/sql-odbc/src/odfesqlodbc/execute.c index 181367b78cb..b596bbcd86e 100644 --- a/sql-odbc/src/odfesqlodbc/execute.c +++ b/sql-odbc/src/odfesqlodbc/execute.c @@ -27,10 +27,10 @@ #include "bind.h" #include "convert.h" #include "environ.h" -#include "es_statement.h" #include "es_types.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" +#include "opensearch_statement.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/odbcapi.c b/sql-odbc/src/odfesqlodbc/odbcapi.c index 040315fdd18..91c6661a088 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi.c @@ -19,13 +19,13 @@ #include "environ.h" #include "es_odbc.h" -#include "es_statement.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" diff --git a/sql-odbc/src/odfesqlodbc/es_statement.cpp b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp similarity index 98% rename from sql-odbc/src/odfesqlodbc/es_statement.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_statement.cpp index 183ce9378cf..a13c4b15803 100644 --- a/sql-odbc/src/odfesqlodbc/es_statement.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp @@ -14,7 +14,7 @@ * */ -#include "es_statement.h" +#include "opensearch_statement.h" #include "environ.h" // Critical section for statment #include "misc.h" @@ -308,9 +308,9 @@ RETCODE AssignResult(StatementClass *stmt) { return SQL_SUCCESS; } -void ClearESResult(void *es_result) { - if (es_result != NULL) { - ESResult *es_res = static_cast< ESResult * >(es_result); +void ClearOpenSearchResult(void *opensearch_result) { + if (opensearch_result != NULL) { + ESResult *es_res = static_cast< ESResult * >(opensearch_result); OpenSearchClearResult(es_res); } } diff --git a/sql-odbc/src/odfesqlodbc/es_statement.h b/sql-odbc/src/odfesqlodbc/opensearch_statement.h similarity index 90% rename from sql-odbc/src/odfesqlodbc/es_statement.h rename to sql-odbc/src/odfesqlodbc/opensearch_statement.h index 4fff04ec598..d55034240f3 100644 --- a/sql-odbc/src/odfesqlodbc/es_statement.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_statement.h @@ -14,8 +14,8 @@ * */ -#ifndef _ES_STATEMENT_H_ -#define _ES_STATEMENT_H_ +#ifndef _OPENSEARCH_STATEMENT_H_ +#define _OPENSEARCH_STATEMENT_H_ #include "opensearch_parse_result.h" #include "qresult.h" @@ -31,7 +31,7 @@ QResultClass *SendQueryGetResult(StatementClass *stmt, BOOL commit); RETCODE AssignResult(StatementClass *stmt); SQLRETURN ESAPI_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/qresult.c b/sql-odbc/src/odfesqlodbc/qresult.c index 0348076e264..52a78229bfd 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" /* @@ -468,7 +468,7 @@ void QR_free_memory(QResultClass *self) { self->updated_tuples = NULL; } if (self->es_result) { - ClearESResult(self->es_result); + ClearOpenSearchResult(self->es_result); self->es_result = NULL; } diff --git a/sql-odbc/src/odfesqlodbc/results.c b/sql-odbc/src/odfesqlodbc/results.c index 749989a76f3..2443d659286 100644 --- a/sql-odbc/src/odfesqlodbc/results.c +++ b/sql-odbc/src/odfesqlodbc/results.c @@ -23,11 +23,11 @@ #include "dlg_specific.h" #include "environ.h" #include "es_odbc.h" -#include "es_statement.h" #include "es_types.h" #include "misc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" +#include "opensearch_statement.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/statement.c b/sql-odbc/src/odfesqlodbc/statement.c index 57761f48b46..7e31ecd5841 100644 --- a/sql-odbc/src/odfesqlodbc/statement.c +++ b/sql-odbc/src/odfesqlodbc/statement.c @@ -32,7 +32,7 @@ #include "opensearch_apifunc.h" #include "opensearch_helper.h" -#include "es_statement.h" +#include "opensearch_statement.h" // clang-format on /* Map sql commands to statement types */ From e86dd334670f243400d767007e468899216439e1 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 16:59:52 -0700 Subject: [PATCH 13/36] Rename es_result_queue --- .../UnitTests/UTConn/test_query_execution.cpp | 10 +++--- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 4 +-- sql-odbc/src/odfesqlodbc/es_types.h | 6 ++-- .../odfesqlodbc/opensearch_communication.cpp | 20 ++++++------ .../odfesqlodbc/opensearch_communication.h | 15 ++++----- .../src/odfesqlodbc/opensearch_helper.cpp | 4 +-- sql-odbc/src/odfesqlodbc/opensearch_helper.h | 4 +-- .../odfesqlodbc/opensearch_parse_result.cpp | 31 ++++++++++++------- .../src/odfesqlodbc/opensearch_parse_result.h | 9 ++++-- ..._queue.cpp => opensearch_result_queue.cpp} | 12 +++---- ...sult_queue.h => opensearch_result_queue.h} | 18 +++++------ .../src/odfesqlodbc/opensearch_statement.cpp | 14 ++++----- sql-odbc/src/odfesqlodbc/qresult.h | 2 +- 13 files changed, 81 insertions(+), 68 deletions(-) rename sql-odbc/src/odfesqlodbc/{es_result_queue.cpp => opensearch_result_queue.cpp} (80%) rename sql-odbc/src/odfesqlodbc/{es_result_queue.h => opensearch_result_queue.h} (69%) diff --git a/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp b/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp index ffa47b37702..05a77ad5fb4 100644 --- a/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp +++ b/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp @@ -72,7 +72,7 @@ TEST(TestConnExecDirect, ValidQueryAllColumns) { 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); @@ -85,7 +85,7 @@ TEST(TestConnExecDirect, ValidQuerySomeColumns) { 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); @@ -98,7 +98,7 @@ TEST(TestConnExecDirect, InvalidQuery) { 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); } @@ -109,7 +109,7 @@ TEST(TestConnPopResult, PopEmptyQueue) { 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); } @@ -122,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/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index e75c35022ff..050016d4392 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -26,7 +26,7 @@ set( SOURCE_FILES es_utility.cpp opensearch_communication.cpp opensearch_connection.cpp es_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 es_result_queue.cpp + odbcapiw.c opensearch_result_queue.cpp ) if(WIN32) set(SOURCE_FILES ${SOURCE_FILES} dlg_wingui.c setup.c) @@ -41,7 +41,7 @@ set( HEADER_FILES misc.h multibyte.h mylog.h es_utility.h resource.h statement.h tuple.h unicode_support.h opensearch_apifunc.h es_odbc.h opensearch_semaphore.h qresult.h - version.h win_setup.h es_result_queue.h + version.h win_setup.h opensearch_result_queue.h ) # Generate dll (SHARED) diff --git a/sql-odbc/src/odfesqlodbc/es_types.h b/sql-odbc/src/odfesqlodbc/es_types.h index ab133ac9c87..a5eb7405b03 100644 --- a/sql-odbc/src/odfesqlodbc/es_types.h +++ b/sql-odbc/src/odfesqlodbc/es_types.h @@ -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; @@ -343,13 +343,13 @@ typedef struct ESResult { std::string result_json; std::string command_type; // SELECT / FETCH / etc rabbit::document es_result_doc; - ESResult() { + OpenSearchResult() { ref_count = 0; num_fields = 0; result_json = ""; command_type = ""; } -} ESResult; +} OpenSearchResult; #endif #endif diff --git a/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp index 7025ad04d20..992f010c243 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp @@ -131,7 +131,7 @@ void OpenSearchCommunication::AwsHttpResponseToString( output.assign(buf.data(), avail); } -void OpenSearchCommunication::PrepareCursorResult(ESResult& es_result) { +void OpenSearchCommunication::PrepareCursorResult(OpenSearchResult& es_result) { // Prepare document and validate result try { LogMsg(ES_DEBUG, "Parsing result JSON with cursor."); @@ -148,7 +148,7 @@ void OpenSearchCommunication::PrepareCursorResult(ESResult& es_result) { } std::shared_ptr< ErrorDetails > OpenSearchCommunication::ParseErrorResponse( - ESResult& es_result) { + OpenSearchResult& es_result) { // Prepare document and validate schema try { LogMsg(ES_DEBUG, "Parsing error response (with schema validation)"); @@ -190,7 +190,7 @@ void OpenSearchCommunication::SetErrorDetails(ErrorDetails details) { m_error_details = error_details; } -void OpenSearchCommunication::GetJsonSchema(ESResult& es_result) { +void OpenSearchCommunication::GetJsonSchema(OpenSearchResult& es_result) { // Prepare document and validate schema try { LogMsg(ES_DEBUG, "Parsing result JSON with schema."); @@ -555,7 +555,7 @@ std::vector< std::string > OpenSearchCommunication::GetColumnsWithSelectQuery( } // 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 @@ -629,7 +629,7 @@ int OpenSearchCommunication::ExecDirect(const char* query, const char* fetch_siz } // 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 @@ -653,7 +653,7 @@ int OpenSearchCommunication::ExecDirect(const char* query, const char* fetch_siz // 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()); @@ -705,7 +705,7 @@ void OpenSearchCommunication::SendCursorQueries(std::string cursor) { 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); @@ -759,7 +759,7 @@ void OpenSearchCommunication::StopResultRetrieval() { m_result_queue.clear(); } -void OpenSearchCommunication::ConstructESResult(ESResult& result) { +void OpenSearchCommunication::ConstructOpenSearchResult(OpenSearchResult& result) { GetJsonSchema(result); rabbit::array schema_array = result.es_result_doc["schema"]; for (rabbit::array::iterator it = schema_array.begin(); @@ -797,8 +797,8 @@ inline void OpenSearchCommunication::LogMsg(ESLogLevel level, const char* msg) { #endif // WIN32 } -ESResult* OpenSearchCommunication::PopResult() { - ESResult* result = NULL; +OpenSearchResult* OpenSearchCommunication::PopResult() { + OpenSearchResult* result = NULL; while (!m_result_queue.pop(QUEUE_TIMEOUT, result) && m_is_retrieving) { } diff --git a/sql-odbc/src/odfesqlodbc/opensearch_communication.h b/sql-odbc/src/odfesqlodbc/opensearch_communication.h index 5a625221ae7..a2c15c37551 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_communication.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.h @@ -23,7 +23,7 @@ #include #include #include "es_types.h" -#include "es_result_queue.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__ @@ -61,7 +61,7 @@ class OpenSearchCommunication { void LogMsg(ESLogLevel 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 OpenSearchCommunication { 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& es_result); + void PrepareCursorResult(OpenSearchResult& es_result); + std::shared_ptr< ErrorDetails > ParseErrorResponse( + OpenSearchResult& es_result); void SetErrorDetails(std::string reason, std::string message, ConnErrorType error_type); void SetErrorDetails(ErrorDetails details); @@ -100,7 +101,7 @@ class OpenSearchCommunication { 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/opensearch_helper.cpp b/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp index 9966640954f..8718309a6af 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp @@ -91,7 +91,7 @@ void OpenSearchSendCursorQueries(void* opensearch_conn, const char* cursor) { static_cast< OpenSearchCommunication* >(opensearch_conn)->SendCursorQueries(cursor); } -ESResult* OpenSearchGetResult(void* opensearch_conn) { +OpenSearchResult* OpenSearchGetResult(void* opensearch_conn) { return opensearch_conn ? static_cast< OpenSearchCommunication* >(opensearch_conn)->PopResult() : NULL; @@ -114,7 +114,7 @@ void OpenSearchDisconnect(void* opensearch_conn) { delete static_cast< OpenSearchCommunication* >(opensearch_conn); } -void OpenSearchClearResult(ESResult* opensearch_result) { +void OpenSearchClearResult(OpenSearchResult* opensearch_result) { delete opensearch_result; } diff --git a/sql-odbc/src/odfesqlodbc/opensearch_helper.h b/sql-odbc/src/odfesqlodbc/opensearch_helper.h index 85bf3dd0276..25b4bde4e35 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_helper.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_helper.h @@ -23,8 +23,8 @@ // C++ interface std::string OpenSearchGetClientEncoding(void* opensearch_conn); bool OpenSearchSetClientEncoding(void* opensearch_conn, std::string& encoding); -ESResult* OpenSearchGetResult(void* opensearch_conn); -void OpenSearchClearResult(ESResult* opensearch_result); +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); diff --git a/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp index 026b3da0da0..7ecfd145e68 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp @@ -35,14 +35,17 @@ typedef rabbit::array json_arr; typedef json_arr::iterator::result_type json_arr_it; bool _CC_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &opensearch_result); + const char *cursor, + OpenSearchResult &opensearch_result); bool _CC_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &opensearch_result); + const char *cursor, + OpenSearchResult &opensearch_result); bool _CC_No_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &opensearch_result); + 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 &opensearch_result); + 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, @@ -112,20 +115,23 @@ std::string GetResultParserError() { } BOOL CC_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &opensearch_result) { + const char *cursor, + OpenSearchResult &opensearch_result) { ClearError(); return _CC_from_OpenSearchResult(q_res, conn, cursor, opensearch_result) ? TRUE : FALSE; } BOOL CC_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &opensearch_result) { + const char *cursor, + OpenSearchResult &opensearch_result) { ClearError(); return _CC_Metadata_from_OpenSearchResult(q_res, conn, cursor, opensearch_result) ? TRUE : FALSE; } BOOL CC_No_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &opensearch_result) { + const char *cursor, + OpenSearchResult &opensearch_result) { ClearError(); return _CC_No_Metadata_from_OpenSearchResult(q_res, conn, cursor, opensearch_result) @@ -142,7 +148,8 @@ BOOL CC_Append_Table_Data(json_doc &opensearch_result_doc, QResultClass *q_res, } bool _CC_No_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &opensearch_result) { + const char *cursor, + OpenSearchResult &opensearch_result) { // Note - NULL conn and/or cursor is valid if (q_res == NULL) return false; @@ -179,7 +186,8 @@ bool _CC_No_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass } bool _CC_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &opensearch_result) { + const char *cursor, + OpenSearchResult &opensearch_result) { // Note - NULL conn and/or cursor is valid if (q_res == NULL) return false; @@ -216,7 +224,8 @@ bool _CC_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *co } bool _CC_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &opensearch_result) { + const char *cursor, + OpenSearchResult &opensearch_result) { // Note - NULL conn and/or cursor is valid if (q_res == NULL) return false; @@ -266,7 +275,7 @@ void GetSchemaInfo(schema_type &schema, json_doc &opensearch_result_doc) { } bool AssignColumnHeaders(const schema_type &doc_schema, QResultClass *q_res, - const ESResult &opensearch_result) { + const OpenSearchResult &opensearch_result) { // Verify server_info size matches the schema size if (opensearch_result.column_info.size() != doc_schema.size()) return false; diff --git a/sql-odbc/src/odfesqlodbc/opensearch_parse_result.h b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.h index d3281bdfcfd..0678e7044ee 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_parse_result.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.h @@ -33,11 +33,14 @@ typedef rabbit::document json_doc; // is sometimes used Cannot pass q_res as reference because it breaks qresult.h // macros that expect to use -> operator BOOL CC_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &opensearch_result); + const char *cursor, + OpenSearchResult &opensearch_result); BOOL CC_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &opensearch_result); + const char *cursor, + OpenSearchResult &opensearch_result); BOOL CC_No_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, - const char *cursor, ESResult &opensearch_result); + 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 diff --git a/sql-odbc/src/odfesqlodbc/es_result_queue.cpp b/sql-odbc/src/odfesqlodbc/opensearch_result_queue.cpp similarity index 80% rename from sql-odbc/src/odfesqlodbc/es_result_queue.cpp rename to sql-odbc/src/odfesqlodbc/opensearch_result_queue.cpp index 0943f1cd0ce..59485d38002 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" -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 69% rename from sql-odbc/src/odfesqlodbc/es_result_queue.h rename to sql-odbc/src/odfesqlodbc/opensearch_result_queue.h index 2ed4e9ec75c..0ffe03def36 100644 --- a/sql-odbc/src/odfesqlodbc/es_result_queue.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_result_queue.h @@ -13,8 +13,8 @@ * permissions and limitations under the License. * */ -#ifndef ES_RESULT_QUEUE -#define ES_RESULT_QUEUE +#ifndef OPENSEARCH_RESULT_QUEUE +#define OPENSEARCH_RESULT_QUEUE #include #include @@ -23,19 +23,19 @@ #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; opensearch_semaphore m_push_semaphore; opensearch_semaphore m_pop_semaphore; diff --git a/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp index a13c4b15803..9bb51b95200 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp @@ -171,7 +171,7 @@ SQLRETURN GetNextResultSet(StatementClass *stmt) { return SQL_ERROR; } - ESResult *es_res = OpenSearchGetResult(conn->esconn); + OpenSearchResult *es_res = OpenSearchGetResult(conn->esconn); if (es_res != NULL) { // Save server cursor id to fetch more pages later if (es_res->es_result_doc.has("cursor")) { @@ -253,8 +253,8 @@ QResultClass *SendQueryGetResult(StatementClass *stmt, BOOL commit) { } res->rstatus = PORES_COMMAND_OK; - // Get ESResult - ESResult *es_res = OpenSearchGetResult(conn->esconn); + // Get OpenSearchResult + OpenSearchResult *es_res = OpenSearchGetResult(conn->esconn); if (es_res == NULL) { QR_Destructor(res); return NULL; @@ -273,11 +273,11 @@ QResultClass *SendQueryGetResult(StatementClass *stmt, BOOL commit) { } if (commit) { - // Deallocate ESResult + // Deallocate OpenSearchResult OpenSearchClearResult(es_res); res->es_result = NULL; } else { - // Set ESResult into connection class so it can be used later + // Set OpenSearchResult into connection class so it can be used later res->es_result = es_res; } return res; @@ -293,7 +293,7 @@ RETCODE AssignResult(StatementClass *stmt) { } // Commit result to QResultClass - ESResult *es_res = static_cast< ESResult * >(res->es_result); + OpenSearchResult *es_res = static_cast< OpenSearchResult * >(res->es_result); ConnectionClass *conn = SC_get_conn(stmt); if (!CC_No_Metadata_from_OpenSearchResult(res, conn, res->cursor_name, *es_res)) { @@ -310,7 +310,7 @@ RETCODE AssignResult(StatementClass *stmt) { void ClearOpenSearchResult(void *opensearch_result) { if (opensearch_result != NULL) { - ESResult *es_res = static_cast< ESResult * >(opensearch_result); + OpenSearchResult *es_res = static_cast< OpenSearchResult * >(opensearch_result); OpenSearchClearResult(es_res); } } diff --git a/sql-odbc/src/odfesqlodbc/qresult.h b/sql-odbc/src/odfesqlodbc/qresult.h index 9089452390f..5c8619c9b1f 100644 --- a/sql-odbc/src/odfesqlodbc/qresult.h +++ b/sql-odbc/src/odfesqlodbc/qresult.h @@ -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, From 78cff890b508d5214ce3485aaf06c5b69ad8755e Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 17:04:50 -0700 Subject: [PATCH 14/36] Rename es_utility --- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 4 +-- .../src/odfesqlodbc/opensearch_connection.h | 2 +- ...{es_utility.cpp => opensearch_utility.cpp} | 28 +++++++++---------- .../{es_utility.h => opensearch_utility.h} | 22 +++++++-------- 4 files changed, 28 insertions(+), 28 deletions(-) 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/sql-odbc/src/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index 050016d4392..07df12e7757 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -23,7 +23,7 @@ set( SOURCE_FILES misc.c multibyte.c mylog.c tuple.c parse.c results.c statement.c odbcapi30.c qresult.c odbcapi30w.c opensearch_api30.c es_types.c - es_utility.cpp opensearch_communication.cpp opensearch_connection.cpp es_odbc.c + opensearch_utility.cpp opensearch_communication.cpp opensearch_connection.cpp es_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 @@ -38,7 +38,7 @@ set( HEADER_FILES 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 es_types.h loadlib.h - misc.h multibyte.h mylog.h es_utility.h + misc.h multibyte.h mylog.h opensearch_utility.h resource.h statement.h tuple.h unicode_support.h opensearch_apifunc.h es_odbc.h opensearch_semaphore.h qresult.h version.h win_setup.h opensearch_result_queue.h diff --git a/sql-odbc/src/odfesqlodbc/opensearch_connection.h b/sql-odbc/src/odfesqlodbc/opensearch_connection.h index 2596c94b6d7..c054ff0eeb0 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_connection.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_connection.h @@ -23,8 +23,8 @@ #include "descriptor.h" #include "es_odbc.h" -#include "es_utility.h" #include "opensearch_helper.h" +#include "opensearch_utility.h" #ifdef __cplusplus extern "C" { 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 1da446eaaed..80cf269660f 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 0093a39ef03..6c1615b189f 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 */ From cc3179c0a63736e83bf1fb22d1ccc45e0de804a2 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 17:28:10 -0700 Subject: [PATCH 15/36] Rename es_types --- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 4 +- sql-odbc/src/odfesqlodbc/bind.c | 2 +- sql-odbc/src/odfesqlodbc/columninfo.c | 4 +- sql-odbc/src/odfesqlodbc/convert.c | 108 ++-- sql-odbc/src/odfesqlodbc/execute.c | 2 +- sql-odbc/src/odfesqlodbc/info.c | 267 +++++----- .../odfesqlodbc/opensearch_communication.h | 2 +- sql-odbc/src/odfesqlodbc/opensearch_helper.h | 2 +- sql-odbc/src/odfesqlodbc/opensearch_info.cpp | 161 +++--- sql-odbc/src/odfesqlodbc/opensearch_info.h | 2 +- .../odfesqlodbc/opensearch_parse_result.cpp | 52 +- .../odfesqlodbc/opensearch_result_queue.cpp | 2 +- .../{es_types.c => opensearch_types.c} | 472 +++++++++--------- .../{es_types.h => opensearch_types.h} | 150 +++--- sql-odbc/src/odfesqlodbc/parse.c | 8 +- sql-odbc/src/odfesqlodbc/results.c | 4 +- sql-odbc/src/odfesqlodbc/statement.h | 2 +- 17 files changed, 654 insertions(+), 590 deletions(-) rename sql-odbc/src/odfesqlodbc/{es_types.c => opensearch_types.c} (81%) rename sql-odbc/src/odfesqlodbc/{es_types.h => opensearch_types.h} (77%) diff --git a/sql-odbc/src/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index 07df12e7757..250150ed6f1 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -22,7 +22,7 @@ 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 opensearch_api30.c es_types.c + qresult.c odbcapi30w.c opensearch_api30.c opensearch_types.c opensearch_utility.cpp opensearch_communication.cpp opensearch_connection.cpp es_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 @@ -37,7 +37,7 @@ set( HEADER_FILES convert.h descriptor.h dlg_specific.h drvconn.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 es_types.h loadlib.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 opensearch_apifunc.h es_odbc.h opensearch_semaphore.h qresult.h diff --git a/sql-odbc/src/odfesqlodbc/bind.c b/sql-odbc/src/odfesqlodbc/bind.c index 79f498e9bd3..62e99e34581 100644 --- a/sql-odbc/src/odfesqlodbc/bind.c +++ b/sql-odbc/src/odfesqlodbc/bind.c @@ -21,10 +21,10 @@ #include "descriptor.h" #include "environ.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" diff --git a/sql-odbc/src/odfesqlodbc/columninfo.c b/sql-odbc/src/odfesqlodbc/columninfo.c index 95149b4317f..f0a78d186e2 100644 --- a/sql-odbc/src/odfesqlodbc/columninfo.c +++ b/sql-odbc/src/odfesqlodbc/columninfo.c @@ -19,7 +19,7 @@ #include #include -#include "es_types.h" +#include "opensearch_types.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" @@ -83,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/convert.c b/sql-odbc/src/odfesqlodbc/convert.c index 6d49f038caf..e13f00c81b3 100644 --- a/sql-odbc/src/odfesqlodbc/convert.c +++ b/sql-odbc/src/odfesqlodbc/convert.c @@ -38,7 +38,7 @@ #include "bind.h" #include "catfunc.h" -#include "es_types.h" +#include "opensearch_types.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" #include "qresult.h" @@ -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 */ @@ -716,13 +716,13 @@ static int setup_getdataclass(SQLLEN *const length_return, 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) @@ -887,9 +887,9 @@ static int convert_text_field_to_sql_c( MYLOG(ES_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; } @@ -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; /* @@ -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; @@ -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); @@ -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(ES_DEBUG, "OPENSEARCH_TYPE_UUID: rgbValueBindRow = '%s'\n", rgbValueBindRow); break; @@ -1351,7 +1351,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, * 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,7 +1370,7 @@ 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 { @@ -1590,7 +1590,7 @@ 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); @@ -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) diff --git a/sql-odbc/src/odfesqlodbc/execute.c b/sql-odbc/src/odfesqlodbc/execute.c index b596bbcd86e..8ea97792929 100644 --- a/sql-odbc/src/odfesqlodbc/execute.c +++ b/sql-odbc/src/odfesqlodbc/execute.c @@ -27,7 +27,7 @@ #include "bind.h" #include "convert.h" #include "environ.h" -#include "es_types.h" +#include "opensearch_types.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" #include "opensearch_statement.h" diff --git a/sql-odbc/src/odfesqlodbc/info.c b/sql-odbc/src/odfesqlodbc/info.c index f5ce1b70eb6..3a8ca5399ab 100644 --- a/sql-odbc/src/odfesqlodbc/info.c +++ b/sql-odbc/src/odfesqlodbc/info.c @@ -28,7 +28,7 @@ #include "catfunc.h" #include "dlg_specific.h" #include "environ.h" -#include "es_types.h" +#include "opensearch_types.h" #include "misc.h" #include "multibyte.h" #include "opensearch_apifunc.h" @@ -915,28 +915,31 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, } /* - * macros for estype_xxxx() calls which have ES_ATP_UNSET parameters + * macros for estype_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) + estype_attr_column_size(conn, esType, OPENSEARCH_ATP_UNSET, \ + OPENSEARCH_ADT_UNSET, OPENSEARCH_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) + estype_attr_to_concise_type(conn, esType, OPENSEARCH_ATP_UNSET, \ + OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) #define ESTYPE_TO_SQLDESCTYPE(conn, esType) \ - estype_attr_to_sqldesctype(conn, esType, ES_ATP_UNSET, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) + estype_attr_to_sqldesctype(conn, esType, OPENSEARCH_ATP_UNSET, \ + OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) #define ESTYPE_BUFFER_LENGTH(conn, esType) \ - estype_attr_buffer_length(conn, esType, ES_ATP_UNSET, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) + estype_attr_buffer_length(conn, esType, OPENSEARCH_ATP_UNSET, \ + OPENSEARCH_ADT_UNSET, OPENSEARCH_UNKNOWNS_UNSET) #define ESTYPE_DECIMAL_DIGITS(conn, esType) \ - estype_attr_decimal_digits(conn, esType, ES_ATP_UNSET, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) + estype_attr_decimal_digits(conn, esType, OPENSEARCH_ATP_UNSET, \ + OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) #define ESTYPE_TRANSFER_OCTET_LENGTH(conn, esType) \ - estype_attr_transfer_octet_length(conn, esType, ES_ATP_UNSET, \ - ES_UNKNOWNS_UNSET) + estype_attr_transfer_octet_length(conn, esType, OPENSEARCH_ATP_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) #define ESTYPE_TO_NAME(conn, esType, auto_increment) \ - estype_attr_to_name(conn, esType, ES_ATP_UNSET, auto_increment) + estype_attr_to_name(conn, esType, OPENSEARCH_ATP_UNSET, auto_increment) RETCODE SQL_API ESAPI_GetFunctions(HDBC hdbc, SQLUSMALLINT fFunction, SQLUSMALLINT *pfExists) { @@ -1240,29 +1243,29 @@ char *identifierEscape(const SQLCHAR *src, SQLLEN srclen, /* * macros for estype_attr_xxxx() calls which have - * ES_ADT_UNSET or ES_UNKNOWNS_UNSET parameters + * 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) + estype_attr_column_size(conn, esType, atttypmod, OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_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) + estype_attr_to_concise_type(conn, esType, atttypmod, OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) #define ESTYPE_ATTR_TO_SQLDESCTYPE(conn, esType, atttypmod) \ - estype_attr_to_sqldesctype(conn, esType, atttypmod, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) + estype_attr_to_sqldesctype(conn, esType, atttypmod, OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) #define ESTYPE_ATTR_DISPLAY_SIZE(conn, esType, atttypmod) \ - estype_attr_display_size(conn, esType, atttypmod, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) + estype_attr_display_size(conn, esType, atttypmod, OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) #define ESTYPE_ATTR_BUFFER_LENGTH(conn, esType, atttypmod) \ - estype_attr_buffer_length(conn, esType, atttypmod, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) + estype_attr_buffer_length(conn, esType, atttypmod, OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) #define ESTYPE_ATTR_DECIMAL_DIGITS(conn, esType, atttypmod) \ - estype_attr_decimal_digits(conn, esType, atttypmod, ES_ADT_UNSET, \ - ES_UNKNOWNS_UNSET) + estype_attr_decimal_digits(conn, esType, atttypmod, OPENSEARCH_ADT_UNSET, \ + OPENSEARCH_UNKNOWNS_UNSET) #define ESTYPE_ATTR_TRANSFER_OCTET_LENGTH(conn, esType, atttypmod) \ estype_attr_transfer_octet_length(conn, esType, atttypmod, \ - ES_UNKNOWNS_UNSET) + OPENSEARCH_UNKNOWNS_UNSET) RETCODE SQL_API ESAPI_SpecialColumns( HSTMT hstmt, SQLUSMALLINT fColType, const SQLCHAR *szTableQualifier, @@ -1298,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); @@ -1364,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); @@ -1436,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); @@ -1509,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 @@ -1576,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 @@ -1658,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); @@ -1746,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); @@ -1816,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/opensearch_communication.h b/sql-odbc/src/odfesqlodbc/opensearch_communication.h index a2c15c37551..6289d068d95 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_communication.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.h @@ -22,7 +22,7 @@ #include #include #include -#include "es_types.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 diff --git a/sql-odbc/src/odfesqlodbc/opensearch_helper.h b/sql-odbc/src/odfesqlodbc/opensearch_helper.h index 25b4bde4e35..f3c77b364d3 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_helper.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_helper.h @@ -17,7 +17,7 @@ #ifndef __OPENSEARCH_HELPER_H__ #define __OPENSEARCH_HELPER_H__ -#include "es_types.h" +#include "opensearch_types.h" #ifdef __cplusplus // C++ interface diff --git a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp index 64cc0bd09dd..04eebcbc5ab 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp @@ -72,32 +72,33 @@ #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}}, + {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 { @@ -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); } @@ -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); } @@ -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, @@ -945,8 +966,8 @@ 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)); + estype_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)); set_nullfield_string(&tuple[GETTYPE_LITERAL_SUFFIX], @@ -964,7 +985,7 @@ RETCODE SetTypeResult(ConnectionClass *conn, StatementClass *stmt, 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)); + estype_attr_to_datetime_sub(conn, esType, OPENSEARCH_ATP_UNSET)); set_nullfield_int4(&tuple[GETTYPE_NUM_PREC_RADIX], estype_radix(conn, esType)); set_nullfield_int4(&tuple[GETTYPE_INTERVAL_PRECISION], 0); diff --git a/sql-odbc/src/odfesqlodbc/opensearch_info.h b/sql-odbc/src/odfesqlodbc/opensearch_info.h index c356c94c088..7564988b6ee 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_info.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_info.h @@ -28,11 +28,11 @@ #include "catfunc.h" #include "dlg_specific.h" #include "environ.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" diff --git a/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp index 7ecfd145e68..bd7c66db51d 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp @@ -18,7 +18,7 @@ #include -#include "es_types.h" +#include "opensearch_types.h" #include "opensearch_helper.h" #ifdef __APPLE__ #pragma clang diagnostic push @@ -72,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}}; + {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 ES_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)ES_VARCHAR_SIZE}, + {OPENSEARCH_TYPE_DATE, (int16_t)ES_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 @@ -289,7 +289,7 @@ 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, diff --git a/sql-odbc/src/odfesqlodbc/opensearch_result_queue.cpp b/sql-odbc/src/odfesqlodbc/opensearch_result_queue.cpp index 59485d38002..f7cab25f1b7 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_result_queue.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_result_queue.cpp @@ -16,7 +16,7 @@ #include "opensearch_result_queue.h" -#include "es_types.h" +#include "opensearch_types.h" OpenSearchResultQueue::OpenSearchResultQueue(unsigned int capacity) : m_push_semaphore(capacity, capacity), diff --git a/sql-odbc/src/odfesqlodbc/es_types.c b/sql-odbc/src/odfesqlodbc/opensearch_types.c similarity index 81% rename from sql-odbc/src/odfesqlodbc/es_types.c rename to sql-odbc/src/odfesqlodbc/opensearch_types.c index 38983eda1ac..a5d9cb60ad5 100644 --- a/sql-odbc/src/odfesqlodbc/es_types.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.c @@ -14,7 +14,7 @@ * */ -#include "es_types.h" +#include "opensearch_types.h" #include "dlg_specific.h" #include "environ.h" @@ -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; } @@ -247,15 +247,15 @@ 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: + case OPENSEARCH_TYPE_VARCHAR: if (getCharColumnSizeX(conn, type, atttypmod, adtsize_or_longestlen, handle_unknown_size_as) > MAX_VARCHAR_SIZE) @@ -265,7 +265,7 @@ 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, @@ -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: 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; @@ -373,7 +373,7 @@ estype_attr_to_sqldesctype(const ConnectionClass *conn, OID type, int atttypmod, 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, @@ -403,57 +403,57 @@ estype_attr_to_ctype(const ConnectionClass *conn, OID type, int atttypmod) { #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: 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; @@ -478,38 +478,38 @@ const char *estype_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; } } @@ -518,33 +518,33 @@ estype_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; @@ -555,16 +555,16 @@ SQLSMALLINT estype_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 */ } @@ -577,44 +577,44 @@ Int4 estype_attr_display_size(const ConnectionClass *conn, OID type, 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, ES_REAL_DIGITS digits, a decimal point, the letter E, a sign, and 2 digits */ return (1 + ES_REAL_DIGITS + 1 + 1 + 3); - case ES_TYPE_FLOAT8: /* a sign, ES_DOUBLE_DIGITS digits, a decimal + case OPENSEARCH_TYPE_FLOAT8: /* a sign, ES_DOUBLE_DIGITS digits, a decimal point, the letter E, a sign, and 3 digits */ return (1 + ES_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 */ @@ -631,53 +631,53 @@ Int4 estype_attr_buffer_length(const ConnectionClass *conn, OID type, 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: + case OPENSEARCH_TYPE_INT8: if (SQL_C_CHAR == estype_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, @@ -701,7 +701,7 @@ 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 */ @@ -720,38 +720,38 @@ Int4 estype_attr_desclength(const ConnectionClass *conn, OID type, 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: + 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 estype_attr_column_size(conn, type, atttypmod, adtsize_or_longestlen, handle_unknown_size_as); @@ -766,36 +766,36 @@ Int2 estype_attr_decimal_digits(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int UNUSED_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); #ifdef ES_INTERVAL_AS_SQL_INTERVAL - case ES_TYPE_INTERVAL: + case OPENSEARCH_TYPE_INTERVAL: return getIntervalDecimalDigits(type, atttypmod); #endif /* ES_INTERVAL_AS_SQL_INTERVAL */ @@ -808,7 +808,7 @@ Int2 estype_attr_scale(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int UNUSED_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); @@ -823,12 +823,13 @@ Int4 estype_attr_transfer_octet_length(const ConnectionClass *conn, OID type, Int4 maxvarc, column_size; switch (type) { - case ES_TYPE_VARCHAR: - case ES_TYPE_BPCHAR: - case ES_TYPE_TEXT: - case ES_TYPE_UNKNOWN: + case OPENSEARCH_TYPE_VARCHAR: + case OPENSEARCH_TYPE_BPCHAR: + case OPENSEARCH_TYPE_TEXT: + case OPENSEARCH_TYPE_UNKNOWN: column_size = estype_attr_column_size( - conn, type, atttypmod, ES_ADT_UNSET, handle_unknown_size_as); + conn, type, atttypmod, + OPENSEARCH_ADT_UNSET, handle_unknown_size_as); if (SQL_NO_TOTAL == column_size) return column_size; #ifdef UNICODE_SUPPORT @@ -845,13 +846,14 @@ 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, + case OPENSEARCH_TYPE_BYTEA: + return estype_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, + OPENSEARCH_ADT_UNSET, handle_unknown_size_as); } return -1; @@ -928,44 +930,44 @@ OID sqltype_to_estype(const ConnectionClass *conn, SQLSMALLINT fSqlType) { OID esType = 0; switch (fSqlType) { case SQL_BINARY: - esType = ES_TYPE_BYTEA; + esType = OPENSEARCH_TYPE_BYTEA; break; case SQL_CHAR: - esType = ES_TYPE_BPCHAR; + esType = OPENSEARCH_TYPE_BPCHAR; break; #ifdef UNICODE_SUPPORT case SQL_WCHAR: - esType = ES_TYPE_BPCHAR; + esType = OPENSEARCH_TYPE_BPCHAR; break; #endif /* UNICODE_SUPPORT */ case SQL_BIT: - esType = ES_TYPE_BOOL; + esType = OPENSEARCH_TYPE_BOOL; break; case SQL_TYPE_DATE: case SQL_DATE: - esType = ES_TYPE_DATE; + esType = OPENSEARCH_TYPE_DATE; break; case SQL_DOUBLE: case SQL_FLOAT: - esType = ES_TYPE_FLOAT8; + esType = OPENSEARCH_TYPE_FLOAT8; break; case SQL_DECIMAL: case SQL_NUMERIC: - esType = ES_TYPE_NUMERIC; + esType = OPENSEARCH_TYPE_NUMERIC; break; case SQL_BIGINT: - esType = ES_TYPE_INT8; + esType = OPENSEARCH_TYPE_INT8; break; case SQL_INTEGER: - esType = ES_TYPE_INT4; + esType = OPENSEARCH_TYPE_INT4; break; case SQL_LONGVARBINARY: @@ -973,51 +975,51 @@ OID sqltype_to_estype(const ConnectionClass *conn, SQLSMALLINT fSqlType) { break; case SQL_LONGVARCHAR: - esType = ES_TYPE_VARCHAR; + esType = OPENSEARCH_TYPE_VARCHAR; break; #ifdef UNICODE_SUPPORT case SQL_WLONGVARCHAR: - esType = ES_TYPE_VARCHAR; + esType = OPENSEARCH_TYPE_VARCHAR; break; #endif /* UNICODE_SUPPORT */ case SQL_REAL: - esType = ES_TYPE_FLOAT4; + esType = OPENSEARCH_TYPE_FLOAT4; break; case SQL_SMALLINT: case SQL_TINYINT: - esType = ES_TYPE_INT2; + esType = OPENSEARCH_TYPE_INT2; break; case SQL_TIME: case SQL_TYPE_TIME: - esType = ES_TYPE_TIME; + esType = OPENSEARCH_TYPE_TIME; break; case SQL_TIMESTAMP: case SQL_TYPE_TIMESTAMP: - esType = ES_TYPE_DATETIME; + esType = OPENSEARCH_TYPE_DATETIME; break; case SQL_VARBINARY: - esType = ES_TYPE_BYTEA; + esType = OPENSEARCH_TYPE_BYTEA; break; case SQL_VARCHAR: - esType = ES_TYPE_VARCHAR; + esType = OPENSEARCH_TYPE_VARCHAR; break; #ifdef UNICODE_SUPPORT case SQL_WVARCHAR: - esType = ES_TYPE_VARCHAR; + esType = OPENSEARCH_TYPE_VARCHAR; break; #endif /* UNICODE_SUPPORT */ case SQL_GUID: if (OPENSEARCH_VERSION_GE(conn, 8.3)) - esType = ES_TYPE_UUID; + esType = OPENSEARCH_TYPE_UUID; break; case SQL_INTERVAL_MONTH: @@ -1033,7 +1035,7 @@ 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; + esType = OPENSEARCH_TYPE_INTERVAL; break; } @@ -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; @@ -1127,7 +1129,7 @@ const char *estype_to_name(const StatementClass *stmt, OID type, int col, /* * 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. @@ -1205,9 +1207,9 @@ Int4 estype_transfer_octet_length(const StatementClass *stmt, OID type, 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) @@ -1292,8 +1294,8 @@ Int2 estype_auto_increment(const ConnectionClass *conn, OID type) { Int2 estype_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: @@ -1314,22 +1316,22 @@ Int2 estype_searchable(const ConnectionClass *conn, OID type) { Int2 estype_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: @@ -1340,10 +1342,10 @@ Int2 estype_unsigned(const ConnectionClass *conn, OID type) { const char *estype_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 ""; @@ -1353,10 +1355,10 @@ const char *estype_literal_prefix(const ConnectionClass *conn, OID type) { const char *estype_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 ""; diff --git a/sql-odbc/src/odfesqlodbc/es_types.h b/sql-odbc/src/odfesqlodbc/opensearch_types.h similarity index 77% rename from sql-odbc/src/odfesqlodbc/es_types.h rename to sql-odbc/src/odfesqlodbc/opensearch_types.h index a5eb7405b03..e93f962a679 100644 --- a/sql-odbc/src/odfesqlodbc/es_types.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.h @@ -14,8 +14,8 @@ * */ -#ifndef ES_TYPES -#define ES_TYPES +#ifndef OPENSEARCH_TYPES +#define OPENSEARCH_TYPES #include "dlg_specific.h" #include "es_odbc.h" @@ -30,92 +30,92 @@ extern "C" { #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 +#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); diff --git a/sql-odbc/src/odfesqlodbc/parse.c b/sql-odbc/src/odfesqlodbc/parse.c index b708fea124c..17b5b70a821 100644 --- a/sql-odbc/src/odfesqlodbc/parse.c +++ b/sql-odbc/src/odfesqlodbc/parse.c @@ -20,7 +20,7 @@ #include "catfunc.h" #include "es_odbc.h" -#include "es_types.h" +#include "opensearch_types.h" #include "misc.h" #include "multibyte.h" #include "opensearch_apifunc.h" @@ -36,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/results.c b/sql-odbc/src/odfesqlodbc/results.c index 2443d659286..45c57e02d4b 100644 --- a/sql-odbc/src/odfesqlodbc/results.c +++ b/sql-odbc/src/odfesqlodbc/results.c @@ -23,7 +23,7 @@ #include "dlg_specific.h" #include "environ.h" #include "es_odbc.h" -#include "es_types.h" +#include "opensearch_types.h" #include "misc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" @@ -636,7 +636,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) diff --git a/sql-odbc/src/odfesqlodbc/statement.h b/sql-odbc/src/odfesqlodbc/statement.h index 59e165e4063..14cd90cb1e8 100644 --- a/sql-odbc/src/odfesqlodbc/statement.h +++ b/sql-odbc/src/odfesqlodbc/statement.h @@ -22,7 +22,7 @@ #include "bind.h" #include "descriptor.h" #include "es_odbc.h" -#include "es_types.h" +#include "opensearch_types.h" #include "opensearch_helper.h" #include "tuple.h" From 5c3f538e9a0f7b54a302cd980b81addd45de0a29 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 17:36:47 -0700 Subject: [PATCH 16/36] Rename es_odbc --- .../performance_odbc_execution.cpp | 2 +- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 4 +- sql-odbc/src/odfesqlodbc/bind.h | 2 +- sql-odbc/src/odfesqlodbc/catfunc.h | 2 +- sql-odbc/src/odfesqlodbc/columninfo.h | 2 +- sql-odbc/src/odfesqlodbc/connection.c | 2 +- sql-odbc/src/odfesqlodbc/convert.c | 6 +-- sql-odbc/src/odfesqlodbc/convert.h | 2 +- sql-odbc/src/odfesqlodbc/descriptor.c | 4 +- sql-odbc/src/odfesqlodbc/descriptor.h | 6 +-- sql-odbc/src/odfesqlodbc/dlg_specific.h | 2 +- sql-odbc/src/odfesqlodbc/drvconn.c | 2 +- sql-odbc/src/odfesqlodbc/drvconn.h | 2 +- sql-odbc/src/odfesqlodbc/environ.c | 22 +++++----- sql-odbc/src/odfesqlodbc/environ.h | 2 +- sql-odbc/src/odfesqlodbc/execute.c | 2 +- sql-odbc/src/odfesqlodbc/info.c | 6 +-- sql-odbc/src/odfesqlodbc/loadlib.h | 2 +- sql-odbc/src/odfesqlodbc/misc.c | 2 +- sql-odbc/src/odfesqlodbc/multibyte.h | 2 +- sql-odbc/src/odfesqlodbc/mylog.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapi.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapi30.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapi30w.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapiw.c | 2 +- sql-odbc/src/odfesqlodbc/opensearch_api30.c | 2 +- sql-odbc/src/odfesqlodbc/opensearch_apifunc.h | 3 +- .../odfesqlodbc/opensearch_communication.cpp | 2 +- .../src/odfesqlodbc/opensearch_connection.h | 2 +- .../odfesqlodbc/opensearch_driver_connect.cpp | 2 +- sql-odbc/src/odfesqlodbc/opensearch_info.h | 2 +- .../{es_odbc.c => opensearch_odbc.c} | 3 +- .../{es_odbc.h => opensearch_odbc.h} | 42 +++++++++---------- sql-odbc/src/odfesqlodbc/opensearch_types.c | 12 +++--- sql-odbc/src/odfesqlodbc/opensearch_types.h | 2 +- sql-odbc/src/odfesqlodbc/options.c | 2 +- sql-odbc/src/odfesqlodbc/parse.c | 4 +- sql-odbc/src/odfesqlodbc/qresult.h | 2 +- sql-odbc/src/odfesqlodbc/results.c | 4 +- sql-odbc/src/odfesqlodbc/setup.c | 2 +- sql-odbc/src/odfesqlodbc/statement.c | 9 ++-- sql-odbc/src/odfesqlodbc/statement.h | 6 +-- sql-odbc/src/odfesqlodbc/tuple.h | 2 +- sql-odbc/src/odfesqlodbc/unicode_support.h | 2 +- sql-odbc/src/odfesqlodbc/win_unicode.c | 24 +++++------ 45 files changed, 108 insertions(+), 107 deletions(-) rename sql-odbc/src/odfesqlodbc/{es_odbc.c => opensearch_odbc.c} (99%) rename sql-odbc/src/odfesqlodbc/{es_odbc.h => opensearch_odbc.h} (95%) diff --git a/sql-odbc/src/PerformanceTests/PTODBCExecution/performance_odbc_execution.cpp b/sql-odbc/src/PerformanceTests/PTODBCExecution/performance_odbc_execution.cpp index e1d7942366c..9e73803e505 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 diff --git a/sql-odbc/src/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index 250150ed6f1..18e910801cd 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -23,7 +23,7 @@ set( SOURCE_FILES misc.c multibyte.c mylog.c tuple.c parse.c results.c statement.c odbcapi30.c qresult.c odbcapi30w.c opensearch_api30.c opensearch_types.c - opensearch_utility.cpp opensearch_communication.cpp opensearch_connection.cpp es_odbc.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 @@ -40,7 +40,7 @@ set( HEADER_FILES 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 - opensearch_apifunc.h es_odbc.h opensearch_semaphore.h qresult.h + opensearch_apifunc.h opensearch_odbc.h opensearch_semaphore.h qresult.h version.h win_setup.h opensearch_result_queue.h ) diff --git a/sql-odbc/src/odfesqlodbc/bind.h b/sql-odbc/src/odfesqlodbc/bind.h index 7ddb1d76f46..1153de4927e 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 diff --git a/sql-odbc/src/odfesqlodbc/catfunc.h b/sql-odbc/src/odfesqlodbc/catfunc.h index 647e68f4d8a..afd799d45f1 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.h b/sql-odbc/src/odfesqlodbc/columninfo.h index c1e9a0ec30b..46131a8a477 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 diff --git a/sql-odbc/src/odfesqlodbc/connection.c b/sql-odbc/src/odfesqlodbc/connection.c index ba5d1611545..13208f440a7 100644 --- a/sql-odbc/src/odfesqlodbc/connection.c +++ b/sql-odbc/src/odfesqlodbc/connection.c @@ -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 diff --git a/sql-odbc/src/odfesqlodbc/convert.c b/sql-odbc/src/odfesqlodbc/convert.c index e13f00c81b3..b7f0588210e 100644 --- a/sql-odbc/src/odfesqlodbc/convert.c +++ b/sql-odbc/src/odfesqlodbc/convert.c @@ -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); @@ -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; diff --git a/sql-odbc/src/odfesqlodbc/convert.h b/sql-odbc/src/odfesqlodbc/convert.h index 31f112e67cb..fe5473101a2 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" { diff --git a/sql-odbc/src/odfesqlodbc/descriptor.c b/sql-odbc/src/odfesqlodbc/descriptor.c index b89840b2020..a07dc82753e 100644 --- a/sql-odbc/src/odfesqlodbc/descriptor.c +++ b/sql-odbc/src/odfesqlodbc/descriptor.c @@ -536,9 +536,9 @@ 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; diff --git a/sql-odbc/src/odfesqlodbc/descriptor.h b/sql-odbc/src/odfesqlodbc/descriptor.h index 6ff4f4bfec3..4a6069e652c 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) @@ -116,7 +116,7 @@ typedef struct DescriptorHeader_ { UInt4 error_index; /* 1-based index */ Int4 __error_number; char *__error_message; - ES_ErrorInfo *eserror; + OpenSearch_ErrorInfo *eserror; } 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.h b/sql-odbc/src/odfesqlodbc/dlg_specific.h index 6ac9f8ef77f..63c0ae6934f 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 diff --git a/sql-odbc/src/odfesqlodbc/drvconn.c b/sql-odbc/src/odfesqlodbc/drvconn.c index b65bef10c1c..07e070325b9 100644 --- a/sql-odbc/src/odfesqlodbc/drvconn.c +++ b/sql-odbc/src/odfesqlodbc/drvconn.c @@ -19,9 +19,9 @@ #include #include -#include "es_odbc.h" #include "misc.h" #include "opensearch_connection.h" +#include "opensearch_odbc.h" #ifndef WIN32 #include diff --git a/sql-odbc/src/odfesqlodbc/drvconn.h b/sql-odbc/src/odfesqlodbc/drvconn.h index 83cb9c4ba82..24dc1fc00dd 100644 --- a/sql-odbc/src/odfesqlodbc/drvconn.h +++ b/sql-odbc/src/odfesqlodbc/drvconn.h @@ -20,9 +20,9 @@ #include #include -#include "es_odbc.h" #include "misc.h" #include "opensearch_connection.h" +#include "opensearch_odbc.h" #ifndef WIN32 #include diff --git a/sql-odbc/src/odfesqlodbc/environ.c b/sql-odbc/src/odfesqlodbc/environ.c index 5a3a1f4372d..7207cd3353b 100644 --- a/sql-odbc/src/odfesqlodbc/environ.c +++ b/sql-odbc/src/odfesqlodbc/environ.c @@ -87,8 +87,8 @@ static void es_sqlstate_set(const EnvironmentClass *env, UCHAR *szSqlState, 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,12 +137,12 @@ 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 *eserror, 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; diff --git a/sql-odbc/src/odfesqlodbc/environ.h b/sql-odbc/src/odfesqlodbc/environ.h index e701d6461fb..202b6917fa6 100644 --- a/sql-odbc/src/odfesqlodbc/environ.h +++ b/sql-odbc/src/odfesqlodbc/environ.h @@ -21,8 +21,8 @@ extern "C" { #endif -#include "es_odbc.h" #include "opensearch_helper.h" +#include "opensearch_odbc.h" #define ENV_ALLOC_ERROR 1 diff --git a/sql-odbc/src/odfesqlodbc/execute.c b/sql-odbc/src/odfesqlodbc/execute.c index 8ea97792929..c67cacb2eef 100644 --- a/sql-odbc/src/odfesqlodbc/execute.c +++ b/sql-odbc/src/odfesqlodbc/execute.c @@ -17,8 +17,8 @@ #include #include -#include "es_odbc.h" #include "misc.h" +#include "opensearch_odbc.h" #ifndef WIN32 #include diff --git a/sql-odbc/src/odfesqlodbc/info.c b/sql-odbc/src/odfesqlodbc/info.c index 3a8ca5399ab..a2d5127ca05 100644 --- a/sql-odbc/src/odfesqlodbc/info.c +++ b/sql-odbc/src/odfesqlodbc/info.c @@ -14,12 +14,12 @@ * */ -#include "es_odbc.h" -#include "unicode_support.h" - #include #include +#include "opensearch_odbc.h" +#include "unicode_support.h" + #ifndef WIN32 #include #endif diff --git a/sql-odbc/src/odfesqlodbc/loadlib.h b/sql-odbc/src/odfesqlodbc/loadlib.h index 4890f8ef338..b05fa92e1af 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 diff --git a/sql-odbc/src/odfesqlodbc/misc.c b/sql-odbc/src/odfesqlodbc/misc.c index c6a8b606f2e..28746b58285 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 diff --git a/sql-odbc/src/odfesqlodbc/multibyte.h b/sql-odbc/src/odfesqlodbc/multibyte.h index c3251231a79..4c8b3ea05ea 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 */ diff --git a/sql-odbc/src/odfesqlodbc/mylog.c b/sql-odbc/src/odfesqlodbc/mylog.c index 646c96a7468..ea182e5cfad 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_odbc.h" #include "misc.h" #include "opensearch_helper.h" +#include "opensearch_odbc.h" #ifndef WIN32 #include diff --git a/sql-odbc/src/odfesqlodbc/odbcapi.c b/sql-odbc/src/odfesqlodbc/odbcapi.c index 91c6661a088..1f6dc008b0a 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi.c @@ -18,13 +18,13 @@ #include #include "environ.h" -#include "es_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_odbc.h" #include "opensearch_statement.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/odbcapi30.c b/sql-odbc/src/odfesqlodbc/odbcapi30.c index 63b6dc10146..04f9e9ccb48 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_odbc.h" #include "misc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" +#include "opensearch_odbc.h" #include "statement.h" /* SQLAllocConnect/SQLAllocEnv/SQLAllocStmt -> SQLAllocHandle */ diff --git a/sql-odbc/src/odfesqlodbc/odbcapi30w.c b/sql-odbc/src/odfesqlodbc/odbcapi30w.c index 504c21219c4..8d21062ef4b 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi30w.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi30w.c @@ -17,10 +17,10 @@ #include #include -#include "es_odbc.h" #include "misc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" +#include "opensearch_odbc.h" #include "statement.h" #include "unicode_support.h" diff --git a/sql-odbc/src/odfesqlodbc/odbcapiw.c b/sql-odbc/src/odfesqlodbc/odbcapiw.c index 683bcfd1f82..6921dfe21a5 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapiw.c +++ b/sql-odbc/src/odfesqlodbc/odbcapiw.c @@ -17,11 +17,11 @@ #include #include -#include "es_odbc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" #include "opensearch_driver_connect.h" #include "opensearch_info.h" +#include "opensearch_odbc.h" #include "statement.h" #include "unicode_support.h" diff --git a/sql-odbc/src/odfesqlodbc/opensearch_api30.c b/sql-odbc/src/odfesqlodbc/opensearch_api30.c index 3a930df1747..a3179384f95 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_api30.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_api30.c @@ -20,11 +20,11 @@ #include "descriptor.h" #include "dlg_specific.h" #include "environ.h" -#include "es_odbc.h" #include "loadlib.h" #include "misc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" +#include "opensearch_odbc.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/opensearch_apifunc.h b/sql-odbc/src/odfesqlodbc/opensearch_apifunc.h index 32b350ab378..55237c063da 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_apifunc.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_apifunc.h @@ -19,7 +19,8 @@ #include #include -#include "es_odbc.h" + +#include "opensearch_odbc.h" #ifdef __cplusplus extern "C" { diff --git a/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp index 992f010c243..9edcd0ebb9b 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp @@ -19,7 +19,7 @@ // 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 diff --git a/sql-odbc/src/odfesqlodbc/opensearch_connection.h b/sql-odbc/src/odfesqlodbc/opensearch_connection.h index c054ff0eeb0..cbef3ff3acd 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_connection.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_connection.h @@ -22,8 +22,8 @@ #include #include "descriptor.h" -#include "es_odbc.h" #include "opensearch_helper.h" +#include "opensearch_odbc.h" #include "opensearch_utility.h" #ifdef __cplusplus diff --git a/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp index 143c9f0c06b..3a529c4c472 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp @@ -19,8 +19,8 @@ #include #include -#include "es_odbc.h" #include "misc.h" +#include "opensearch_odbc.h" #ifndef WIN32 #include diff --git a/sql-odbc/src/odfesqlodbc/opensearch_info.h b/sql-odbc/src/odfesqlodbc/opensearch_info.h index 7564988b6ee..59f77a59853 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_info.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_info.h @@ -16,8 +16,8 @@ #ifndef __OPENSEARCH_INFO_H__ #define __OPENSEARCH_INFO_H__ -#include "es_odbc.h" #include "opensearch_helper.h" +#include "opensearch_odbc.h" #include "unicode_support.h" #ifndef WIN32 diff --git a/sql-odbc/src/odfesqlodbc/es_odbc.c b/sql-odbc/src/odfesqlodbc/opensearch_odbc.c similarity index 99% rename from sql-odbc/src/odfesqlodbc/es_odbc.c rename to sql-odbc/src/odfesqlodbc/opensearch_odbc.c index 40ec6a4e08a..976a8472942 100644 --- a/sql-odbc/src/odfesqlodbc/es_odbc.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_odbc.c @@ -20,10 +20,11 @@ #endif /* _DEBUG */ #endif /* WIN32 */ #include + #include "dlg_specific.h" #include "environ.h" -#include "es_odbc.h" #include "misc.h" +#include "opensearch_odbc.h" #ifdef WIN32 #include "loadlib.h" diff --git a/sql-odbc/src/odfesqlodbc/es_odbc.h b/sql-odbc/src/odfesqlodbc/opensearch_odbc.h similarity index 95% rename from sql-odbc/src/odfesqlodbc/es_odbc.h rename to sql-odbc/src/odfesqlodbc/opensearch_odbc.h index 8e207b4a4e3..0e45e5004ba 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_ @@ -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 @@ -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 \ \ @@ -676,4 +676,4 @@ enum { #include "mylog.h" -#endif /* __ESODBC_H__ */ +#endif /* __OPENSEARCHODBC_H__ */ diff --git a/sql-odbc/src/odfesqlodbc/opensearch_types.c b/sql-odbc/src/odfesqlodbc/opensearch_types.c index a5d9cb60ad5..83dee9fac65 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_types.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.c @@ -279,7 +279,7 @@ estype_attr_to_concise_type(const ConnectionClass *conn, OID type, case OPENSEARCH_TYPE_BYTEA: return SQL_VARBINARY; - case ES_TYPE_LO_UNDEFINED: + case OPENSEARCH_TYPE_LO_UNDEFINED: return SQL_LONGVARBINARY; case OPENSEARCH_TYPE_INT2: @@ -442,7 +442,7 @@ estype_attr_to_ctype(const ConnectionClass *conn, OID type, int atttypmod) { case OPENSEARCH_TYPE_BYTEA: return SQL_C_BINARY; - case ES_TYPE_LO_UNDEFINED: + case OPENSEARCH_TYPE_LO_UNDEFINED: return SQL_C_BINARY; case OPENSEARCH_TYPE_BPCHAR: case OPENSEARCH_TYPE_VARCHAR: @@ -599,13 +599,13 @@ Int4 estype_attr_display_size(const ConnectionClass *conn, OID type, case OPENSEARCH_TYPE_MONEY: return 15; /* ($9,999,999.99) */ - case OPENSEARCH_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 OPENSEARCH_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 OPENSEARCH_TYPE_MACADDR: return 17; diff --git a/sql-odbc/src/odfesqlodbc/opensearch_types.h b/sql-odbc/src/odfesqlodbc/opensearch_types.h index e93f962a679..923fc6f30d3 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_types.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.h @@ -18,7 +18,7 @@ #define OPENSEARCH_TYPES #include "dlg_specific.h" -#include "es_odbc.h" +#include "opensearch_odbc.h" #ifdef __cplusplus extern "C" { #endif diff --git a/sql-odbc/src/odfesqlodbc/options.c b/sql-odbc/src/odfesqlodbc/options.c index 0f3ae63b0c4..0bec485b5f8 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_odbc.h" #include "misc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" +#include "opensearch_odbc.h" #include "qresult.h" #include "statement.h" #include "unicode_support.h" diff --git a/sql-odbc/src/odfesqlodbc/parse.c b/sql-odbc/src/odfesqlodbc/parse.c index 17b5b70a821..3017a848962 100644 --- a/sql-odbc/src/odfesqlodbc/parse.c +++ b/sql-odbc/src/odfesqlodbc/parse.c @@ -19,13 +19,13 @@ #include #include "catfunc.h" -#include "es_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 "opensearch_odbc.h" +#include "opensearch_types.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/qresult.h b/sql-odbc/src/odfesqlodbc/qresult.h index 5c8619c9b1f..b5936c99ed2 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_odbc.h" #include "opensearch_connection.h" +#include "opensearch_odbc.h" #include "tuple.h" #ifdef __cplusplus diff --git a/sql-odbc/src/odfesqlodbc/results.c b/sql-odbc/src/odfesqlodbc/results.c index 45c57e02d4b..7a6cacb799d 100644 --- a/sql-odbc/src/odfesqlodbc/results.c +++ b/sql-odbc/src/odfesqlodbc/results.c @@ -22,12 +22,12 @@ #include "convert.h" #include "dlg_specific.h" #include "environ.h" -#include "es_odbc.h" -#include "opensearch_types.h" #include "misc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" +#include "opensearch_odbc.h" #include "opensearch_statement.h" +#include "opensearch_types.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/setup.c b/sql-odbc/src/odfesqlodbc/setup.c index a6ae4607b2b..57fcd43bbce 100644 --- a/sql-odbc/src/odfesqlodbc/setup.c +++ b/sql-odbc/src/odfesqlodbc/setup.c @@ -16,7 +16,7 @@ #ifdef WIN32 #include "elasticenlist.h" -#include "es_odbc.h" +#include "opensearch_odbc.h" #include "loadlib.h" #include "misc.h" // strncpy_null diff --git a/sql-odbc/src/odfesqlodbc/statement.c b/sql-odbc/src/odfesqlodbc/statement.c index 7e31ecd5841..18db58d944d 100644 --- a/sql-odbc/src/odfesqlodbc/statement.c +++ b/sql-odbc/src/odfesqlodbc/statement.c @@ -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 *eserror_fail_safe) { QResultClass *res = SC_get_Curres(self); ConnectionClass *conn = SC_get_conn(self); Int4 errornum; @@ -798,7 +797,7 @@ 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 *eserror; if (self->eserror) return self->eserror; @@ -972,7 +971,7 @@ 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 *eserror; MYLOG(ES_TRACE, "entering %p->%p\n", from, self); if (!from) @@ -1009,7 +1008,7 @@ RETCODE SQL_API ESAPI_StmtError(SQLHSTMT hstmt, SQLSMALLINT RecNumber, SQLCHAR *szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT *pcbErrorMsg, UWORD flag) { /* CC: return an error of a hdesc */ - ES_ErrorInfo *eserror, error; + OpenSearch_ErrorInfo *eserror, error; StatementClass *stmt = (StatementClass *)hstmt; int errnum = SC_get_errornumber(stmt); diff --git a/sql-odbc/src/odfesqlodbc/statement.h b/sql-odbc/src/odfesqlodbc/statement.h index 14cd90cb1e8..4e0b72e7460 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_odbc.h" -#include "opensearch_types.h" #include "opensearch_helper.h" +#include "opensearch_odbc.h" +#include "opensearch_types.h" #include "tuple.h" // C Interface @@ -224,7 +224,7 @@ struct StatementClass_ { STMT_Status status; char *__error_message; int __error_number; - ES_ErrorInfo *eserror; + OpenSearch_ErrorInfo *eserror; SQLLEN currTuple; /* current absolute row number (GetData, * SetPos, SQLFetch) */ diff --git a/sql-odbc/src/odfesqlodbc/tuple.h b/sql-odbc/src/odfesqlodbc/tuple.h index c9623a82ca2..b0923e9e904 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 diff --git a/sql-odbc/src/odfesqlodbc/unicode_support.h b/sql-odbc/src/odfesqlodbc/unicode_support.h index 1e73e8c65d3..dce8574615b 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/win_unicode.c b/sql-odbc/src/odfesqlodbc/win_unicode.c index 729238c85aa..9727b567844 100644 --- a/sql-odbc/src/odfesqlodbc/win_unicode.c +++ b/sql-odbc/src/odfesqlodbc/win_unicode.c @@ -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) @@ -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) @@ -587,11 +587,11 @@ static int ucs4_to_ucs2_lf(const unsigned int *ucs4str, SQLLEN ilen, 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); } @@ -791,10 +791,10 @@ static SQLLEN mbstoc16_lf(char16_t *c16dt, const char *c8dt, size_t n, MYLOG(ES_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); From 7fd0fadfeb3274a3e026306e0bd648782861332e Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 17:44:25 -0700 Subject: [PATCH 17/36] Fix mylog --- sql-odbc/src/CMakeLists.txt | 4 ++-- sql-odbc/src/odfesqlodbc/CMakeLists.txt | 2 +- sql-odbc/src/odfesqlodbc/misc.h | 2 +- sql-odbc/src/odfesqlodbc/mylog.h | 10 +++++----- .../odfesqlodbc/{es_odbc.rc => opensearch_odbc.rc} | 8 ++++---- sql-odbc/src/odfesqlodbc/version.h | 12 ++++++------ 6 files changed, 19 insertions(+), 19 deletions(-) rename sql-odbc/src/odfesqlodbc/{es_odbc.rc => opensearch_odbc.rc} (97%) diff --git a/sql-odbc/src/CMakeLists.txt b/sql-odbc/src/CMakeLists.txt index de9d50d3392..93ebbc1edfe 100644 --- a/sql-odbc/src/CMakeLists.txt +++ b/sql-odbc/src/CMakeLists.txt @@ -80,9 +80,9 @@ set(DSN_INSTALLER_SRC "${CMAKE_CURRENT_SOURCE_DIR}/DSNInstaller") # ODBC Driver version set(DRIVER_PACKAGE_VERSION "1.15.0.0") set(DRIVER_PACKAGE_VERSION_COMMA_SEPARATED "1,15,0,0") -add_compile_definitions( ES_ODBC_VERSION="${DRIVER_PACKAGE_VERSION}" +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/odfesqlodbc/CMakeLists.txt b/sql-odbc/src/odfesqlodbc/CMakeLists.txt index 18e910801cd..0f832ace3ed 100644 --- a/sql-odbc/src/odfesqlodbc/CMakeLists.txt +++ b/sql-odbc/src/odfesqlodbc/CMakeLists.txt @@ -46,7 +46,7 @@ set( HEADER_FILES # 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/misc.h b/sql-odbc/src/odfesqlodbc/misc.h index 62b7e7477a6..d9bfa2d6ea1 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/mylog.h b/sql-odbc/src/odfesqlodbc/mylog.h index cb1f13c63ce..8c9b1fca77a 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); @@ -126,7 +126,7 @@ const char *po_basename(const char *path); #endif /* __GNUC__ */ enum ESLogLevel { - // Prefixing with ES_ because C does not support namespaces and we may get a + // 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, diff --git a/sql-odbc/src/odfesqlodbc/es_odbc.rc b/sql-odbc/src/odfesqlodbc/opensearch_odbc.rc similarity index 97% rename from sql-odbc/src/odfesqlodbc/es_odbc.rc rename to sql-odbc/src/odfesqlodbc/opensearch_odbc.rc index f559357b5ed..d2e2c0c931e 100644 --- a/sql-odbc/src/odfesqlodbc/es_odbc.rc +++ b/sql-odbc/src/odfesqlodbc/opensearch_odbc.rc @@ -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 @@ -183,13 +183,13 @@ BEGIN VALUE "Comments", "OpenSearch ANSI ODBC driver" VALUE "CompanyName", "Amazon" VALUE "FileDescription", "OpenSearch ODBC Driver (English)" - VALUE "FileVersion", ES_ODBC_VERSION + 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", "OpenSearch" - VALUE "ProductVersion", ES_ODBC_VERSION + VALUE "ProductVersion", OPENSEARCH_ODBC_VERSION END END BLOCK "VarFileInfo" diff --git a/sql-odbc/src/odfesqlodbc/version.h b/sql-odbc/src/odfesqlodbc/version.h index 07287bdc4f1..4206010899b 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 OPENSEARCHDRIVERVERSION -#define OPENSEARCHDRIVERVERSION ES_ODBC_VERSION +#define OPENSEARCHDRIVERVERSION OPENSEARCH_ODBC_VERSION #endif #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 From fa1d5bceb5a3cb6cebff700a5cf4c30c67c7886f Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 18:00:11 -0700 Subject: [PATCH 18/36] Fix header and rename ESLogLevel --- sql-odbc/README.md | 2 +- sql-odbc/docs/user/configuration_options.md | 2 +- sql-odbc/src/odfesqlodbc/bind.c | 64 ++++---- sql-odbc/src/odfesqlodbc/connection.c | 58 +++---- sql-odbc/src/odfesqlodbc/convert.c | 40 ++--- sql-odbc/src/odfesqlodbc/descriptor.c | 38 ++--- sql-odbc/src/odfesqlodbc/dlg_specific.c | 8 +- sql-odbc/src/odfesqlodbc/dlg_specific.h | 2 +- sql-odbc/src/odfesqlodbc/dlg_wingui.c | 18 +-- sql-odbc/src/odfesqlodbc/drvconn.c | 20 +-- sql-odbc/src/odfesqlodbc/drvconn.h | 2 +- sql-odbc/src/odfesqlodbc/environ.c | 46 +++--- sql-odbc/src/odfesqlodbc/execute.c | 4 +- sql-odbc/src/odfesqlodbc/info.c | 12 +- sql-odbc/src/odfesqlodbc/loadlib.c | 14 +- sql-odbc/src/odfesqlodbc/misc.c | 6 +- sql-odbc/src/odfesqlodbc/mylog.c | 10 +- sql-odbc/src/odfesqlodbc/mylog.h | 18 +-- sql-odbc/src/odfesqlodbc/odbcapi.c | 80 +++++----- sql-odbc/src/odfesqlodbc/odbcapi30.c | 48 +++--- sql-odbc/src/odfesqlodbc/odbcapi30w.c | 28 ++-- sql-odbc/src/odfesqlodbc/odbcapiw.c | 54 +++---- sql-odbc/src/odfesqlodbc/opensearch_api30.c | 48 +++--- .../odfesqlodbc/opensearch_communication.cpp | 90 +++++------ .../odfesqlodbc/opensearch_communication.h | 2 +- .../odfesqlodbc/opensearch_driver_connect.cpp | 2 +- .../src/odfesqlodbc/opensearch_helper.cpp | 4 +- sql-odbc/src/odfesqlodbc/opensearch_odbc.c | 6 +- sql-odbc/src/odfesqlodbc/opensearch_types.c | 18 +-- sql-odbc/src/odfesqlodbc/options.c | 46 +++--- sql-odbc/src/odfesqlodbc/parse.c | 4 +- sql-odbc/src/odfesqlodbc/qresult.c | 28 ++-- sql-odbc/src/odfesqlodbc/qresult.h | 6 +- sql-odbc/src/odfesqlodbc/results.c | 148 +++++++++--------- sql-odbc/src/odfesqlodbc/setup.c | 6 +- sql-odbc/src/odfesqlodbc/statement.c | 70 ++++----- sql-odbc/src/odfesqlodbc/win_unicode.c | 62 ++++---- 37 files changed, 557 insertions(+), 557 deletions(-) diff --git a/sql-odbc/README.md b/sql-odbc/README.md index 29e5dee6df0..6f1d07383d4 100644 --- a/sql-odbc/README.md +++ b/sql-odbc/README.md @@ -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 diff --git a/sql-odbc/docs/user/configuration_options.md b/sql-odbc/docs/user/configuration_options.md index 02c4981aaf3..23c1adb5915 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/src/odfesqlodbc/bind.c b/sql-odbc/src/odfesqlodbc/bind.c index 62e99e34581..1f15b443773 100644 --- a/sql-odbc/src/odfesqlodbc/bind.c +++ b/sql-odbc/src/odfesqlodbc/bind.c @@ -39,10 +39,10 @@ RETCODE SQL_API ESAPI_BindCol(HSTMT hstmt, SQLUSMALLINT icol, 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); } @@ -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) @@ -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/connection.c b/sql-odbc/src/odfesqlodbc/connection.c index 13208f440a7..f5bce963093 100644 --- a/sql-odbc/src/odfesqlodbc/connection.c +++ b/sql-odbc/src/odfesqlodbc/connection.c @@ -60,10 +60,10 @@ RETCODE SQL_API ESAPI_AllocConnect(HENV henv, HDBC *phdbc) { ConnectionClass *conn; CSTR func = "ESAPI_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."; @@ -98,7 +98,7 @@ RETCODE SQL_API ESAPI_Connect(HDBC hdbc, const SQLCHAR *szDSN, 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); @@ -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,7 +143,7 @@ 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; } @@ -158,7 +158,7 @@ RETCODE SQL_API ESAPI_BrowseConnect(HDBC hdbc, const SQLCHAR *szConnStrIn, CSTR func = "ESAPI_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); @@ -171,7 +171,7 @@ RETCODE SQL_API ESAPI_Disconnect(HDBC hdbc) { CSTR func = "ESAPI_Disconnect"; RETCODE ret = SQL_SUCCESS; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); if (!conn) { CC_log_error(func, "", NULL); @@ -188,13 +188,13 @@ 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; } @@ -204,7 +204,7 @@ RETCODE SQL_API ESAPI_FreeConnect(HDBC hdbc) { CSTR func = "ESAPI_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; } @@ -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,7 +410,7 @@ 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 */ @@ -425,7 +425,7 @@ CC_cleanup(ConnectionClass *self, BOOL keepCommunication) { CC_set_error(self, CC_not_connected(self), "Connection not open", func); } - MYLOG(ES_DEBUG, "after LIBES_disconnect\n"); + MYLOG(OPENSEARCH_DEBUG, "after LIBES_disconnect\n"); /* Free all the stmts on this connection */ for (i = 0; i < self->num_stmts; i++) { @@ -491,7 +491,7 @@ CC_cleanup(ConnectionClass *self, BOOL keepCommunication) { } LEAVE_CONN_CS(self); - MYLOG(ES_TRACE, "leaving\n"); + MYLOG(OPENSEARCH_TRACE, "leaving\n"); return ret; } @@ -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", + MYLOG(OPENSEARCH_ERROR, " esconn=%p, stmts=%p, lobj_type=%d\n", self->esconn, 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 b7f0588210e..e3434451b71 100644 --- a/sql-odbc/src/odfesqlodbc/convert.c +++ b/sql-odbc/src/odfesqlodbc/convert.c @@ -728,7 +728,7 @@ static int setup_getdataclass(SQLLEN *const length_return, 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); @@ -738,7 +738,7 @@ static int setup_getdataclass(SQLLEN *const length_return, if (BYTEA_PROCESS_ESCAPE == bytea_process_kind) unicode_count = (int)convert_from_esbinary(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) { @@ -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) @@ -884,7 +884,7 @@ 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 OPENSEARCH_TYPE_FLOAT4: @@ -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); @@ -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, @@ -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; @@ -1261,7 +1261,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, 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; @@ -1334,7 +1334,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, for (i = 0; i < len && i < midsize - 2; i++) midtemp[i] = (char)toupper((UCHAR)neut_str[i]); midtemp[i] = '\0'; - MYLOG(ES_DEBUG, "OPENSEARCH_TYPE_UUID: rgbValueBindRow = '%s'\n", + MYLOG(OPENSEARCH_DEBUG, "OPENSEARCH_TYPE_UUID: rgbValueBindRow = '%s'\n", rgbValueBindRow); break; @@ -1374,7 +1374,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, 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; } } @@ -1593,7 +1593,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, 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)) { @@ -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; } @@ -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; } diff --git a/sql-odbc/src/odfesqlodbc/descriptor.c b/sql-odbc/src/odfesqlodbc/descriptor.c index a07dc82753e..ee55a2c797e 100644 --- a/sql-odbc/src/odfesqlodbc/descriptor.c +++ b/sql-odbc/src/odfesqlodbc/descriptor.c @@ -30,13 +30,13 @@ 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; @@ -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]) { @@ -264,7 +264,7 @@ RETCODE SQL_API ESAPI_AllocDesc(HDBC ConnectionHandle, RETCODE ret = SQL_SUCCESS; DescriptorClass *desc; - MYLOG(ES_TRACE, "entering...\n"); + MYLOG(OPENSEARCH_TRACE, "entering...\n"); desc = (DescriptorClass *)malloc(sizeof(DescriptorClass)); if (desc) { @@ -290,7 +290,7 @@ RETCODE SQL_API ESAPI_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; @@ -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; @@ -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)); @@ -583,7 +583,7 @@ 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); + MYLOG(OPENSEARCH_TRACE, "entering RecN=%hd\n", RecNumber); deschd->eserror = DC_create_errorinfo(desc); return ER_ReturnError(deschd->eserror, RecNumber, szSqlState, pfNativeError, szErrorMsg, cbErrorMsgMax, pcbErrorMsg, flag); diff --git a/sql-odbc/src/odfesqlodbc/dlg_specific.c b/sql-odbc/src/odfesqlodbc/dlg_specific.c index 4b4879f5f8d..8442d212dd3 100644 --- a/sql-odbc/src/odfesqlodbc/dlg_specific.c +++ b/sql-odbc/src/odfesqlodbc/dlg_specific.c @@ -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)); @@ -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 63c0ae6934f..013f75a262f 100644 --- a/sql-odbc/src/odfesqlodbc/dlg_specific.h +++ b/sql-odbc/src/odfesqlodbc/dlg_specific.h @@ -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 75414f63cc8..ac7331d1d6b 100644 --- a/sql-odbc/src/odfesqlodbc/dlg_wingui.c +++ b/sql-odbc/src/odfesqlodbc/dlg_wingui.c @@ -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 07e070325b9..a2bc91d0d64 100644 --- a/sql-odbc/src/odfesqlodbc/drvconn.c +++ b/sql-odbc/src/odfesqlodbc/drvconn.c @@ -19,9 +19,9 @@ #include #include +#include "opensearch_odbc.h" #include "misc.h" #include "opensearch_connection.h" -#include "opensearch_odbc.h" #ifndef WIN32 #include @@ -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) { @@ -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 24dc1fc00dd..9569b22c8e8 100644 --- a/sql-odbc/src/odfesqlodbc/drvconn.h +++ b/sql-odbc/src/odfesqlodbc/drvconn.h @@ -20,9 +20,9 @@ #include #include +#include "opensearch_odbc.h" #include "misc.h" #include "opensearch_connection.h" -#include "opensearch_odbc.h" #ifndef WIN32 #include diff --git a/sql-odbc/src/odfesqlodbc/environ.c b/sql-odbc/src/odfesqlodbc/environ.c index 7207cd3353b..1acdb90d829 100644 --- a/sql-odbc/src/odfesqlodbc/environ.c +++ b/sql-odbc/src/odfesqlodbc/environ.c @@ -41,7 +41,7 @@ RETCODE SQL_API ESAPI_AllocEnv(HENV *phenv) { CSTR func = "ESAPI_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,7 +57,7 @@ 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; } @@ -66,10 +66,10 @@ RETCODE SQL_API ESAPI_FreeEnv(HENV henv) { 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; } @@ -151,7 +151,7 @@ RETCODE SQL_API ER_ReturnError(OpenSearch_ErrorInfo *eserror, SQLSMALLINT RecNum return SQL_NO_DATA_FOUND; error = eserror; 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(OpenSearch_ErrorInfo *eserror, SQLSMALLINT RecNum 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; @@ -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) { @@ -326,7 +326,7 @@ RETCODE SQL_API ESAPI_ConnectError(HDBC hdbc, SQLSMALLINT RecNumber, } } - 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); @@ -346,13 +346,13 @@ 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"); @@ -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); @@ -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/execute.c b/sql-odbc/src/odfesqlodbc/execute.c index c67cacb2eef..29a77762409 100644 --- a/sql-odbc/src/odfesqlodbc/execute.c +++ b/sql-odbc/src/odfesqlodbc/execute.c @@ -17,8 +17,8 @@ #include #include -#include "misc.h" #include "opensearch_odbc.h" +#include "misc.h" #ifndef WIN32 #include @@ -118,7 +118,7 @@ RETCODE SQL_API ESAPI_NativeSql(HDBC hdbc, const SQLCHAR *szSqlStrIn, 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 a2d5127ca05..aaab1a2d6fb 100644 --- a/sql-odbc/src/odfesqlodbc/info.c +++ b/sql-odbc/src/odfesqlodbc/info.c @@ -56,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); @@ -145,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 */ @@ -864,7 +864,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, 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); /* @@ -944,7 +944,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, RETCODE SQL_API ESAPI_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; } diff --git a/sql-odbc/src/odfesqlodbc/loadlib.c b/sql-odbc/src/odfesqlodbc/loadlib.c index 2e5631d3259..d9500bbecdd 100644 --- a/sql-odbc/src/odfesqlodbc/loadlib.c +++ b/sql-odbc/src/odfesqlodbc/loadlib.c @@ -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", @@ -174,18 +174,18 @@ void CleanupDelayLoadedDLLs(void) { /* The dll names are case sensitive for the unload helper */ if (loaded_elasticenlist) { if (enlist_module != NULL) { - MYLOG(ES_DEBUG, "Freeing Library %s\n", elasticenlistdll); + MYLOG(OPENSEARCH_DEBUG, "Freeing Library %s\n", elasticenlistdll); FreeLibrary(enlist_module); } - MYLOG(ES_DEBUG, "%s unloading\n", elasticenlistdll); + MYLOG(OPENSEARCH_DEBUG, "%s unloading\n", elasticenlistdll); success = (*func)(elasticenlistdll); - MYLOG(ES_DEBUG, "%s unloaded success=%d\n", elasticenlistdll, success); + MYLOG(OPENSEARCH_DEBUG, "%s unloaded success=%d\n", elasticenlistdll, success); loaded_elasticenlist = 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; diff --git a/sql-odbc/src/odfesqlodbc/misc.c b/sql-odbc/src/odfesqlodbc/misc.c index 28746b58285..a985330957c 100644 --- a/sql-odbc/src/odfesqlodbc/misc.c +++ b/sql-odbc/src/odfesqlodbc/misc.c @@ -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/mylog.c b/sql-odbc/src/odfesqlodbc/mylog.c index ea182e5cfad..2b8106ff159 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 "opensearch_odbc.h" #include "misc.h" #include "opensearch_helper.h" -#include "opensearch_odbc.h" #ifndef WIN32 #include @@ -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 @@ -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 8c9b1fca77a..10de23e96e6 100644 --- a/sql-odbc/src/odfesqlodbc/mylog.h +++ b/sql-odbc/src/odfesqlodbc/mylog.h @@ -125,17 +125,17 @@ const char *po_basename(const char *path); } while (0) #endif /* __GNUC__ */ -enum ESLogLevel { +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 1f6dc008b0a..66b0da6904b 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi.c @@ -18,13 +18,13 @@ #include #include "environ.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_odbc.h" #include "opensearch_statement.h" #include "qresult.h" #include "statement.h" @@ -47,7 +47,7 @@ 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, @@ -57,7 +57,7 @@ RETCODE SQL_API SQLBindCol(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, } 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, @@ -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; @@ -154,7 +154,7 @@ 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, @@ -171,7 +171,7 @@ 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 = @@ -187,7 +187,7 @@ 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, @@ -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,7 +215,7 @@ 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; @@ -233,7 +233,7 @@ 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); @@ -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; @@ -304,7 +304,7 @@ 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; @@ -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) { @@ -354,7 +354,7 @@ 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, @@ -370,7 +370,7 @@ 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; @@ -387,7 +387,7 @@ 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) @@ -408,7 +408,7 @@ RETCODE SQL_API SQLGetInfo(HDBC ConnectionHandle, SQLUSMALLINT InfoType, ENTER_CONN_CS(conn); CC_clear_error(conn); - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if ((ret = ESAPI_GetInfo(ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength)) == SQL_ERROR) @@ -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; @@ -443,7 +443,7 @@ 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; @@ -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; @@ -511,7 +511,7 @@ 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; @@ -528,7 +528,7 @@ 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); @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -961,7 +961,7 @@ 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; @@ -979,7 +979,7 @@ 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, @@ -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; @@ -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; @@ -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; @@ -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; @@ -1298,7 +1298,7 @@ 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); @@ -1317,7 +1317,7 @@ 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); @@ -1331,7 +1331,7 @@ 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); @@ -1355,7 +1355,7 @@ 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; @@ -1376,7 +1376,7 @@ 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 = @@ -1393,7 +1393,7 @@ RETCODE SQL_API SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, 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 04f9e9ccb48..eee7d0abb16 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi30.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi30.c @@ -18,10 +18,10 @@ #include #include "environ.h" +#include "opensearch_odbc.h" #include "misc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" -#include "opensearch_odbc.h" #include "statement.h" /* SQLAllocConnect/SQLAllocEnv/SQLAllocStmt -> SQLAllocHandle */ @@ -30,7 +30,7 @@ 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); @@ -55,7 +55,7 @@ RETCODE SQL_API SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, ENTER_CONN_CS(conn); ret = ESAPI_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; @@ -90,7 +90,7 @@ 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; @@ -118,7 +118,7 @@ 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; @@ -137,7 +137,7 @@ RETCODE SQL_API SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle) { RETCODE ret; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ret = ESAPI_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 { @@ -206,7 +206,7 @@ RETCODE SQL_API SQLFetchScroll(HSTMT StatementHandle, } 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,7 +216,7 @@ 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: @@ -259,7 +259,7 @@ RETCODE SQL_API SQLGetDescField(SQLHDESC DescriptorHandle, SQLINTEGER *StringLength) { RETCODE ret; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ret = ESAPI_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,7 +287,7 @@ 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, @@ -303,7 +303,7 @@ RETCODE SQL_API SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT *TextLength) { RETCODE ret; - MYLOG(ES_TRACE, "entering\n"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); ret = ESAPI_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,7 +351,7 @@ 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, @@ -367,7 +367,7 @@ 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); @@ -383,7 +383,7 @@ 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 = @@ -399,7 +399,7 @@ 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, Value, BufferLength); @@ -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,7 +481,7 @@ 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); diff --git a/sql-odbc/src/odfesqlodbc/odbcapi30w.c b/sql-odbc/src/odfesqlodbc/odbcapi30w.c index 8d21062ef4b..e9cb4e19368 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi30w.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi30w.c @@ -17,10 +17,10 @@ #include #include +#include "opensearch_odbc.h" #include "misc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" -#include "opensearch_odbc.h" #include "statement.h" #include "unicode_support.h" @@ -30,7 +30,7 @@ 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); @@ -43,7 +43,7 @@ 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); @@ -56,7 +56,7 @@ 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 = @@ -70,7 +70,7 @@ 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); @@ -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: @@ -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: @@ -194,7 +194,7 @@ 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; @@ -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; @@ -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: @@ -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 6921dfe21a5..5163b10f52b 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapiw.c +++ b/sql-odbc/src/odfesqlodbc/odbcapiw.c @@ -17,11 +17,11 @@ #include #include +#include "opensearch_odbc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" #include "opensearch_driver_connect.h" #include "opensearch_info.h" -#include "opensearch_odbc.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; @@ -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); @@ -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); @@ -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); @@ -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; @@ -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 @@ -368,7 +368,7 @@ 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"); + MYLOG(OPENSEARCH_TRACE, "entering\n"); if ((ret = ESAPI_GetInfo(ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength)) == SQL_ERROR) @@ -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; @@ -420,7 +420,7 @@ 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); @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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); @@ -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; @@ -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); @@ -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; @@ -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; @@ -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; @@ -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; @@ -988,7 +988,7 @@ RETCODE SQL_API SQLGetConnectOptionW(HDBC ConnectionHandle, SQLUSMALLINT Option, ENTER_CONN_CS(conn); CC_clear_error(conn); - MYLOG(ES_TRACE, "entering " FORMAT_UINTEGER "\n", Option); + MYLOG(OPENSEARCH_TRACE, "entering " FORMAT_UINTEGER "\n", Option); ret = ESAPI_GetConnectOption(ConnectionHandle, Option, Value, NULL, 0); LEAVE_CONN_CS(conn); return ret; @@ -999,7 +999,7 @@ 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); @@ -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; diff --git a/sql-odbc/src/odfesqlodbc/opensearch_api30.c b/sql-odbc/src/odfesqlodbc/opensearch_api30.c index a3179384f95..2e837a08a9d 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_api30.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_api30.c @@ -20,11 +20,11 @@ #include "descriptor.h" #include "dlg_specific.h" #include "environ.h" +#include "opensearch_odbc.h" #include "loadlib.h" #include "misc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" -#include "opensearch_odbc.h" #include "qresult.h" #include "statement.h" @@ -36,7 +36,7 @@ RETCODE SQL_API ESAPI_GetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, 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, @@ -57,7 +57,7 @@ RETCODE SQL_API ESAPI_GetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, default: ret = SQL_ERROR; } - MYLOG(ES_TRACE, "leaving %d\n", ret); + MYLOG(OPENSEARCH_TRACE, "leaving %d\n", ret); return ret; } @@ -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) { @@ -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: @@ -351,7 +351,7 @@ 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; } @@ -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; @@ -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"); @@ -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"); @@ -1463,7 +1463,7 @@ RETCODE SQL_API ESAPI_GetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, 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 */ @@ -1568,7 +1568,7 @@ RETCODE SQL_API ESAPI_SetConnectAttr(HDBC ConnectionHandle, 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); @@ -1654,7 +1654,7 @@ RETCODE SQL_API ESAPI_GetDescField(SQLHDESC DescriptorHandle, 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); @@ -1712,7 +1712,7 @@ RETCODE SQL_API ESAPI_SetDescField(SQLHDESC DescriptorHandle, 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, @@ -1771,7 +1771,7 @@ RETCODE SQL_API ESAPI_SetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, CSTR func = "ESAPI_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 */ diff --git a/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp index 9edcd0ebb9b..6b48288a8b5 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp @@ -134,7 +134,7 @@ void OpenSearchCommunication::AwsHttpResponseToString( void OpenSearchCommunication::PrepareCursorResult(OpenSearchResult& es_result) { // Prepare document and validate result try { - LogMsg(ES_DEBUG, "Parsing result JSON with cursor."); + LogMsg(OPENSEARCH_DEBUG, "Parsing result JSON with cursor."); es_result.es_result_doc.parse(es_result.result_json, CURSOR_JSON_SCHEMA); } catch (const rabbit::parse_error& e) { @@ -151,7 +151,7 @@ std::shared_ptr< ErrorDetails > OpenSearchCommunication::ParseErrorResponse( OpenSearchResult& es_result) { // Prepare document and validate schema try { - LogMsg(ES_DEBUG, "Parsing error response (with schema validation)"); + LogMsg(OPENSEARCH_DEBUG, "Parsing error response (with schema validation)"); es_result.es_result_doc.parse(es_result.result_json, ERROR_RESPONSE_SCHEMA); @@ -193,7 +193,7 @@ void OpenSearchCommunication::SetErrorDetails(ErrorDetails details) { void OpenSearchCommunication::GetJsonSchema(OpenSearchResult& es_result) { // Prepare document and validate schema try { - LogMsg(ES_DEBUG, "Parsing result JSON with schema."); + LogMsg(OPENSEARCH_DEBUG, "Parsing result JSON with schema."); es_result.es_result_doc.parse(es_result.result_json, JSON_SCHEMA); } catch (const rabbit::parse_error& e) { // The exception rabbit gives is quite useless - providing the json @@ -221,12 +221,12 @@ OpenSearchCommunication::OpenSearchCommunication() #pragma clang diagnostic pop #endif // __APPLE__ { - LogMsg(ES_ALL, "Initializing Aws API."); + LogMsg(OPENSEARCH_ALL, "Initializing Aws API."); Aws::InitAPI(m_options); } OpenSearchCommunication::~OpenSearchCommunication() { - LogMsg(ES_ALL, "Shutting down Aws API."); + LogMsg(OPENSEARCH_ALL, "Shutting down Aws API."); Aws::ShutdownAPI(m_options); } @@ -262,7 +262,7 @@ bool OpenSearchCommunication::ConnectionOptions2() { } bool OpenSearchCommunication::ConnectDBStart() { - LogMsg(ES_ALL, "Starting DB connection."); + LogMsg(OPENSEARCH_ALL, "Starting DB connection."); m_status = ConnStatusType::CONNECTION_BAD; if (!m_valid_connection_options) { // TODO: get error message from CheckConnectionOptions @@ -270,7 +270,7 @@ bool OpenSearchCommunication::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,12 +280,12 @@ bool OpenSearchCommunication::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; } @@ -295,7 +295,7 @@ ConnStatusType OpenSearchCommunication::GetConnectionStatus() { } void OpenSearchCommunication::DropDBConnection() { - LogMsg(ES_ALL, "Dropping DB connection."); + LogMsg(OPENSEARCH_ALL, "Dropping DB connection."); if (m_http_client) { m_http_client.reset(); } @@ -305,7 +305,7 @@ void OpenSearchCommunication::DropDBConnection() { } bool OpenSearchCommunication::CheckConnectionOptions() { - LogMsg(ES_ALL, "Verifying connection options."); + 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,11 +330,11 @@ bool OpenSearchCommunication::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; @@ -431,7 +431,7 @@ bool OpenSearchCommunication::IsSQLPluginInstalled(const std::string& plugin_res 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; @@ -469,20 +469,20 @@ bool OpenSearchCommunication::IsSQLPluginInstalled(const std::string& plugin_res 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 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 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, "", "", ""); @@ -519,7 +519,7 @@ bool OpenSearchCommunication::EstablishConnection() { } } } - LogMsg(ES_ERROR, m_error_message.c_str()); + LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return false; } @@ -529,14 +529,14 @@ std::vector< std::string > OpenSearchCommunication::GetColumnsWithSelectQuery( 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 = @@ -550,7 +550,7 @@ std::vector< std::string > OpenSearchCommunication::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; } @@ -574,7 +574,7 @@ std::vector< std::string > OpenSearchCommunication::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; } @@ -596,13 +596,13 @@ int OpenSearchCommunication::ExecDirect(const char* query, const char* fetch_siz 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; } @@ -610,7 +610,7 @@ int OpenSearchCommunication::ExecDirect(const char* query, const char* fetch_siz 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 = @@ -624,7 +624,7 @@ int OpenSearchCommunication::ExecDirect(const char* query, const char* fetch_siz "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; } @@ -647,7 +647,7 @@ int OpenSearchCommunication::ExecDirect(const char* query, const char* fetch_siz 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; } @@ -662,7 +662,7 @@ int OpenSearchCommunication::ExecDirect(const char* query, const char* fetch_siz } 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; } @@ -701,7 +701,7 @@ void OpenSearchCommunication::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; } @@ -730,7 +730,7 @@ void OpenSearchCommunication::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) { @@ -750,7 +750,7 @@ void OpenSearchCommunication::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()); } } @@ -784,7 +784,7 @@ void OpenSearchCommunication::ConstructOpenSearchResult(OpenSearchResult& result result.num_fields = (uint16_t)schema_array.size(); } -inline void OpenSearchCommunication::LogMsg(ESLogLevel level, const char* msg) { +inline void OpenSearchCommunication::LogMsg(OpenSearchLogLevel level, const char* msg) { #if WIN32 #pragma warning(push) #pragma warning(disable : 4551) @@ -818,7 +818,7 @@ bool OpenSearchCommunication::SetClientEncoding(std::string& encoding) { m_client_encoding = encoding; return true; } - LogMsg(ES_ERROR, + LogMsg(OPENSEARCH_ERROR, std::string("Failed to find encoding " + encoding).c_str()); return false; } @@ -837,7 +837,7 @@ std::string OpenSearchCommunication::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 ""; } @@ -856,26 +856,26 @@ std::string OpenSearchCommunication::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 ""; } @@ -893,7 +893,7 @@ std::string OpenSearchCommunication::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 ""; } @@ -912,25 +912,25 @@ std::string OpenSearchCommunication::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/opensearch_communication.h b/sql-odbc/src/odfesqlodbc/opensearch_communication.h index 6289d068d95..694655ed461 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_communication.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.h @@ -58,7 +58,7 @@ class OpenSearchCommunication { 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); OpenSearchResult* PopResult(); diff --git a/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp index 3a529c4c472..bb5925172cf 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp @@ -19,8 +19,8 @@ #include #include -#include "misc.h" #include "opensearch_odbc.h" +#include "misc.h" #ifndef WIN32 #include diff --git a/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp b/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp index 8718309a6af..b4a0de82abf 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp @@ -164,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 @@ -182,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_odbc.c b/sql-odbc/src/odfesqlodbc/opensearch_odbc.c index 976a8472942..ec3aab0e4ab 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_odbc.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_odbc.c @@ -23,8 +23,8 @@ #include "dlg_specific.h" #include "environ.h" -#include "misc.h" #include "opensearch_odbc.h" +#include "misc.h" #ifdef WIN32 #include "loadlib.h" @@ -109,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/opensearch_types.c b/sql-odbc/src/odfesqlodbc/opensearch_types.c index 83dee9fac65..0a40b39b2ec 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_types.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.c @@ -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; } @@ -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; @@ -194,7 +194,7 @@ 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; diff --git a/sql-odbc/src/odfesqlodbc/options.c b/sql-odbc/src/odfesqlodbc/options.c index 0bec485b5f8..03dd7ed33b8 100644 --- a/sql-odbc/src/odfesqlodbc/options.c +++ b/sql-odbc/src/odfesqlodbc/options.c @@ -17,10 +17,10 @@ #include #include "environ.h" +#include "opensearch_odbc.h" #include "misc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" -#include "opensearch_odbc.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")); @@ -284,7 +284,7 @@ RETCODE SQL_API ESAPI_SetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, 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; @@ -446,7 +446,7 @@ RETCODE SQL_API ESAPI_GetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, 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; @@ -565,7 +565,7 @@ RETCODE SQL_API ESAPI_SetStmtOption(HSTMT hstmt, SQLUSMALLINT fOption, 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 @@ -592,7 +592,7 @@ RETCODE SQL_API ESAPI_GetStmtOption(HSTMT hstmt, SQLUSMALLINT fOption, 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 3017a848962..60c093402ef 100644 --- a/sql-odbc/src/odfesqlodbc/parse.c +++ b/sql-odbc/src/odfesqlodbc/parse.c @@ -19,13 +19,13 @@ #include #include "catfunc.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 "opensearch_odbc.h" -#include "opensearch_types.h" #include "qresult.h" #include "statement.h" diff --git a/sql-odbc/src/odfesqlodbc/qresult.c b/sql-odbc/src/odfesqlodbc/qresult.c index 52a78229bfd..3f8f98aa026 100644 --- a/sql-odbc/src/odfesqlodbc/qresult.c +++ b/sql-odbc/src/odfesqlodbc/qresult.c @@ -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) { @@ -194,7 +194,7 @@ QResultClass *QR_Constructor(void) { 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); @@ -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 b5936c99ed2..1645d8938f6 100644 --- a/sql-odbc/src/odfesqlodbc/qresult.h +++ b/sql-odbc/src/odfesqlodbc/qresult.h @@ -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/results.c b/sql-odbc/src/odfesqlodbc/results.c index 7a6cacb799d..d86023e6bfe 100644 --- a/sql-odbc/src/odfesqlodbc/results.c +++ b/sql-odbc/src/odfesqlodbc/results.c @@ -22,12 +22,12 @@ #include "convert.h" #include "dlg_specific.h" #include "environ.h" +#include "opensearch_odbc.h" +#include "opensearch_types.h" #include "misc.h" #include "opensearch_apifunc.h" #include "opensearch_connection.h" -#include "opensearch_odbc.h" #include "opensearch_statement.h" -#include "opensearch_types.h" #include "qresult.h" #include "statement.h" @@ -41,7 +41,7 @@ RETCODE SQL_API ESAPI_RowCount(HSTMT hstmt, SQLLEN *pcrow) { 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; @@ -75,7 +75,7 @@ RETCODE SQL_API ESAPI_NumResultCols(HSTMT hstmt, SQLSMALLINT *pccol) { 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; @@ -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) @@ -234,7 +234,7 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, decimal_digits = estype_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); @@ -246,9 +246,9 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, decimal_digits = estype_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; @@ -280,7 +280,7 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, *pfSqlType = estype_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 +292,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 +304,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); } /* @@ -316,7 +316,7 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, else *pfNullable = fi ? fi->nullable : estype_nullable(conn, fieldtype); - MYLOG(ES_DEBUG, "col %d *pfNullable = %d\n", icol, *pfNullable); + MYLOG(OPENSEARCH_DEBUG, "col %d *pfNullable = %d\n", icol, *pfNullable); } cleanup: @@ -346,7 +346,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 +374,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 +476,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 @@ -503,7 +503,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, value = estype_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; @@ -522,7 +522,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, : estype_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,24 +531,24 @@ 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: @@ -560,13 +560,13 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, /* 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); + MYLOG(OPENSEARCH_ALL, "COLUMN_MONEY=" FORMAT_LEN "\n", value); break; case SQL_DESC_NULLABLE: @@ -574,12 +574,12 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, value = TRUE; else value = fi ? fi->nullable : estype_nullable(conn, field_type); - MYLOG(ES_ALL, "COLUMN_NULLABLE=" FORMAT_LEN "\n", value); + 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 +587,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; @@ -598,7 +598,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, 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); + MYLOG(OPENSEARCH_ALL, "COLUMN_SCALE=" FORMAT_LEN "\n", value); if (value < 0) value = 0; break; @@ -610,13 +610,13 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, 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); + MYLOG(OPENSEARCH_DEBUG, "COLUMN_TYPE=" FORMAT_LEN "\n", value); break; case SQL_COLUMN_TYPE_NAME: /* == SQL_DESC_TYPE_NAME */ @@ -656,19 +656,19 @@ 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) @@ -678,7 +678,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, 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: @@ -688,7 +688,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, 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 */ @@ -698,7 +698,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, 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 */ @@ -789,7 +789,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 +830,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 +855,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 +894,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 +921,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 +951,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)); @@ -1011,7 +1011,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; } @@ -1027,7 +1027,7 @@ RETCODE SQL_API ESAPI_Fetch(HSTMT hstmt) { 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) { @@ -1107,12 +1107,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 +1138,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 +1148,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 +1180,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 +1194,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 +1211,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 +1219,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); */ \ @@ -1247,7 +1247,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) { @@ -1323,7 +1323,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,7 +1354,7 @@ 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); @@ -1432,7 +1432,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 +1443,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 +1464,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 +1537,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 */ @@ -1566,7 +1566,7 @@ RETCODE SQL_API ESAPI_MoreResults(HSTMT 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; @@ -1594,7 +1594,7 @@ RETCODE SQL_API ESAPI_MoreResults(HSTMT hstmt) { ESAPI_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 +1603,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); @@ -1620,7 +1620,7 @@ RETCODE SQL_API ESAPI_SetCursorName(HSTMT hstmt, const SQLCHAR *szCursor, CSTR func = "ESAPI_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) { @@ -1642,7 +1642,7 @@ RETCODE SQL_API ESAPI_GetCursorName(HSTMT hstmt, SQLCHAR *szCursor, 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 57fcd43bbce..3486b4653bd 100644 --- a/sql-odbc/src/odfesqlodbc/setup.c +++ b/sql-odbc/src/odfesqlodbc/setup.c @@ -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); diff --git a/sql-odbc/src/odfesqlodbc/statement.c b/sql-odbc/src/odfesqlodbc/statement.c index 18db58d944d..8a3953e7ee6 100644 --- a/sql-odbc/src/odfesqlodbc/statement.c +++ b/sql-odbc/src/odfesqlodbc/statement.c @@ -100,7 +100,7 @@ RETCODE SQL_API ESAPI_AllocStmt(HDBC hdbc, HSTMT *phstmt, UDWORD flag) { 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, @@ -152,7 +152,7 @@ RETCODE SQL_API ESAPI_FreeStmt(HSTMT hstmt, SQLUSMALLINT fOption) { CSTR func = "ESAPI_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); @@ -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) { @@ -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; @@ -927,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) @@ -973,7 +973,7 @@ void SC_full_error_copy(StatementClass *self, const StatementClass *from, BOOL allres) { OpenSearch_ErrorInfo *eserror; - 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) @@ -1068,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 @@ -1088,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); @@ -1120,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); @@ -1137,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: @@ -1183,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; @@ -1229,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) @@ -1279,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) { @@ -1341,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); } } @@ -1449,7 +1449,7 @@ int SC_Create_bookmark(StatementClass *self, BindInfoClass *bookmark, size_t cvtlen = sizeof(Int4); ES_BM ES_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)); if (SQL_C_BOOKMARK == bookmark->returntype) @@ -1472,7 +1472,7 @@ 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", + MYLOG(OPENSEARCH_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); return COPY_OK; diff --git a/sql-odbc/src/odfesqlodbc/win_unicode.c b/sql-odbc/src/odfesqlodbc/win_unicode.c index 9727b567844..e289bbd9db1 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; @@ -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); @@ -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,7 +580,7 @@ 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++) { @@ -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,7 +789,7 @@ 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 && OPENSEARCH_LINEFEED == *cdt && i > 0 && OPENSEARCH_CARRIAGE_RETURN != cdt[-1]) { @@ -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; } From 8990a334c13e9ae7fd22fe56640ab9651c0b2822 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 20:31:18 -0700 Subject: [PATCH 19/36] Rename es_result --- sql-odbc/src/odfesqlodbc/mylog.c | 24 +++++------ .../odfesqlodbc/opensearch_communication.cpp | 41 ++++++++++--------- .../odfesqlodbc/opensearch_communication.h | 6 +-- .../odfesqlodbc/opensearch_parse_result.cpp | 10 ++--- .../src/odfesqlodbc/opensearch_statement.cpp | 16 ++++---- sql-odbc/src/odfesqlodbc/opensearch_types.h | 2 +- sql-odbc/src/odfesqlodbc/qresult.c | 8 ++-- sql-odbc/src/odfesqlodbc/qresult.h | 2 +- 8 files changed, 56 insertions(+), 53 deletions(-) diff --git a/sql-odbc/src/odfesqlodbc/mylog.c b/sql-odbc/src/odfesqlodbc/mylog.c index 2b8106ff159..c49f77c05b0 100644 --- a/sql-odbc/src/odfesqlodbc/mylog.c +++ b/sql-odbc/src/odfesqlodbc/mylog.c @@ -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; @@ -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; diff --git a/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp index 6b48288a8b5..01d0ef876e9 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp @@ -131,44 +131,46 @@ void OpenSearchCommunication::AwsHttpResponseToString( output.assign(buf.data(), avail); } -void OpenSearchCommunication::PrepareCursorResult(OpenSearchResult& es_result) { +void OpenSearchCommunication::PrepareCursorResult(OpenSearchResult& opensearch_result) { // Prepare document and validate result try { LogMsg(OPENSEARCH_DEBUG, "Parsing result JSON with cursor."); - es_result.es_result_doc.parse(es_result.result_json, + 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 > OpenSearchCommunication::ParseErrorResponse( - OpenSearchResult& es_result) { + OpenSearchResult& opensearch_result) { // Prepare document and validate schema try { LogMsg(OPENSEARCH_DEBUG, "Parsing error response (with schema validation)"); - es_result.es_result_doc.parse(es_result.result_json, + 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()); } } @@ -190,17 +192,18 @@ void OpenSearchCommunication::SetErrorDetails(ErrorDetails details) { m_error_details = error_details; } -void OpenSearchCommunication::GetJsonSchema(OpenSearchResult& es_result) { +void OpenSearchCommunication::GetJsonSchema(OpenSearchResult& opensearch_result) { // Prepare document and validate schema try { LogMsg(OPENSEARCH_DEBUG, "Parsing result JSON with schema."); - es_result.es_result_doc.parse(es_result.result_json, JSON_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()); } } @@ -580,7 +583,7 @@ std::vector< std::string > OpenSearchCommunication::GetColumnsWithSelectQuery( 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(); @@ -709,9 +712,9 @@ void OpenSearchCommunication::SendCursorQueries(std::string cursor) { 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(); @@ -761,7 +764,7 @@ void OpenSearchCommunication::StopResultRetrieval() { 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(); @@ -777,8 +780,8 @@ void OpenSearchCommunication::ConstructOpenSearchResult(OpenSearchResult& 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(); diff --git a/sql-odbc/src/odfesqlodbc/opensearch_communication.h b/sql-odbc/src/odfesqlodbc/opensearch_communication.h index 694655ed461..27602b92e52 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_communication.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.h @@ -84,10 +84,10 @@ class OpenSearchCommunication { bool CheckConnectionOptions(); bool EstablishConnection(); void ConstructOpenSearchResult(OpenSearchResult& result); - void GetJsonSchema(OpenSearchResult& es_result); - void PrepareCursorResult(OpenSearchResult& es_result); + void GetJsonSchema(OpenSearchResult& opensearch_result); + void PrepareCursorResult(OpenSearchResult& opensearch_result); std::shared_ptr< ErrorDetails > ParseErrorResponse( - OpenSearchResult& es_result); + OpenSearchResult& opensearch_result); void SetErrorDetails(std::string reason, std::string message, ConnErrorType error_type); void SetErrorDetails(ErrorDetails details); diff --git a/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp index bd7c66db51d..baabbfb467e 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp @@ -156,12 +156,12 @@ bool _CC_No_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass try { schema_type doc_schema; - GetSchemaInfo(doc_schema, opensearch_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(opensearch_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; @@ -195,7 +195,7 @@ bool _CC_Metadata_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *co QR_set_conn(q_res, conn); try { schema_type doc_schema; - GetSchemaInfo(doc_schema, opensearch_result.es_result_doc); + GetSchemaInfo(doc_schema, opensearch_result.opensearch_result_doc); // Assign table data and column headers if (!AssignColumnHeaders(doc_schema, q_res, opensearch_result)) @@ -233,12 +233,12 @@ bool _CC_from_OpenSearchResult(QResultClass *q_res, ConnectionClass *conn, QR_set_conn(q_res, conn); try { schema_type doc_schema; - GetSchemaInfo(doc_schema, opensearch_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, opensearch_result)) - || (!AssignTableData(opensearch_result.es_result_doc, q_res, doc_schema.size(), + || (!AssignTableData(opensearch_result.opensearch_result_doc, q_res, doc_schema.size(), *(q_res->fields)))) return false; diff --git a/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp index 9bb51b95200..aeedd4fb0de 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp @@ -174,16 +174,16 @@ SQLRETURN GetNextResultSet(StatementClass *stmt) { OpenSearchResult *es_res = OpenSearchGetResult(conn->esconn); 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)); } @@ -275,10 +275,10 @@ QResultClass *SendQueryGetResult(StatementClass *stmt, BOOL commit) { if (commit) { // Deallocate OpenSearchResult OpenSearchClearResult(es_res); - res->es_result = NULL; + res->opensearch_result = NULL; } else { // Set OpenSearchResult into connection class so it can be used later - res->es_result = es_res; + res->opensearch_result = es_res; } return res; } @@ -288,12 +288,12 @@ 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 - OpenSearchResult *es_res = static_cast< OpenSearchResult * >(res->es_result); + OpenSearchResult *es_res = static_cast< OpenSearchResult * >(res->opensearch_result); ConnectionClass *conn = SC_get_conn(stmt); if (!CC_No_Metadata_from_OpenSearchResult(res, conn, res->cursor_name, *es_res)) { @@ -304,7 +304,7 @@ RETCODE AssignResult(StatementClass *stmt) { // Deallocate and return result OpenSearchClearResult(es_res); - res->es_result = NULL; + res->opensearch_result = NULL; return SQL_SUCCESS; } diff --git a/sql-odbc/src/odfesqlodbc/opensearch_types.h b/sql-odbc/src/odfesqlodbc/opensearch_types.h index 923fc6f30d3..8735f090c65 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_types.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.h @@ -342,7 +342,7 @@ typedef struct OpenSearchResult { std::string cursor; std::string result_json; std::string command_type; // SELECT / FETCH / etc - rabbit::document es_result_doc; + rabbit::document opensearch_result_doc; OpenSearchResult() { ref_count = 0; num_fields = 0; diff --git a/sql-odbc/src/odfesqlodbc/qresult.c b/sql-odbc/src/odfesqlodbc/qresult.c index 3f8f98aa026..25bc1ebe165 100644 --- a/sql-odbc/src/odfesqlodbc/qresult.c +++ b/sql-odbc/src/odfesqlodbc/qresult.c @@ -190,7 +190,7 @@ 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; } @@ -467,9 +467,9 @@ void QR_free_memory(QResultClass *self) { free(self->updated_tuples); self->updated_tuples = NULL; } - if (self->es_result) { - ClearOpenSearchResult(self->es_result); - self->es_result = NULL; + if (self->opensearch_result) { + ClearOpenSearchResult(self->opensearch_result); + self->opensearch_result = NULL; } self->up_alloc = 0; diff --git a/sql-odbc/src/odfesqlodbc/qresult.h b/sql-odbc/src/odfesqlodbc/qresult.h index 1645d8938f6..44fd277fc55 100644 --- a/sql-odbc/src/odfesqlodbc/qresult.h +++ b/sql-odbc/src/odfesqlodbc/qresult.h @@ -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; }; From d2586f59dfe1b8f958f9fb46c98cd89865ac6490 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 20:44:01 -0700 Subject: [PATCH 20/36] Rename esNAME, esconn --- sql-odbc/src/UnitTests/UTConn/test_conn.cpp | 22 +++++++++---------- sql-odbc/src/odfesqlodbc/bind.h | 2 +- sql-odbc/src/odfesqlodbc/connection.c | 12 +++++----- sql-odbc/src/odfesqlodbc/convert.c | 6 ++--- sql-odbc/src/odfesqlodbc/descriptor.h | 22 +++++++++---------- sql-odbc/src/odfesqlodbc/dlg_specific.c | 16 +++++++------- sql-odbc/src/odfesqlodbc/dlg_wingui.c | 2 +- sql-odbc/src/odfesqlodbc/odbcapi.c | 2 +- .../src/odfesqlodbc/opensearch_connection.cpp | 22 +++++++++---------- .../src/odfesqlodbc/opensearch_connection.h | 14 ++++++------ .../src/odfesqlodbc/opensearch_helper.cpp | 6 ++--- sql-odbc/src/odfesqlodbc/opensearch_helper.h | 2 +- sql-odbc/src/odfesqlodbc/opensearch_info.cpp | 2 +- sql-odbc/src/odfesqlodbc/opensearch_odbc.h | 10 ++++----- .../src/odfesqlodbc/opensearch_statement.cpp | 10 ++++----- sql-odbc/src/odfesqlodbc/opensearch_types.h | 2 +- sql-odbc/src/odfesqlodbc/statement.c | 4 ++-- sql-odbc/src/odfesqlodbc/statement.h | 2 +- 18 files changed, 79 insertions(+), 79 deletions(-) diff --git a/sql-odbc/src/UnitTests/UTConn/test_conn.cpp b/sql-odbc/src/UnitTests/UTConn/test_conn.cpp index 7790d11b689..b12b2502d06 100644 --- a/sql-odbc/src/UnitTests/UTConn/test_conn.cpp +++ b/sql-odbc/src/UnitTests/UTConn/test_conn.cpp @@ -44,21 +44,21 @@ runtime_options missing_opt_val = {{"", "", "1", "0"}, {"BASIC", "", invalid_pw, valid_region}, {use_ssl, false, "", "", "", ""}}; -TEST(TestESConnConnectionOptions, ValidParameters) { +TEST(TestOpenSearchConnConnectionOptions, ValidParameters) { OpenSearchCommunication conn; EXPECT_EQ(true, conn.ConnectionOptions(valid_opt_val, 1, 1, valid_option_count)); } -TEST(TestESConnConnectionOptions, MissingParameters) { +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,35 +68,35 @@ class TestESConnConnectDBStart : public testing::Test { m_conn.DropDBConnection(); } - ~TestESConnConnectDBStart() { + ~TestOpenSearchConnConnectDBStart() { // cleanup any pending stuff, but no exceptions allowed } 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) { +TEST(TestOpenSearchConnDropDBConnection, InvalidParameters) { OpenSearchCommunication conn; ASSERT_EQ(CONNECTION_BAD, conn.GetConnectionStatus()); ASSERT_TRUE( @@ -107,7 +107,7 @@ TEST(TestESConnDropDBConnection, InvalidParameters) { EXPECT_EQ(CONNECTION_BAD, conn.GetConnectionStatus()); } -TEST(TestESConnDropDBConnection, MissingParameters) { +TEST(TestOpenSearchConnDropDBConnection, MissingParameters) { OpenSearchCommunication conn; ASSERT_EQ(CONNECTION_BAD, conn.GetConnectionStatus()); ASSERT_NE(true, conn.ConnectionOptions(missing_opt_val, 1, 1, @@ -118,7 +118,7 @@ TEST(TestESConnDropDBConnection, MissingParameters) { EXPECT_EQ(CONNECTION_BAD, conn.GetConnectionStatus()); } -TEST(TestESConnDropDBConnection, ValidParameters) { +TEST(TestOpenSearchConnDropDBConnection, ValidParameters) { OpenSearchCommunication conn; ASSERT_NE(false, conn.ConnectionOptions(valid_opt_val, 1, 1, valid_option_count)); diff --git a/sql-odbc/src/odfesqlodbc/bind.h b/sql-odbc/src/odfesqlodbc/bind.h index 1153de4927e..f8e989975b5 100644 --- a/sql-odbc/src/odfesqlodbc/bind.h +++ b/sql-odbc/src/odfesqlodbc/bind.h @@ -82,7 +82,7 @@ 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; diff --git a/sql-odbc/src/odfesqlodbc/connection.c b/sql-odbc/src/odfesqlodbc/connection.c index f5bce963093..1e4ac7ac4e4 100644 --- a/sql-odbc/src/odfesqlodbc/connection.c +++ b/sql-odbc/src/odfesqlodbc/connection.c @@ -416,10 +416,10 @@ CC_cleanup(ConnectionClass *self, BOOL keepCommunication) { /* 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, "LIBES_disconnect: %p\n", self->opensearchconn); + LIBES_disconnect(self->opensearchconn); + self->opensearchconn = NULL; } else { ret = SQL_ERROR; CC_set_error(self, CC_not_connected(self), "Connection not open", func); @@ -645,8 +645,8 @@ void CC_log_error(const char *func, const char *desc, MYLOG(OPENSEARCH_ERROR, " henv=%p, conn=%p, status=%u, num_stmts=%d\n", self->henv, self, self->status, self->num_stmts); - MYLOG(OPENSEARCH_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(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 e3434451b71..c9c12f6763f 100644 --- a/sql-odbc/src/odfesqlodbc/convert.c +++ b/sql-odbc/src/odfesqlodbc/convert.c @@ -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; diff --git a/sql-odbc/src/odfesqlodbc/descriptor.h b/sql-odbc/src/odfesqlodbc/descriptor.h index 4a6069e652c..c7ae05ea498 100644 --- a/sql-odbc/src/odfesqlodbc/descriptor.h +++ b/sql-odbc/src/odfesqlodbc/descriptor.h @@ -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); diff --git a/sql-odbc/src/odfesqlodbc/dlg_specific.c b/sql-odbc/src/odfesqlodbc/dlg_specific.c index 8442d212dd3..50b637de4cb 100644 --- a/sql-odbc/src/odfesqlodbc/dlg_specific.c +++ b/sql-odbc/src/odfesqlodbc/dlg_specific.c @@ -23,9 +23,9 @@ #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 \ @@ -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))) diff --git a/sql-odbc/src/odfesqlodbc/dlg_wingui.c b/sql-odbc/src/odfesqlodbc/dlg_wingui.c index ac7331d1d6b..5400a4748d9 100644 --- a/sql-odbc/src/odfesqlodbc/dlg_wingui.c +++ b/sql-odbc/src/odfesqlodbc/dlg_wingui.c @@ -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); diff --git a/sql-odbc/src/odfesqlodbc/odbcapi.c b/sql-odbc/src/odfesqlodbc/odbcapi.c index 66b0da6904b..f9a5f2d82ae 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi.c @@ -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); diff --git a/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp b/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp index 530a289be9f..4bbe67b711a 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp @@ -111,9 +111,9 @@ 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 = OpenSearchConnectDBParams(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()) ? "OpenSearchConnectDBParams error" : err.c_str(), "LIBES_connect"); @@ -121,8 +121,8 @@ int LIBES_connect(ConnectionClass *self) { } // Check connection status - if (OpenSearchStatus(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", @@ -132,18 +132,18 @@ int LIBES_connect(ConnectionClass *self) { "Connection error: No message available."); CC_set_error(self, CONN_OPENDB_ERROR, error_message_out, "LIBES_connect"); - OpenSearchDisconnect(esconn); + OpenSearchDisconnect(opensearchconn); return 0; } // Set server version - std::string server_version = GetServerVersion(esconn); + 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 = OpenSearchGetClientEncoding(self->esconn); + std::string cur_db_encoding = OpenSearchGetClientEncoding(self->opensearchconn); if (des_db_encoding != cur_db_encoding) { - if (!OpenSearchSetClientEncoding(self->esconn, des_db_encoding)) { + if (!OpenSearchSetClientEncoding(self->opensearchconn, des_db_encoding)) { return SQL_ERROR; } } diff --git a/sql-odbc/src/odfesqlodbc/opensearch_connection.h b/sql-odbc/src/odfesqlodbc/opensearch_connection.h index cbef3ff3acd..9ea91a623df 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_connection.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_connection.h @@ -218,8 +218,8 @@ typedef enum { 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; @@ -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,8 +405,8 @@ 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); diff --git a/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp b/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp index b4a0de82abf..0b029e83c29 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_helper.cpp @@ -80,9 +80,9 @@ void* InitializeOpenSearchConn() { return new OpenSearchCommunication(); } -int OpenSearchExecDirect(void* es_conn, const char* statement, const char* fetch_size) { - return (es_conn && statement) - ? static_cast< OpenSearchCommunication* >(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; } diff --git a/sql-odbc/src/odfesqlodbc/opensearch_helper.h b/sql-odbc/src/odfesqlodbc/opensearch_helper.h index f3c77b364d3..5f0c3f81acd 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_helper.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_helper.h @@ -42,7 +42,7 @@ 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* es_conn, const char* statement, const char* fetch_size); +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); diff --git a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp index 04eebcbc5ab..93818711066 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp @@ -856,7 +856,7 @@ ESAPI_Columns(HSTMT hstmt, const SQLCHAR *catalog_name_sql, if (table_valid) { ConnectionClass *conn = SC_get_conn(stmt); list_of_columns = - OpenSearchGetColumnsWithSelectQuery(conn->esconn, table_name); + OpenSearchGetColumnsWithSelectQuery(conn->opensearchconn, table_name); } // TODO #324 (SQL Plugin)- evaluate catalog & schema support diff --git a/sql-odbc/src/odfesqlodbc/opensearch_odbc.h b/sql-odbc/src/odfesqlodbc/opensearch_odbc.h index 0e45e5004ba..fb68577eb83 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_odbc.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_odbc.h @@ -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; @@ -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 diff --git a/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp index aeedd4fb0de..1e0ee453c07 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp @@ -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,7 +171,7 @@ SQLRETURN GetNextResultSet(StatementClass *stmt) { return SQL_ERROR; } - OpenSearchResult *es_res = OpenSearchGetResult(conn->esconn); + OpenSearchResult *es_res = OpenSearchGetResult(conn->opensearchconn); if (es_res != NULL) { // Save server cursor id to fetch more pages later if (es_res->opensearch_result_doc.has("cursor")) { @@ -245,7 +245,7 @@ QResultClass *SendQueryGetResult(StatementClass *stmt, BOOL commit) { // Send command ConnectionClass *conn = SC_get_conn(stmt); - if (OpenSearchExecDirect(conn->esconn, stmt->statement, + if (OpenSearchExecDirect(conn->opensearchconn, stmt->statement, conn->connInfo.fetch_size) != 0) { QR_Destructor(res); @@ -254,7 +254,7 @@ QResultClass *SendQueryGetResult(StatementClass *stmt, BOOL commit) { res->rstatus = PORES_COMMAND_OK; // Get OpenSearchResult - OpenSearchResult *es_res = OpenSearchGetResult(conn->esconn); + OpenSearchResult *es_res = OpenSearchGetResult(conn->opensearchconn); if (es_res == NULL) { QR_Destructor(res); return NULL; diff --git a/sql-odbc/src/odfesqlodbc/opensearch_types.h b/sql-odbc/src/odfesqlodbc/opensearch_types.h index 8735f090c65..bcef74a0c24 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_types.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.h @@ -24,7 +24,7 @@ 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 */ diff --git a/sql-odbc/src/odfesqlodbc/statement.c b/sql-odbc/src/odfesqlodbc/statement.c index 8a3953e7ee6..81c1390f713 100644 --- a/sql-odbc/src/odfesqlodbc/statement.c +++ b/sql-odbc/src/odfesqlodbc/statement.c @@ -163,7 +163,7 @@ RETCODE SQL_API ESAPI_FreeStmt(HSTMT hstmt, SQLUSMALLINT fOption) { if (fOption == SQL_DROP) { ConnectionClass *conn = stmt->hdbc; - OpenSearchStopRetrieval(conn->esconn); + OpenSearchStopRetrieval(conn->opensearchconn); /* Remove the statement from the connection's statement list */ if (conn) { @@ -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) { - OpenSearchStopRetrieval(stmt->hdbc->esconn); + OpenSearchStopRetrieval(stmt->hdbc->opensearchconn); /* * this should discard all the results, but leave the statement diff --git a/sql-odbc/src/odfesqlodbc/statement.h b/sql-odbc/src/odfesqlodbc/statement.h index 4e0b72e7460..e9022e0e705 100644 --- a/sql-odbc/src/odfesqlodbc/statement.h +++ b/sql-odbc/src/odfesqlodbc/statement.h @@ -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; From ecd8002701b43e92f8903083352e57e379725efb Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 20:58:09 -0700 Subject: [PATCH 21/36] Rename estype_ functions --- sql-odbc/src/odfesqlodbc/convert.c | 2 +- sql-odbc/src/odfesqlodbc/info.c | 30 +-- sql-odbc/src/odfesqlodbc/opensearch_info.cpp | 34 ++-- sql-odbc/src/odfesqlodbc/opensearch_types.c | 190 +++++++++---------- sql-odbc/src/odfesqlodbc/opensearch_types.h | 76 ++++---- sql-odbc/src/odfesqlodbc/results.c | 77 ++++---- 6 files changed, 207 insertions(+), 202 deletions(-) diff --git a/sql-odbc/src/odfesqlodbc/convert.c b/sql-odbc/src/odfesqlodbc/convert.c index c9c12f6763f..84513addf24 100644 --- a/sql-odbc/src/odfesqlodbc/convert.c +++ b/sql-odbc/src/odfesqlodbc/convert.c @@ -1255,7 +1255,7 @@ 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; diff --git a/sql-odbc/src/odfesqlodbc/info.c b/sql-odbc/src/odfesqlodbc/info.c index aaab1a2d6fb..e1d6be600e2 100644 --- a/sql-odbc/src/odfesqlodbc/info.c +++ b/sql-odbc/src/odfesqlodbc/info.c @@ -915,30 +915,30 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, } /* - * macros for estype_xxxx() calls which have OPENSEARCH_ATP_UNSET parameters + * macros for opensearchtype_xxxx() calls which have OPENSEARCH_ATP_UNSET parameters */ -#define ESTYPE_COLUMN_SIZE(conn, esType) \ +#define OPENSEARCHTYPE_COLUMN_SIZE(conn, esType) \ estype_attr_column_size(conn, esType, OPENSEARCH_ATP_UNSET, \ OPENSEARCH_ADT_UNSET, OPENSEARCH_UNKNOWNS_UNSET) -#define ESTYPE_TO_CONCISE_TYPE(conn, esType) \ +#define OPENSEARCHTYPE_TO_CONCISE_TYPE(conn, esType) \ estype_attr_to_concise_type(conn, esType, OPENSEARCH_ATP_UNSET, \ OPENSEARCH_ADT_UNSET, \ OPENSEARCH_UNKNOWNS_UNSET) -#define ESTYPE_TO_SQLDESCTYPE(conn, esType) \ +#define OPENSEARCHTYPE_TO_SQLDESCTYPE(conn, esType) \ estype_attr_to_sqldesctype(conn, esType, OPENSEARCH_ATP_UNSET, \ OPENSEARCH_ADT_UNSET, \ OPENSEARCH_UNKNOWNS_UNSET) -#define ESTYPE_BUFFER_LENGTH(conn, esType) \ +#define OPENSEARCHTYPE_BUFFER_LENGTH(conn, esType) \ estype_attr_buffer_length(conn, esType, OPENSEARCH_ATP_UNSET, \ OPENSEARCH_ADT_UNSET, OPENSEARCH_UNKNOWNS_UNSET) -#define ESTYPE_DECIMAL_DIGITS(conn, esType) \ +#define OPENSEARCHTYPE_DECIMAL_DIGITS(conn, esType) \ estype_attr_decimal_digits(conn, esType, OPENSEARCH_ATP_UNSET, \ OPENSEARCH_ADT_UNSET, \ OPENSEARCH_UNKNOWNS_UNSET) -#define ESTYPE_TRANSFER_OCTET_LENGTH(conn, esType) \ +#define OPENSEARCHTYPE_TRANSFER_OCTET_LENGTH(conn, esType) \ estype_attr_transfer_octet_length(conn, esType, OPENSEARCH_ATP_UNSET, \ OPENSEARCH_UNKNOWNS_UNSET) -#define ESTYPE_TO_NAME(conn, esType, auto_increment) \ +#define OPENSEARCHTYPE_TO_NAME(conn, esType, auto_increment) \ estype_attr_to_name(conn, esType, OPENSEARCH_ATP_UNSET, auto_increment) RETCODE SQL_API ESAPI_GetFunctions(HDBC hdbc, SQLUSMALLINT fFunction, @@ -1245,25 +1245,25 @@ char *identifierEscape(const SQLCHAR *src, SQLLEN srclen, * macros for estype_attr_xxxx() calls which have * OPENSEARCH_ADT_UNSET or OPENSEARCH_UNKNOWNS_UNSET parameters */ -#define ESTYPE_ATTR_COLUMN_SIZE(conn, esType, atttypmod) \ +#define OPENSEARCHTYPE_ATTR_COLUMN_SIZE(conn, esType, atttypmod) \ estype_attr_column_size(conn, esType, atttypmod, OPENSEARCH_ADT_UNSET, \ OPENSEARCH_UNKNOWNS_UNSET) -#define ESTYPE_ATTR_TO_CONCISE_TYPE(conn, esType, atttypmod) \ +#define OPENSEARCHTYPE_ATTR_TO_CONCISE_TYPE(conn, esType, atttypmod) \ estype_attr_to_concise_type(conn, esType, atttypmod, OPENSEARCH_ADT_UNSET, \ OPENSEARCH_UNKNOWNS_UNSET) -#define ESTYPE_ATTR_TO_SQLDESCTYPE(conn, esType, atttypmod) \ +#define OPENSEARCHTYPE_ATTR_TO_SQLDESCTYPE(conn, esType, atttypmod) \ estype_attr_to_sqldesctype(conn, esType, atttypmod, OPENSEARCH_ADT_UNSET, \ OPENSEARCH_UNKNOWNS_UNSET) -#define ESTYPE_ATTR_DISPLAY_SIZE(conn, esType, atttypmod) \ +#define OPENSEARCHTYPE_ATTR_DISPLAY_SIZE(conn, esType, atttypmod) \ estype_attr_display_size(conn, esType, atttypmod, OPENSEARCH_ADT_UNSET, \ OPENSEARCH_UNKNOWNS_UNSET) -#define ESTYPE_ATTR_BUFFER_LENGTH(conn, esType, atttypmod) \ +#define OPENSEARCHTYPE_ATTR_BUFFER_LENGTH(conn, esType, atttypmod) \ estype_attr_buffer_length(conn, esType, atttypmod, OPENSEARCH_ADT_UNSET, \ OPENSEARCH_UNKNOWNS_UNSET) -#define ESTYPE_ATTR_DECIMAL_DIGITS(conn, esType, atttypmod) \ +#define OPENSEARCHTYPE_ATTR_DECIMAL_DIGITS(conn, esType, atttypmod) \ estype_attr_decimal_digits(conn, esType, atttypmod, OPENSEARCH_ADT_UNSET, \ OPENSEARCH_UNKNOWNS_UNSET) -#define ESTYPE_ATTR_TRANSFER_OCTET_LENGTH(conn, esType, atttypmod) \ +#define OPENSEARCHTYPE_ATTR_TRANSFER_OCTET_LENGTH(conn, esType, atttypmod) \ estype_attr_transfer_octet_length(conn, esType, atttypmod, \ OPENSEARCH_UNKNOWNS_UNSET) diff --git a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp index 93818711066..47096bd41bb 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp @@ -947,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]); @@ -966,28 +966,30 @@ RETCODE SetTypeResult(ConnectionClass *conn, StatementClass *stmt, // These values can be NULL set_nullfield_int4( &tuple[GETTYPE_COLUMN_SIZE], - estype_attr_column_size(conn, esType, OPENSEARCH_ATP_UNSET, - OPENSEARCH_ADT_UNSET, OPENSEARCH_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, OPENSEARCH_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; diff --git a/sql-odbc/src/odfesqlodbc/opensearch_types.c b/sql-odbc/src/odfesqlodbc/opensearch_types.c index 0a40b39b2ec..7fc715eb6f3 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_types.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.c @@ -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 @@ -256,7 +256,7 @@ estype_attr_to_concise_type(const ConnectionClass *conn, OID type, case OPENSEARCH_TYPE_BPCHAR: bFixed = TRUE; case OPENSEARCH_TYPE_VARCHAR: - if (getCharColumnSizeX(conn, type, atttypmod, adtsize_or_longestlen, + if (getCharColumnSizeX(conn, type, typmod, adtsize_or_longestlen, handle_unknown_size_as) > MAX_VARCHAR_SIZE) bLongVarchar = TRUE; @@ -268,7 +268,7 @@ estype_attr_to_concise_type(const ConnectionClass *conn, OID type, 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) @@ -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,7 +367,7 @@ 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; @@ -376,9 +376,9 @@ estype_attr_to_sqldesctype(const ConnectionClass *conn, OID type, int atttypmod, 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,15 +388,15 @@ 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; @@ -474,7 +474,7 @@ 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) { @@ -514,7 +514,7 @@ const char *estype_attr_to_name(const ConnectionClass *conn, OID type, } Int4 /* OpenSearch restriction */ -estype_attr_column_size(const ConnectionClass *conn, OID type, int atttypmod, +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) { @@ -552,7 +552,7 @@ 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 OPENSEARCH_TYPE_NUMERIC: @@ -571,7 +571,7 @@ estype_attr_precision(const ConnectionClass *conn, OID type, int atttypmod, 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; @@ -619,13 +619,13 @@ Int4 estype_attr_display_size(const ConnectionClass *conn, OID type, /* 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; @@ -640,7 +640,7 @@ Int4 estype_attr_buffer_length(const ConnectionClass *conn, OID type, return 4; /* sizeof(SQLINTEGER) */ case OPENSEARCH_TYPE_INT8: - if (SQL_C_CHAR == estype_attr_to_ctype(conn, type, atttypmod)) + if (SQL_C_CHAR == opensearchtype_attr_to_ctype(conn, type, atttypmod)) return 20; /* signed: 19 digits + sign */ return 8; /* sizeof(SQLSBININT) */ @@ -679,9 +679,9 @@ Int4 estype_attr_buffer_length(const ConnectionClass *conn, OID type, 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; @@ -706,15 +706,15 @@ Int4 estype_attr_buffer_length(const ConnectionClass *conn, OID type, #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; @@ -752,19 +752,19 @@ Int4 estype_attr_desclength(const ConnectionClass *conn, OID type, case OPENSEARCH_TYPE_TIMESTAMP: case OPENSEARCH_TYPE_VARCHAR: case OPENSEARCH_TYPE_BPCHAR: - 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); 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 OPENSEARCH_TYPE_INT2: case OPENSEARCH_TYPE_OID: @@ -792,7 +792,7 @@ Int2 estype_attr_decimal_digits(const ConnectionClass *conn, OID type, 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 OPENSEARCH_TYPE_INTERVAL: @@ -804,19 +804,19 @@ 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 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; @@ -827,9 +827,9 @@ Int4 estype_attr_transfer_octet_length(const ConnectionClass *conn, OID type, case OPENSEARCH_TYPE_BPCHAR: case OPENSEARCH_TYPE_TEXT: case OPENSEARCH_TYPE_UNKNOWN: - column_size = estype_attr_column_size( - conn, type, atttypmod, - OPENSEARCH_ADT_UNSET, handle_unknown_size_as); + 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 @@ -847,14 +847,14 @@ Int4 estype_attr_transfer_octet_length(const ConnectionClass *conn, OID type, return maxvarc; return coef * column_size; case OPENSEARCH_TYPE_BYTEA: - return estype_attr_column_size(conn, type, atttypmod, - OPENSEARCH_ADT_UNSET, - handle_unknown_size_as); + 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, - OPENSEARCH_ADT_UNSET, - handle_unknown_size_as); + return opensearchtype_attr_column_size(conn, type, atttypmod, + OPENSEARCH_ADT_UNSET, + handle_unknown_size_as); } return -1; } @@ -926,7 +926,7 @@ const char *sqltype_to_escast(const ConnectionClass *conn, return esCast; } -OID sqltype_to_estype(const ConnectionClass *conn, SQLSMALLINT fSqlType) { +OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType) { OID esType = 0; switch (fSqlType) { case SQL_BINARY: @@ -1097,33 +1097,33 @@ 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); } /* @@ -1136,12 +1136,12 @@ const char *estype_to_name(const StatementClass *stmt, OID type, int col, * This is used for functions SQLDescribeCol and SQLColAttributes. */ Int4 /* OpenSearch restriction */ -estype_column_size(const StatementClass *stmt, OID type, int col, +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); } @@ -1150,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); } @@ -1174,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); } @@ -1200,7 +1200,7 @@ 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); @@ -1239,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; } @@ -1247,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; } @@ -1255,43 +1255,43 @@ 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 OPENSEARCH_TYPE_KEYWORD: @@ -1303,17 +1303,17 @@ 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 OPENSEARCH_TYPE_BOOL: @@ -1339,7 +1339,7 @@ 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 OPENSEARCH_TYPE_KEYWORD: @@ -1352,7 +1352,7 @@ const char *estype_literal_prefix(const ConnectionClass *conn, OID type) { } } -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 OPENSEARCH_TYPE_KEYWORD: @@ -1365,7 +1365,7 @@ const char *estype_literal_suffix(const ConnectionClass *conn, OID type) { } } -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/opensearch_types.h b/sql-odbc/src/odfesqlodbc/opensearch_types.h index bcef74a0c24..375e55fd2f9 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_types.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.h @@ -105,7 +105,7 @@ extern "C" { /* extern Int4 opensearch_types_defined[]; */ extern SQLSMALLINT sqlTypes[]; -/* Defines for estype_precision */ +/* 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 */ @@ -119,91 +119,91 @@ extern SQLSMALLINT sqlTypes[]; */ OID es_true_type(const ConnectionClass *, OID, OID); -OID sqltype_to_estype(const ConnectionClass *conn, SQLSMALLINT fSqlType); +OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType); const char *sqltype_to_escast(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); diff --git a/sql-odbc/src/odfesqlodbc/results.c b/sql-odbc/src/odfesqlodbc/results.c index d86023e6bfe..413879418bf 100644 --- a/sql-odbc/src/odfesqlodbc/results.c +++ b/sql-odbc/src/odfesqlodbc/results.c @@ -229,9 +229,10 @@ 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(OPENSEARCH_DEBUG, @@ -242,8 +243,9 @@ 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(OPENSEARCH_DEBUG, "col %d fieldname = '%s'\n", icol, NULL_IF_NULL(col_name)); @@ -277,8 +279,8 @@ 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(OPENSEARCH_DEBUG, "col %d *pfSqlType = %d\n", icol, *pfSqlType); } @@ -314,7 +316,7 @@ 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(OPENSEARCH_DEBUG, "col %d *pfNullable = %d\n", icol, *pfNullable); } @@ -494,13 +496,14 @@ 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(OPENSEARCH_DEBUG, "AUTO_INCREMENT=" FORMAT_LEN "\n", value); @@ -508,7 +511,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, 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,8 +522,8 @@ 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(OPENSEARCH_DEBUG, "col %d, display_size= " FORMAT_LEN "\n", col_idx, value); @@ -554,8 +557,8 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, 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; @@ -565,7 +568,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, break; case SQL_COLUMN_MONEY: /* == SQL_DESC_FIXED_PREC_SCALE */ - value = estype_money(conn, field_type); + value = opensearchtype_money(conn, field_type); MYLOG(OPENSEARCH_ALL, "COLUMN_MONEY=" FORMAT_LEN "\n", value); break; @@ -573,7 +576,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, if (SC_has_outer_join(stmt)) value = TRUE; else - value = fi ? fi->nullable : estype_nullable(conn, field_type); + value = fi ? fi->nullable : opensearchtype_nullable(conn, field_type); MYLOG(OPENSEARCH_ALL, "COLUMN_NULLABLE=" FORMAT_LEN "\n", value); break; @@ -597,14 +600,14 @@ 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); + 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 */ @@ -614,18 +617,18 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, break; case SQL_COLUMN_TYPE: /* == SQL_DESC_CONCISE_TYPE */ - value = estype_to_concise_type(stmt, field_type, col_idx, - unknown_sizes); + 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; @@ -673,8 +676,8 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, 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; @@ -684,7 +687,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, 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; @@ -693,8 +696,8 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, 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; @@ -702,26 +705,26 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, 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) From a14a8aa259668dd485cd09d16c0fd20761183e33 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 21:03:06 -0700 Subject: [PATCH 22/36] Rename eserror --- sql-odbc/src/odfesqlodbc/descriptor.c | 14 +++--- sql-odbc/src/odfesqlodbc/descriptor.h | 2 +- sql-odbc/src/odfesqlodbc/opensearch_info.cpp | 8 +-- .../src/odfesqlodbc/opensearch_statement.cpp | 10 ++-- sql-odbc/src/odfesqlodbc/opensearch_types.c | 6 +-- sql-odbc/src/odfesqlodbc/statement.c | 50 +++++++++---------- sql-odbc/src/odfesqlodbc/statement.h | 2 +- 7 files changed, 46 insertions(+), 46 deletions(-) diff --git a/sql-odbc/src/odfesqlodbc/descriptor.c b/sql-odbc/src/odfesqlodbc/descriptor.c index ee55a2c797e..c7fd19d4a58 100644 --- a/sql-odbc/src/odfesqlodbc/descriptor.c +++ b/sql-odbc/src/odfesqlodbc/descriptor.c @@ -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) { @@ -544,8 +544,8 @@ static OpenSearch_ErrorInfo *DC_create_errorinfo(const DescriptorClass *self) { 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) @@ -584,7 +584,7 @@ RETCODE SQL_API ESAPI_DescError(SQLHDESC hdesc, SQLSMALLINT RecNumber, DescriptorHeader *deschd = &(desc->deschd); MYLOG(OPENSEARCH_TRACE, "entering RecN=%hd\n", RecNumber); - deschd->eserror = DC_create_errorinfo(desc); - return ER_ReturnError(deschd->eserror, RecNumber, szSqlState, pfNativeError, + 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 c7ae05ea498..d7ab45feaa3 100644 --- a/sql-odbc/src/odfesqlodbc/descriptor.h +++ b/sql-odbc/src/odfesqlodbc/descriptor.h @@ -116,7 +116,7 @@ typedef struct DescriptorHeader_ { UInt4 error_index; /* 1-based index */ Int4 __error_number; char *__error_message; - OpenSearch_ErrorInfo *eserror; + OpenSearch_ErrorInfo *opensearch_error; } DescriptorHeader; /* diff --git a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp index 47096bd41bb..79455bd0d1b 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp @@ -1027,15 +1027,15 @@ 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) { + 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); + for (auto openSearchType : sql_es_type_map.at(fSqlType)) { + result = SetTypeResult(conn, stmt, res, openSearchType, fSqlType); } } } diff --git a/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp index 1e0ee453c07..a5f483be758 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp @@ -322,7 +322,7 @@ SQLRETURN ESAPI_Cancel(HSTMT hstmt) { 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; @@ -330,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/opensearch_types.c b/sql-odbc/src/odfesqlodbc/opensearch_types.c index 7fc715eb6f3..bd4e18f1830 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_types.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.c @@ -939,7 +939,7 @@ OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType) #ifdef UNICODE_SUPPORT case SQL_WCHAR: - esType = OPENSEARCH_TYPE_BPCHAR; + openSearchType = OPENSEARCH_TYPE_BPCHAR; break; #endif /* UNICODE_SUPPORT */ @@ -980,7 +980,7 @@ OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType) #ifdef UNICODE_SUPPORT case SQL_WLONGVARCHAR: - esType = OPENSEARCH_TYPE_VARCHAR; + openSearchType = OPENSEARCH_TYPE_VARCHAR; break; #endif /* UNICODE_SUPPORT */ @@ -1013,7 +1013,7 @@ OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType) #ifdef UNICODE_SUPPORT case SQL_WVARCHAR: - esType = OPENSEARCH_TYPE_VARCHAR; + openSearchType = OPENSEARCH_TYPE_VARCHAR; break; #endif /* UNICODE_SUPPORT */ diff --git a/sql-odbc/src/odfesqlodbc/statement.c b/sql-odbc/src/odfesqlodbc/statement.c index 81c1390f713..5d3b6513b6c 100644 --- a/sql-odbc/src/odfesqlodbc/statement.c +++ b/sql-odbc/src/odfesqlodbc/statement.c @@ -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; @@ -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); @@ -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) { @@ -799,8 +799,8 @@ static OpenSearch_ErrorInfo *SC_create_errorinfo(const StatementClass *self, Ope char *ermsg = NULL, *sqlstate = NULL; OpenSearch_ErrorInfo *eserror; - if (self->eserror) - return self->eserror; + if (self->opensearch_error) + return self->opensearch_error; errornum = self->__error_number; if (errornum == 0) return NULL; @@ -946,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); @@ -985,10 +985,10 @@ 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; @@ -997,9 +997,9 @@ void SC_full_error_copy(StatementClass *self, const StatementClass *from, ER_Destructor(eserror); return; } - if (self->eserror) - ER_Destructor(self->eserror); - self->eserror = eserror; + if (self->opensearch_error) + ER_Destructor(self->opensearch_error); + self->opensearch_error = eserror; } /* Returns the next SQL error information. */ @@ -1008,17 +1008,17 @@ RETCODE SQL_API ESAPI_StmtError(SQLHSTMT hstmt, SQLSMALLINT RecNumber, SQLCHAR *szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT *pcbErrorMsg, UWORD flag) { /* CC: return an error of a hdesc */ - OpenSearch_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); } diff --git a/sql-odbc/src/odfesqlodbc/statement.h b/sql-odbc/src/odfesqlodbc/statement.h index e9022e0e705..64d3fd4e23b 100644 --- a/sql-odbc/src/odfesqlodbc/statement.h +++ b/sql-odbc/src/odfesqlodbc/statement.h @@ -224,7 +224,7 @@ struct StatementClass_ { STMT_Status status; char *__error_message; int __error_number; - OpenSearch_ErrorInfo *eserror; + OpenSearch_ErrorInfo *opensearch_error; SQLLEN currTuple; /* current absolute row number (GetData, * SetPos, SQLFetch) */ From 14b4b4d50a930dd1c5b4e66ac9ae26041d85b900 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 21:16:06 -0700 Subject: [PATCH 23/36] Rename more variables and functions --- sql-odbc/src/odfesqlodbc/bind.c | 2 +- sql-odbc/src/odfesqlodbc/bind.h | 12 ++-- sql-odbc/src/odfesqlodbc/connection.c | 4 +- sql-odbc/src/odfesqlodbc/convert.c | 14 ++--- sql-odbc/src/odfesqlodbc/convert.h | 2 +- sql-odbc/src/odfesqlodbc/environ.c | 8 +-- sql-odbc/src/odfesqlodbc/info.c | 58 +++++++++---------- sql-odbc/src/odfesqlodbc/multibyte.c | 16 ++--- sql-odbc/src/odfesqlodbc/multibyte.h | 4 +- sql-odbc/src/odfesqlodbc/opensearch_api30.c | 4 +- .../src/odfesqlodbc/opensearch_connection.cpp | 4 +- sql-odbc/src/odfesqlodbc/opensearch_info.cpp | 12 ++-- sql-odbc/src/odfesqlodbc/opensearch_types.c | 44 +++++++------- sql-odbc/src/odfesqlodbc/opensearch_types.h | 2 +- sql-odbc/src/odfesqlodbc/qresult.c | 2 +- sql-odbc/src/odfesqlodbc/results.c | 2 +- sql-odbc/src/odfesqlodbc/statement.c | 40 ++++++------- sql-odbc/src/odfesqlodbc/statement.h | 2 +- 18 files changed, 117 insertions(+), 115 deletions(-) diff --git a/sql-odbc/src/odfesqlodbc/bind.c b/sql-odbc/src/odfesqlodbc/bind.c index 1f15b443773..7537d5f24aa 100644 --- a/sql-odbc/src/odfesqlodbc/bind.c +++ b/sql-odbc/src/odfesqlodbc/bind.c @@ -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, diff --git a/sql-odbc/src/odfesqlodbc/bind.h b/sql-odbc/src/odfesqlodbc/bind.h index f8e989975b5..000a6df14ed 100644 --- a/sql-odbc/src/odfesqlodbc/bind.h +++ b/sql-odbc/src/odfesqlodbc/bind.h @@ -85,7 +85,7 @@ struct ParameterImplClass_ { 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/connection.c b/sql-odbc/src/odfesqlodbc/connection.c index 1e4ac7ac4e4..2dc24770a74 100644 --- a/sql-odbc/src/odfesqlodbc/connection.c +++ b/sql-odbc/src/odfesqlodbc/connection.c @@ -495,8 +495,8 @@ CC_cleanup(ConnectionClass *self, BOOL keepCommunication) { 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" diff --git a/sql-odbc/src/odfesqlodbc/convert.c b/sql-odbc/src/odfesqlodbc/convert.c index 84513addf24..bea9a963dc5 100644 --- a/sql-odbc/src/odfesqlodbc/convert.c +++ b/sql-odbc/src/odfesqlodbc/convert.c @@ -78,7 +78,7 @@ 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 */ @@ -837,7 +837,7 @@ static int setup_getdataclass(SQLLEN *const length_return, len = convert_from_esbinary(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); @@ -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; @@ -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 fe5473101a2..63942d3cf2c 100644 --- a/sql-odbc/src/odfesqlodbc/convert.h +++ b/sql-odbc/src/odfesqlodbc/convert.h @@ -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/environ.c b/sql-odbc/src/odfesqlodbc/environ.c index 1acdb90d829..d0834df24fa 100644 --- a/sql-odbc/src/odfesqlodbc/environ.c +++ b/sql-odbc/src/odfesqlodbc/environ.c @@ -81,7 +81,7 @@ 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); @@ -137,7 +137,7 @@ OpenSearch_ErrorInfo *ER_Dup(const OpenSearch_ErrorInfo *self) { #define DRVMNGRDIV 511 /* Returns the next SQL error information. */ -RETCODE SQL_API ER_ReturnError(OpenSearch_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) { @@ -147,9 +147,9 @@ RETCODE SQL_API ER_ReturnError(OpenSearch_ErrorInfo *eserror, SQLSMALLINT RecNum 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(OPENSEARCH_TRACE, "entering status = %d, msg = #%s#\n", error->status, msg); msglen = (SQLSMALLINT)strlen(msg); diff --git a/sql-odbc/src/odfesqlodbc/info.c b/sql-odbc/src/odfesqlodbc/info.c index e1d6be600e2..6c866ba16e1 100644 --- a/sql-odbc/src/odfesqlodbc/info.c +++ b/sql-odbc/src/odfesqlodbc/info.c @@ -917,29 +917,29 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, /* * macros for opensearchtype_xxxx() calls which have OPENSEARCH_ATP_UNSET parameters */ -#define OPENSEARCHTYPE_COLUMN_SIZE(conn, esType) \ - estype_attr_column_size(conn, esType, OPENSEARCH_ATP_UNSET, \ +#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, esType) \ - estype_attr_to_concise_type(conn, esType, OPENSEARCH_ATP_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, esType) \ - estype_attr_to_sqldesctype(conn, esType, OPENSEARCH_ATP_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, esType) \ - estype_attr_buffer_length(conn, esType, OPENSEARCH_ATP_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, esType) \ - estype_attr_decimal_digits(conn, esType, OPENSEARCH_ATP_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, esType) \ - estype_attr_transfer_octet_length(conn, esType, OPENSEARCH_ATP_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, esType, auto_increment) \ - estype_attr_to_name(conn, esType, OPENSEARCH_ATP_UNSET, auto_increment) +#define OPENSEARCHTYPE_TO_NAME(conn, openSearchType, auto_increment) \ + opensearchtype_attr_to_name(conn, openSearchType, OPENSEARCH_ATP_UNSET, auto_increment) RETCODE SQL_API ESAPI_GetFunctions(HDBC hdbc, SQLUSMALLINT fFunction, SQLUSMALLINT *pfExists) { @@ -1242,29 +1242,29 @@ char *identifierEscape(const SQLCHAR *src, SQLLEN srclen, #define TABLE_IN_RELKIND "('r', 'v', 'm', 'f', 'p')" /* - * macros for estype_attr_xxxx() calls which have + * macros for opensearchtype_attr_xxxx() calls which have * OPENSEARCH_ADT_UNSET or OPENSEARCH_UNKNOWNS_UNSET parameters */ -#define OPENSEARCHTYPE_ATTR_COLUMN_SIZE(conn, esType, atttypmod) \ - estype_attr_column_size(conn, esType, atttypmod, OPENSEARCH_ADT_UNSET, \ +#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, esType, atttypmod) \ - estype_attr_to_concise_type(conn, esType, atttypmod, OPENSEARCH_ADT_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, esType, atttypmod) \ - estype_attr_to_sqldesctype(conn, esType, atttypmod, OPENSEARCH_ADT_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, esType, atttypmod) \ - estype_attr_display_size(conn, esType, atttypmod, OPENSEARCH_ADT_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, esType, atttypmod) \ - estype_attr_buffer_length(conn, esType, atttypmod, OPENSEARCH_ADT_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, esType, atttypmod) \ - estype_attr_decimal_digits(conn, esType, atttypmod, OPENSEARCH_ADT_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, esType, atttypmod) \ - estype_attr_transfer_octet_length(conn, esType, atttypmod, \ +#define OPENSEARCHTYPE_ATTR_TRANSFER_OCTET_LENGTH(conn, openSearchType, atttypmod) \ + opensearchtype_attr_transfer_octet_length(conn, openSearchType, atttypmod, \ OPENSEARCH_UNKNOWNS_UNSET) RETCODE SQL_API ESAPI_SpecialColumns( diff --git a/sql-odbc/src/odfesqlodbc/multibyte.c b/sql-odbc/src/odfesqlodbc/multibyte.c index fe871499c07..a8c33ca654a 100644 --- a/sql-odbc/src/odfesqlodbc/multibyte.c +++ b/sql-odbc/src/odfesqlodbc/multibyte.c @@ -87,18 +87,18 @@ static ES_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++) { - if (0 == stricmp(characterset_string, CS_Table[i].name)) { + if (0 == stricmp(stat_string, CS_Table[i].name)) { c = CS_Table[i].code; break; } } if (c < 0) { for (i = 0; CS_Alias[i].code != OTHER; i++) { - if (0 == stricmp(characterset_string, CS_Alias[i].name)) { + if (0 == stricmp(stat_string, CS_Alias[i].name)) { c = CS_Alias[i].code; break; } @@ -109,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; @@ -133,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) { @@ -358,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; } @@ -366,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 4c8b3ea05ea..928fd1812b2 100644 --- a/sql-odbc/src/odfesqlodbc/multibyte.h +++ b/sql-odbc/src/odfesqlodbc/multibyte.h @@ -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/opensearch_api30.c b/sql-odbc/src/odfesqlodbc/opensearch_api30.c index 2e837a08a9d..356c7c33f6d 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_api30.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_api30.c @@ -233,10 +233,10 @@ RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO: ret = SQL_SUCCESS; - if (pcbErrm > 0 && stmt->eserror) + if (pcbErrm > 0 && stmt->openSearchError) *((SQLINTEGER *)DiagInfoPtr) = - (pcbErrm - 1) / stmt->eserror->recsize + 1; + (pcbErrm - 1) / stmt->openSearchError->recsize + 1; break; default: break; diff --git a/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp b/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp index 4bbe67b711a..58e503c92c6 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp @@ -187,8 +187,8 @@ 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); diff --git a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp index 79455bd0d1b..70aafc44fc3 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp @@ -32,7 +32,7 @@ #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 @@ -104,7 +104,7 @@ const std::unordered_map< std::string, int > data_name_data_type_map = { 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 " @@ -112,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."); diff --git a/sql-odbc/src/odfesqlodbc/opensearch_types.c b/sql-odbc/src/odfesqlodbc/opensearch_types.c index bd4e18f1830..553d906b747 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_types.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.c @@ -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) @@ -862,7 +862,7 @@ Int4 opensearchtype_attr_transfer_octet_length(const ConnectionClass *conn, OID /* * 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, SQLSMALLINT fSqlType) { @@ -927,14 +927,14 @@ const char *sqltype_to_escast(const ConnectionClass *conn, } OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType) { - OID esType = 0; + OID openSearchType = 0; switch (fSqlType) { case SQL_BINARY: - esType = OPENSEARCH_TYPE_BYTEA; + openSearchType = OPENSEARCH_TYPE_BYTEA; break; case SQL_CHAR: - esType = OPENSEARCH_TYPE_BPCHAR; + openSearchType = OPENSEARCH_TYPE_BPCHAR; break; #ifdef UNICODE_SUPPORT @@ -944,38 +944,38 @@ OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType) #endif /* UNICODE_SUPPORT */ case SQL_BIT: - esType = OPENSEARCH_TYPE_BOOL; + openSearchType = OPENSEARCH_TYPE_BOOL; break; case SQL_TYPE_DATE: case SQL_DATE: - esType = OPENSEARCH_TYPE_DATE; + openSearchType = OPENSEARCH_TYPE_DATE; break; case SQL_DOUBLE: case SQL_FLOAT: - esType = OPENSEARCH_TYPE_FLOAT8; + openSearchType = OPENSEARCH_TYPE_FLOAT8; break; case SQL_DECIMAL: case SQL_NUMERIC: - esType = OPENSEARCH_TYPE_NUMERIC; + openSearchType = OPENSEARCH_TYPE_NUMERIC; break; case SQL_BIGINT: - esType = OPENSEARCH_TYPE_INT8; + openSearchType = OPENSEARCH_TYPE_INT8; break; case SQL_INTEGER: - esType = OPENSEARCH_TYPE_INT4; + openSearchType = OPENSEARCH_TYPE_INT4; break; case SQL_LONGVARBINARY: - esType = conn->lobj_type; + openSearchType = conn->lobj_type; break; case SQL_LONGVARCHAR: - esType = OPENSEARCH_TYPE_VARCHAR; + openSearchType = OPENSEARCH_TYPE_VARCHAR; break; #ifdef UNICODE_SUPPORT @@ -985,30 +985,30 @@ OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType) #endif /* UNICODE_SUPPORT */ case SQL_REAL: - esType = OPENSEARCH_TYPE_FLOAT4; + openSearchType = OPENSEARCH_TYPE_FLOAT4; break; case SQL_SMALLINT: case SQL_TINYINT: - esType = OPENSEARCH_TYPE_INT2; + openSearchType = OPENSEARCH_TYPE_INT2; break; case SQL_TIME: case SQL_TYPE_TIME: - esType = OPENSEARCH_TYPE_TIME; + openSearchType = OPENSEARCH_TYPE_TIME; break; case SQL_TIMESTAMP: case SQL_TYPE_TIMESTAMP: - esType = OPENSEARCH_TYPE_DATETIME; + openSearchType = OPENSEARCH_TYPE_DATETIME; break; case SQL_VARBINARY: - esType = OPENSEARCH_TYPE_BYTEA; + openSearchType = OPENSEARCH_TYPE_BYTEA; break; case SQL_VARCHAR: - esType = OPENSEARCH_TYPE_VARCHAR; + openSearchType = OPENSEARCH_TYPE_VARCHAR; break; #ifdef UNICODE_SUPPORT @@ -1019,7 +1019,7 @@ OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType) case SQL_GUID: if (OPENSEARCH_VERSION_GE(conn, 8.3)) - esType = OPENSEARCH_TYPE_UUID; + openSearchType = OPENSEARCH_TYPE_UUID; break; case SQL_INTERVAL_MONTH: @@ -1035,11 +1035,11 @@ OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType) case SQL_INTERVAL_HOUR_TO_MINUTE: case SQL_INTERVAL_HOUR_TO_SECOND: case SQL_INTERVAL_MINUTE_TO_SECOND: - esType = OPENSEARCH_TYPE_INTERVAL; + openSearchType = OPENSEARCH_TYPE_INTERVAL; break; } - return esType; + return openSearchType; } static int getAtttypmodEtc(const StatementClass *stmt, int col, diff --git a/sql-odbc/src/odfesqlodbc/opensearch_types.h b/sql-odbc/src/odfesqlodbc/opensearch_types.h index 375e55fd2f9..93367c14d75 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_types.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.h @@ -118,7 +118,7 @@ extern SQLSMALLINT sqlTypes[]; #define OPENSEARCH_INTERVAL_AS_SQL_INTERVAL */ -OID es_true_type(const ConnectionClass *, OID, OID); +OID opensearch_true_type(const ConnectionClass *, OID, OID); OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType); const char *sqltype_to_escast(const ConnectionClass *conn, SQLSMALLINT fSqlType); diff --git a/sql-odbc/src/odfesqlodbc/qresult.c b/sql-odbc/src/odfesqlodbc/qresult.c index 25bc1ebe165..a26b7404633 100644 --- a/sql-odbc/src/odfesqlodbc/qresult.c +++ b/sql-odbc/src/odfesqlodbc/qresult.c @@ -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; diff --git a/sql-odbc/src/odfesqlodbc/results.c b/sql-odbc/src/odfesqlodbc/results.c index 413879418bf..214995a413b 100644 --- a/sql-odbc/src/odfesqlodbc/results.c +++ b/sql-odbc/src/odfesqlodbc/results.c @@ -33,7 +33,7 @@ /* 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) { diff --git a/sql-odbc/src/odfesqlodbc/statement.c b/sql-odbc/src/odfesqlodbc/statement.c index 5d3b6513b6c..89df56ed548 100644 --- a/sql-odbc/src/odfesqlodbc/statement.c +++ b/sql-odbc/src/odfesqlodbc/statement.c @@ -788,7 +788,7 @@ static const struct { {STMT_NO_RESPONSE, "08S01", "08S01"}, {STMT_COMMUNICATION_ERROR, "08S01", "08S01"}}; -static OpenSearch_ErrorInfo *SC_create_errorinfo(const StatementClass *self, OpenSearch_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; @@ -797,7 +797,7 @@ static OpenSearch_ErrorInfo *SC_create_errorinfo(const StatementClass *self, Ope BOOL looponce, loopend; char msg[4096], *wmsg; char *ermsg = NULL, *sqlstate = NULL; - OpenSearch_ErrorInfo *eserror; + OpenSearch_ErrorInfo *opensearch_error; if (self->opensearch_error) return self->opensearch_error; @@ -860,23 +860,23 @@ static OpenSearch_ErrorInfo *SC_create_errorinfo(const StatementClass *self, Ope 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); @@ -887,14 +887,14 @@ static OpenSearch_ErrorInfo *SC_create_errorinfo(const StatementClass *self, Ope / 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) { @@ -971,7 +971,7 @@ void SC_error_copy(StatementClass *self, const StatementClass *from, void SC_full_error_copy(StatementClass *self, const StatementClass *from, BOOL allres) { - OpenSearch_ErrorInfo *eserror; + OpenSearch_ErrorInfo *opensearch_error; MYLOG(OPENSEARCH_TRACE, "entering %p->%p\n", from, self); if (!from) @@ -992,14 +992,14 @@ void SC_full_error_copy(StatementClass *self, const StatementClass *from, 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->opensearch_error) ER_Destructor(self->opensearch_error); - self->opensearch_error = eserror; + self->opensearch_error = opensearch_error; } /* Returns the next SQL error information. */ diff --git a/sql-odbc/src/odfesqlodbc/statement.h b/sql-odbc/src/odfesqlodbc/statement.h index 64d3fd4e23b..b14c641d51b 100644 --- a/sql-odbc/src/odfesqlodbc/statement.h +++ b/sql-odbc/src/odfesqlodbc/statement.h @@ -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 { From c6fff521be8c2717f7a74b15f7038d0d4c405164 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 21:22:41 -0700 Subject: [PATCH 24/36] Rename more variables and functions --- sql-odbc/src/odfesqlodbc/convert.c | 12 ++++---- sql-odbc/src/odfesqlodbc/multibyte.c | 8 +++--- sql-odbc/src/odfesqlodbc/opensearch_info.cpp | 9 +++--- .../odfesqlodbc/opensearch_parse_result.cpp | 6 ++-- sql-odbc/src/odfesqlodbc/opensearch_types.c | 28 +++++++++---------- sql-odbc/src/odfesqlodbc/opensearch_types.h | 2 +- sql-odbc/src/odfesqlodbc/statement.c | 18 ++++++------ sql-odbc/src/odfesqlodbc/tuple.h | 4 +-- 8 files changed, 45 insertions(+), 42 deletions(-) diff --git a/sql-odbc/src/odfesqlodbc/convert.c b/sql-odbc/src/odfesqlodbc/convert.c index bea9a963dc5..c55ba89276d 100644 --- a/sql-odbc/src/odfesqlodbc/convert.c +++ b/sql-odbc/src/odfesqlodbc/convert.c @@ -72,7 +72,7 @@ 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, @@ -712,7 +712,7 @@ 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) { @@ -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; @@ -834,8 +834,8 @@ 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 = opensearch_bin2hex(esdc->ttlbuf, esdc->ttlbuf, len); } else @@ -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); diff --git a/sql-odbc/src/odfesqlodbc/multibyte.c b/sql-odbc/src/odfesqlodbc/multibyte.c index a8c33ca654a..4b6e902e40e 100644 --- a/sql-odbc/src/odfesqlodbc/multibyte.c +++ b/sql-odbc/src/odfesqlodbc/multibyte.c @@ -31,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}, @@ -83,7 +83,7 @@ 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}}; diff --git a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp index 70aafc44fc3..83fca4d95dd 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp @@ -71,7 +71,7 @@ #define MAXIMUM_SCALE "MAXIMUM_SCALE" #define INTERVAL_PRECISION "INTERVAL_PRECISION" -const std::unordered_map< int, std::vector< int > > sql_es_type_map = { +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}}, @@ -1026,15 +1026,16 @@ 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) { + sql_opensearch_type_map) { for (auto const &openSearchType : sqlType.second) { result = SetTypeResult(conn, stmt, res, openSearchType, sqlType.first); } } } else { - if (sql_es_type_map.count(fSqlType) > 0) { - for (auto openSearchType : sql_es_type_map.at(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/opensearch_parse_result.cpp b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp index baabbfb467e..874bde96d2a 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_parse_result.cpp @@ -88,7 +88,7 @@ const std::unordered_map< std::string, OID > type_to_oid_map = { {OPENSEARCH_TYPE_NAME_VARCHAR, OPENSEARCH_TYPE_VARCHAR}, {OPENSEARCH_TYPE_NAME_DATE, OPENSEARCH_TYPE_DATE}}; -#define ES_VARCHAR_SIZE (-2) +#define OPENSEARCH_VARCHAR_SIZE (-2) const std::unordered_map< OID, int16_t > oid_to_size_map = { {OPENSEARCH_TYPE_BOOL, (int16_t)1}, {OPENSEARCH_TYPE_INT2, (int16_t)2}, @@ -96,8 +96,8 @@ const std::unordered_map< OID, int16_t > oid_to_size_map = { {OPENSEARCH_TYPE_INT8, (int16_t)8}, {OPENSEARCH_TYPE_FLOAT4, (int16_t)4}, {OPENSEARCH_TYPE_FLOAT8, (int16_t)8}, - {OPENSEARCH_TYPE_VARCHAR, (int16_t)ES_VARCHAR_SIZE}, - {OPENSEARCH_TYPE_DATE, (int16_t)ES_VARCHAR_SIZE}, + {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 diff --git a/sql-odbc/src/odfesqlodbc/opensearch_types.c b/sql-odbc/src/odfesqlodbc/opensearch_types.c index 553d906b747..d431dbe4081 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_types.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.c @@ -864,47 +864,47 @@ Int4 opensearchtype_attr_transfer_octet_length(const ConnectionClass *conn, OID * than specifying parameter datatype oids determined by * 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 (OPENSEARCH_VERSION_GE(conn, 8.3)) - esCast = "::uuid"; + openSearchCast = "::uuid"; break; case SQL_INTERVAL_MONTH: case SQL_INTERVAL_YEAR: @@ -919,11 +919,11 @@ 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_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType) { diff --git a/sql-odbc/src/odfesqlodbc/opensearch_types.h b/sql-odbc/src/odfesqlodbc/opensearch_types.h index 93367c14d75..3dd52c863a7 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_types.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_types.h @@ -120,7 +120,7 @@ extern SQLSMALLINT sqlTypes[]; OID opensearch_true_type(const ConnectionClass *, OID, OID); OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType); -const char *sqltype_to_escast(const ConnectionClass *conn, +const char *sqltype_to_opensearchcast(const ConnectionClass *conn, SQLSMALLINT fSqlType); SQLSMALLINT opensearchtype_to_concise_type(const StatementClass *stmt, OID type, diff --git a/sql-odbc/src/odfesqlodbc/statement.c b/sql-odbc/src/odfesqlodbc/statement.c index 89df56ed548..6447a4047cc 100644 --- a/sql-odbc/src/odfesqlodbc/statement.c +++ b/sql-odbc/src/odfesqlodbc/statement.c @@ -1447,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(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,7 +1473,9 @@ int SC_Create_bookmark(StatementClass *self, BindInfoClass *bookmark, *used = cvtlen; } MYLOG(OPENSEARCH_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); + cvtlen, + opensearch_bm.index, opensearch_bm.keys.blocknum, + opensearch_bm.keys.offset); return COPY_OK; } diff --git a/sql-odbc/src/odfesqlodbc/tuple.h b/sql-odbc/src/odfesqlodbc/tuple.h index b0923e9e904..749fc8313af 100644 --- a/sql-odbc/src/odfesqlodbc/tuple.h +++ b/sql-odbc/src/odfesqlodbc/tuple.h @@ -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 } From aafd199a4a547174f59164a41dfd6d2638e746f6 Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 21:30:20 -0700 Subject: [PATCH 25/36] Fix error and rename ESAPI_ --- sql-odbc/src/odfesqlodbc/bind.c | 8 +- sql-odbc/src/odfesqlodbc/connection.c | 20 +-- sql-odbc/src/odfesqlodbc/convert.c | 4 +- sql-odbc/src/odfesqlodbc/descriptor.c | 10 +- sql-odbc/src/odfesqlodbc/environ.c | 12 +- sql-odbc/src/odfesqlodbc/execute.c | 10 +- sql-odbc/src/odfesqlodbc/info.c | 56 ++++----- sql-odbc/src/odfesqlodbc/odbcapi.c | 104 ++++++++-------- sql-odbc/src/odfesqlodbc/odbcapi30.c | 42 +++---- sql-odbc/src/odfesqlodbc/odbcapi30w.c | 24 ++-- sql-odbc/src/odfesqlodbc/odbcapiw.c | 56 ++++----- sql-odbc/src/odfesqlodbc/opensearch_api30.c | 70 +++++------ sql-odbc/src/odfesqlodbc/opensearch_apifunc.h | 114 +++++++++--------- .../odfesqlodbc/opensearch_driver_connect.cpp | 6 +- .../odfesqlodbc/opensearch_driver_connect.h | 2 +- sql-odbc/src/odfesqlodbc/opensearch_info.cpp | 26 ++-- sql-odbc/src/odfesqlodbc/opensearch_info.h | 6 +- .../src/odfesqlodbc/opensearch_statement.cpp | 2 +- .../src/odfesqlodbc/opensearch_statement.h | 2 +- sql-odbc/src/odfesqlodbc/options.c | 16 +-- sql-odbc/src/odfesqlodbc/results.c | 50 ++++---- sql-odbc/src/odfesqlodbc/statement.c | 18 +-- sql-odbc/src/odfesqlodbc/statement.h | 2 +- 23 files changed, 330 insertions(+), 330 deletions(-) diff --git a/sql-odbc/src/odfesqlodbc/bind.c b/sql-odbc/src/odfesqlodbc/bind.c index 7537d5f24aa..60d180141ea 100644 --- a/sql-odbc/src/odfesqlodbc/bind.c +++ b/sql-odbc/src/odfesqlodbc/bind.c @@ -29,11 +29,11 @@ #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; @@ -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; diff --git a/sql-odbc/src/odfesqlodbc/connection.c b/sql-odbc/src/odfesqlodbc/connection.c index 2dc24770a74..3544dac3236 100644 --- a/sql-odbc/src/odfesqlodbc/connection.c +++ b/sql-odbc/src/odfesqlodbc/connection.c @@ -55,10 +55,10 @@ #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(OPENSEARCH_TRACE, "entering...\n"); @@ -88,13 +88,13 @@ 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; @@ -148,14 +148,14 @@ RETCODE SQL_API ESAPI_Connect(HDBC hdbc, const SQLCHAR *szDSN, 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(OPENSEARCH_TRACE, "entering...\n"); @@ -166,9 +166,9 @@ 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(OPENSEARCH_TRACE, "entering...\n"); @@ -199,9 +199,9 @@ RETCODE SQL_API ESAPI_Disconnect(HDBC hdbc) { 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(OPENSEARCH_TRACE, "entering...hdbc=%p\n", hdbc); diff --git a/sql-odbc/src/odfesqlodbc/convert.c b/sql-odbc/src/odfesqlodbc/convert.c index c55ba89276d..5aaa6540cf4 100644 --- a/sql-odbc/src/odfesqlodbc/convert.c +++ b/sql-odbc/src/odfesqlodbc/convert.c @@ -736,7 +736,7 @@ 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(OPENSEARCH_DEBUG, "hybrid estimate\n"); if ((unicode_count = @@ -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 { diff --git a/sql-odbc/src/odfesqlodbc/descriptor.c b/sql-odbc/src/odfesqlodbc/descriptor.c index c7fd19d4a58..3266daef730 100644 --- a/sql-odbc/src/odfesqlodbc/descriptor.c +++ b/sql-odbc/src/odfesqlodbc/descriptor.c @@ -257,9 +257,9 @@ 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; @@ -286,7 +286,7 @@ 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; @@ -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; @@ -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) { diff --git a/sql-odbc/src/odfesqlodbc/environ.c b/sql-odbc/src/odfesqlodbc/environ.c index d0834df24fa..9bcdb5dc285 100644 --- a/sql-odbc/src/odfesqlodbc/environ.c +++ b/sql-odbc/src/odfesqlodbc/environ.c @@ -37,8 +37,8 @@ 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(OPENSEARCH_TRACE, "entering\n"); @@ -61,8 +61,8 @@ RETCODE SQL_API ESAPI_AllocEnv(HENV *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; @@ -211,7 +211,7 @@ RETCODE SQL_API ER_ReturnError(OpenSearch_ErrorInfo *openSearchError, SQLSMALLIN 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, @@ -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) { diff --git a/sql-odbc/src/odfesqlodbc/execute.c b/sql-odbc/src/odfesqlodbc/execute.c index 29a77762409..3ccbeb11903 100644 --- a/sql-odbc/src/odfesqlodbc/execute.c +++ b/sql-odbc/src/odfesqlodbc/execute.c @@ -34,7 +34,7 @@ #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,10 +109,10 @@ 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; diff --git a/sql-odbc/src/odfesqlodbc/info.c b/sql-odbc/src/odfesqlodbc/info.c index 6c866ba16e1..2e0e73e2b9b 100644 --- a/sql-odbc/src/odfesqlodbc/info.c +++ b/sql-odbc/src/odfesqlodbc/info.c @@ -44,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; @@ -858,7 +858,7 @@ 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; } @@ -941,7 +941,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, #define OPENSEARCHTYPE_TO_NAME(conn, openSearchType, auto_increment) \ opensearchtype_attr_to_name(conn, openSearchType, OPENSEARCH_ATP_UNSET, auto_increment) -RETCODE SQL_API ESAPI_GetFunctions(HDBC hdbc, SQLUSMALLINT fFunction, +RETCODE SQL_API OPENSEARCHAPI_GetFunctions(HDBC hdbc, SQLUSMALLINT fFunction, SQLUSMALLINT *pfExists) { UNUSED(hdbc); MYLOG(OPENSEARCH_TRACE, "entering...%u\n", fFunction); @@ -1267,14 +1267,14 @@ char *identifierEscape(const SQLCHAR *src, SQLLEN srclen, opensearchtype_attr_transfer_octet_length(conn, openSearchType, atttypmod, \ OPENSEARCH_UNKNOWNS_UNSET) -RETCODE SQL_API ESAPI_SpecialColumns( +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; } @@ -1335,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; @@ -1354,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; } @@ -1413,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*/ @@ -1421,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; @@ -1434,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; } @@ -1491,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*/ @@ -1500,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; @@ -1512,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; } @@ -1558,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*/ @@ -1570,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; @@ -1582,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; } @@ -1649,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*/ @@ -1657,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; @@ -1670,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; } @@ -1743,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*/ @@ -1752,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; @@ -1764,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; } @@ -1816,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*/ @@ -1825,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; @@ -1837,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; } diff --git a/sql-odbc/src/odfesqlodbc/odbcapi.c b/sql-odbc/src/odfesqlodbc/odbcapi.c index f9a5f2d82ae..6fee9775117 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi.c @@ -50,7 +50,7 @@ RETCODE SQL_API SQLBindCol(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, 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; @@ -63,7 +63,7 @@ RETCODE SQL_API SQLCancel(HSTMT StatementHandle) { 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) { @@ -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) @@ -157,7 +157,7 @@ RETCODE SQL_API SQLConnect(HDBC ConnectionHandle, SQLCHAR *ServerName, 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; @@ -175,7 +175,7 @@ RETCODE SQL_API SQLDriverConnect(HDBC hdbc, HWND hwnd, SQLCHAR *szConnStrIn, 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; @@ -190,7 +190,7 @@ RETCODE SQL_API SQLBrowseConnect(HDBC hdbc, SQLCHAR *szConnStrIn, 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; @@ -221,7 +221,7 @@ RETCODE SQL_API SQLDescribeCol(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, 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); @@ -240,7 +240,7 @@ RETCODE SQL_API SQLDisconnect(HDBC ConnectionHandle) { #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); @@ -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); @@ -310,7 +310,7 @@ RETCODE SQL_API SQLFetch(HSTMT StatementHandle) { 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; @@ -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) { @@ -357,7 +357,7 @@ RETCODE SQL_API SQLGetCursorName(HSTMT StatementHandle, SQLCHAR *CursorName, 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; @@ -376,7 +376,7 @@ RETCODE SQL_API SQLGetData(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, 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; @@ -391,9 +391,9 @@ RETCODE SQL_API SQLGetFunctions(HDBC ConnectionHandle, SQLUSMALLINT FunctionId, 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; @@ -409,7 +409,7 @@ RETCODE SQL_API SQLGetInfo(HDBC ConnectionHandle, SQLUSMALLINT InfoType, ENTER_CONN_CS(conn); CC_clear_error(conn); MYLOG(OPENSEARCH_TRACE, "entering\n"); - if ((ret = ESAPI_GetInfo(ConnectionHandle, InfoType, InfoValue, + if ((ret = OPENSEARCHAPI_GetInfo(ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength)) == SQL_ERROR) CC_log_error("SQLGetInfo(30)", "", conn); @@ -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; } @@ -449,7 +449,7 @@ RETCODE SQL_API SQLNumResultCols(HSTMT StatementHandle, ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_NumResultCols(StatementHandle, ColumnCount); + ret = OPENSEARCHAPI_NumResultCols(StatementHandle, ColumnCount); LEAVE_STMT_CS(stmt); return ret; } @@ -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); @@ -517,7 +517,7 @@ RETCODE SQL_API SQLRowCount(HSTMT StatementHandle, SQLLEN *RowCount) { ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_RowCount(StatementHandle, RowCount); + ret = OPENSEARCHAPI_RowCount(StatementHandle, RowCount); LEAVE_STMT_CS(stmt); return ret; } @@ -531,7 +531,7 @@ RETCODE SQL_API SQLSetCursorName(HSTMT StatementHandle, SQLCHAR *CursorName, 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; } @@ -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) @@ -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) @@ -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) @@ -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) @@ -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; @@ -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); @@ -967,7 +967,7 @@ RETCODE SQL_API SQLMoreResults(HSTMT hstmt) { ENTER_STMT_CS(stmt); SC_clear_error(stmt); - ret = ESAPI_MoreResults(hstmt); + ret = OPENSEARCHAPI_MoreResults(hstmt); LEAVE_STMT_CS(stmt); return ret; } @@ -982,7 +982,7 @@ RETCODE SQL_API SQLNativeSql(HDBC hdbc, SQLCHAR *szSqlStrIn, 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; @@ -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); @@ -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) @@ -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); @@ -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); @@ -1302,7 +1302,7 @@ RETCODE SQL_API SQLAllocStmt(SQLHDBC InputHandle, SQLHSTMT *OutputHandle) { conn = (ConnectionClass *)InputHandle; ENTER_CONN_CS(conn); - ret = ESAPI_AllocStmt( + ret = OPENSEARCHAPI_AllocStmt( InputHandle, OutputHandle, PODBC_EXTERNAL_STATEMENT | PODBC_INHERIT_CONNECT_OPTIONS); if (*OutputHandle) @@ -1320,7 +1320,7 @@ RETCODE SQL_API SQLGetConnectOption(HDBC ConnectionHandle, SQLUSMALLINT 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; } @@ -1334,7 +1334,7 @@ RETCODE SQL_API SQLSetConnectOption(HDBC ConnectionHandle, SQLUSMALLINT 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; } @@ -1361,7 +1361,7 @@ SQLRETURN SQL_API SQLColAttributes(SQLHSTMT StatementHandle, 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); @@ -1380,14 +1380,14 @@ RETCODE SQL_API SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, 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; diff --git a/sql-odbc/src/odfesqlodbc/odbcapi30.c b/sql-odbc/src/odfesqlodbc/odbcapi30.c index eee7d0abb16..ff020dd84ef 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi30.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi30.c @@ -33,17 +33,17 @@ RETCODE SQL_API SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, 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,7 +53,7 @@ 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(OPENSEARCH_DEBUG, "OutputHandle=%p\n", *OutputHandle); break; @@ -96,7 +96,7 @@ RETCODE SQL_API SQLCloseCursor(HSTMT StatementHandle) { 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; } @@ -124,7 +124,7 @@ SQLRETURN SQL_API SQLColAttribute(SQLHSTMT StatementHandle, 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); @@ -138,7 +138,7 @@ RETCODE SQL_API SQLCopyDesc(SQLHDESC SourceDescHandle, RETCODE ret; MYLOG(OPENSEARCH_TRACE, "entering\n"); - ret = ESAPI_CopyDesc(SourceDescHandle, TargetDescHandle); + ret = OPENSEARCHAPI_CopyDesc(SourceDescHandle, TargetDescHandle); return ret; } @@ -199,7 +199,7 @@ 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; @@ -220,10 +220,10 @@ RETCODE SQL_API SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) { 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; @@ -260,7 +260,7 @@ RETCODE SQL_API SQLGetDescField(SQLHDESC DescriptorHandle, RETCODE ret; MYLOG(OPENSEARCH_TRACE, "entering\n"); - ret = ESAPI_GetDescField(DescriptorHandle, RecNumber, FieldIdentifier, + ret = OPENSEARCHAPI_GetDescField(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength); return ret; } @@ -290,7 +290,7 @@ RETCODE SQL_API SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, 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; } @@ -304,7 +304,7 @@ RETCODE SQL_API SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, RETCODE ret; MYLOG(OPENSEARCH_TRACE, "entering\n"); - ret = ESAPI_GetDiagRec(HandleType, Handle, RecNumber, Sqlstate, NativeError, + ret = OPENSEARCHAPI_GetDiagRec(HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength); return ret; } @@ -354,7 +354,7 @@ RETCODE SQL_API SQLGetConnectAttr(HDBC ConnectionHandle, SQLINTEGER 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; @@ -371,7 +371,7 @@ RETCODE SQL_API SQLGetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, 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; @@ -387,7 +387,7 @@ RETCODE SQL_API SQLSetConnectAttr(HDBC ConnectionHandle, SQLINTEGER 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; } @@ -401,7 +401,7 @@ RETCODE SQL_API SQLSetDescField(SQLHDESC 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; } @@ -485,7 +485,7 @@ RETCODE SQL_API SQLSetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, 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 e9cb4e19368..c4a8920ea51 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapi30w.c +++ b/sql-odbc/src/odfesqlodbc/odbcapi30w.c @@ -33,7 +33,7 @@ RETCODE SQL_API SQLGetStmtAttrW(SQLHSTMT hstmt, SQLINTEGER fAttribute, 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; } @@ -46,7 +46,7 @@ RETCODE SQL_API SQLSetStmtAttrW(SQLHSTMT hstmt, SQLINTEGER fAttribute, 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; } @@ -60,7 +60,7 @@ RETCODE SQL_API SQLGetConnectAttrW(HDBC hdbc, SQLINTEGER fAttribute, 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; } @@ -74,7 +74,7 @@ RETCODE SQL_API SQLSetConnectAttrW(HDBC hdbc, SQLINTEGER fAttribute, 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; } @@ -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); @@ -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; } @@ -200,7 +200,7 @@ RETCODE SQL_API SQLGetDiagRecW(SQLSMALLINT fHandleType, SQLHANDLE handle, 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) @@ -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; } @@ -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; } diff --git a/sql-odbc/src/odfesqlodbc/odbcapiw.c b/sql-odbc/src/odfesqlodbc/odbcapiw.c index 5163b10f52b..20272c80546 100644 --- a/sql-odbc/src/odfesqlodbc/odbcapiw.c +++ b/sql-odbc/src/odfesqlodbc/odbcapiw.c @@ -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, @@ -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); @@ -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; @@ -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, @@ -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 @@ -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; @@ -369,7 +369,7 @@ RETCODE SQL_API SQLGetInfoW(HDBC ConnectionHandle, SQLUSMALLINT InfoType, CC_set_in_unicode_driver(conn); CC_clear_error(conn); MYLOG(OPENSEARCH_TRACE, "entering\n"); - if ((ret = ESAPI_GetInfo(ConnectionHandle, InfoType, InfoValue, + if ((ret = OPENSEARCHAPI_GetInfo(ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength)) == SQL_ERROR) CC_log_error("SQLGetInfoW", "", conn); @@ -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 @@ -424,7 +424,7 @@ RETCODE SQL_API SQLSetCursorNameW(HSTMT StatementHandle, SQLWCHAR *CursorName, 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) @@ -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); @@ -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); @@ -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); @@ -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); @@ -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, @@ -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; @@ -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); @@ -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); @@ -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); @@ -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); @@ -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; } @@ -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; } @@ -989,7 +989,7 @@ RETCODE SQL_API SQLGetConnectOptionW(HDBC ConnectionHandle, SQLUSMALLINT Option, ENTER_CONN_CS(conn); CC_clear_error(conn); MYLOG(OPENSEARCH_TRACE, "entering " FORMAT_UINTEGER "\n", Option); - ret = ESAPI_GetConnectOption(ConnectionHandle, Option, Value, NULL, 0); + ret = OPENSEARCHAPI_GetConnectOption(ConnectionHandle, Option, Value, NULL, 0); LEAVE_CONN_CS(conn); return ret; } @@ -1002,7 +1002,7 @@ RETCODE SQL_API SQLSetConnectOptionW(HDBC ConnectionHandle, SQLUSMALLINT 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; } @@ -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/opensearch_api30.c b/sql-odbc/src/odfesqlodbc/opensearch_api30.c index 356c7c33f6d..a601dc02703 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_api30.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_api30.c @@ -29,7 +29,7 @@ #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, @@ -39,19 +39,19 @@ RETCODE SQL_API ESAPI_GetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, 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: @@ -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, @@ -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,7 +227,7 @@ 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: @@ -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; @@ -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; @@ -356,7 +356,7 @@ RETCODE SQL_API ESAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, } /* SQLGetConnectOption -> SQLGetconnectAttr */ -RETCODE SQL_API ESAPI_GetConnectAttr(HDBC ConnectionHandle, +RETCODE SQL_API OPENSEARCHAPI_GetConnectAttr(HDBC ConnectionHandle, SQLINTEGER Attribute, PTR Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength) { @@ -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) @@ -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; } @@ -1455,10 +1455,10 @@ 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; @@ -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,11 +1558,11 @@ 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; @@ -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,12 +1645,12 @@ 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; @@ -1704,11 +1704,11 @@ 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; @@ -1764,11 +1764,11 @@ 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(OPENSEARCH_TRACE, @@ -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/opensearch_apifunc.h b/sql-odbc/src/odfesqlodbc/opensearch_apifunc.h index 55237c063da..f5219ad99f5 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_apifunc.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_apifunc.h @@ -32,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); @@ -213,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, diff --git a/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp index bb5925172cf..ee127c400fe 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.cpp @@ -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) { diff --git a/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.h b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.h index f938aebe695..4296b29d2b8 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_driver_connect.h @@ -22,7 +22,7 @@ #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, diff --git a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp index 83fca4d95dd..ecab2bc9619 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_info.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_info.cpp @@ -136,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 = @@ -381,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 + "'."; @@ -524,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(), @@ -554,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"); @@ -574,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 :" @@ -729,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; @@ -814,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, @@ -823,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 @@ -995,8 +995,8 @@ RETCODE SetTypeResult(ConnectionClass *conn, StatementClass *stmt, 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); diff --git a/sql-odbc/src/odfesqlodbc/opensearch_info.h b/sql-odbc/src/odfesqlodbc/opensearch_info.h index 59f77a59853..999dc035dc4 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_info.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_info.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,14 +50,14 @@ 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 diff --git a/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp index a5f483be758..ef3eb59d21e 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_statement.cpp @@ -315,7 +315,7 @@ void ClearOpenSearchResult(void *opensearch_result) { } } -SQLRETURN ESAPI_Cancel(HSTMT hstmt) { +SQLRETURN OPENSEARCHAPI_Cancel(HSTMT hstmt) { // Verify pointer validity and convert to StatementClass if (hstmt == NULL) return SQL_INVALID_HANDLE; diff --git a/sql-odbc/src/odfesqlodbc/opensearch_statement.h b/sql-odbc/src/odfesqlodbc/opensearch_statement.h index d55034240f3..c76d3a45e90 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_statement.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_statement.h @@ -29,7 +29,7 @@ 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 ClearOpenSearchResult(void *opensearch_result); #ifdef __cplusplus diff --git a/sql-odbc/src/odfesqlodbc/options.c b/sql-odbc/src/odfesqlodbc/options.c index 03dd7ed33b8..aaf53f58123 100644 --- a/sql-odbc/src/odfesqlodbc/options.c +++ b/sql-odbc/src/odfesqlodbc/options.c @@ -276,9 +276,9 @@ 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; @@ -437,10 +437,10 @@ 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); @@ -559,9 +559,9 @@ 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; @@ -581,11 +581,11 @@ 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; diff --git a/sql-odbc/src/odfesqlodbc/results.c b/sql-odbc/src/odfesqlodbc/results.c index 214995a413b..2b22767bf76 100644 --- a/sql-odbc/src/odfesqlodbc/results.c +++ b/sql-odbc/src/odfesqlodbc/results.c @@ -36,8 +36,8 @@ 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; @@ -69,8 +69,8 @@ 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; @@ -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; @@ -327,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; @@ -773,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; @@ -1022,8 +1022,8 @@ 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; @@ -1042,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; } @@ -1051,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; } @@ -1230,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; @@ -1272,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; } @@ -1364,7 +1364,7 @@ RETCODE SQL_API ESAPI_ExtendedFetch(HSTMT hstmt, SQLUSMALLINT fFetchType, break; default: SC_set_error(stmt, STMT_FETCH_OUT_OF_RANGE, - "Unsupported ESAPI_ExtendedFetch Direction", func); + "Unsupported OPENSEARCHAPI_ExtendedFetch Direction", func); return SQL_ERROR; } @@ -1564,7 +1564,7 @@ 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; @@ -1579,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; @@ -1594,7 +1594,7 @@ 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(OPENSEARCH_DEBUG, "leaving %d\n", ret); @@ -1618,9 +1618,9 @@ 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(OPENSEARCH_TRACE, "entering hstmt=%p, szCursor=%p, cbCursorMax=%d\n", hstmt, @@ -1637,10 +1637,10 @@ 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; diff --git a/sql-odbc/src/odfesqlodbc/statement.c b/sql-odbc/src/odfesqlodbc/statement.c index 6447a4047cc..b84befab849 100644 --- a/sql-odbc/src/odfesqlodbc/statement.c +++ b/sql-odbc/src/odfesqlodbc/statement.c @@ -94,8 +94,8 @@ 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; @@ -148,8 +148,8 @@ 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(OPENSEARCH_TRACE, "entering...hstmt=%p, fOption=%hi\n", hstmt, fOption); @@ -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) @@ -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; } @@ -903,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, @@ -1003,7 +1003,7 @@ void SC_full_error_copy(StatementClass *self, const StatementClass *from, } /* 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) { diff --git a/sql-odbc/src/odfesqlodbc/statement.h b/sql-odbc/src/odfesqlodbc/statement.h index b14c641d51b..b80254da3f8 100644 --- a/sql-odbc/src/odfesqlodbc/statement.h +++ b/sql-odbc/src/odfesqlodbc/statement.h @@ -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; From 3a0b07dfac72553321cff7357337533d4bc59f4e Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 21:37:24 -0700 Subject: [PATCH 26/36] Fix error --- sql-odbc/src/odfesqlodbc/environ.c | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sql-odbc/src/odfesqlodbc/environ.c b/sql-odbc/src/odfesqlodbc/environ.c index 9bcdb5dc285..c9a2a8b1149 100644 --- a/sql-odbc/src/odfesqlodbc/environ.c +++ b/sql-odbc/src/odfesqlodbc/environ.c @@ -263,64 +263,64 @@ RETCODE SQL_API OPENSEARCHAPI_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; } @@ -355,7 +355,7 @@ RETCODE SQL_API OPENSEARCHAPI_EnvError(HENV henv, SQLSMALLINT RecNumber, 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)) @@ -376,10 +376,10 @@ RETCODE SQL_API OPENSEARCHAPI_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; } From 76eb56adb0a1df8681321c338506a070139fa9da Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 22:03:09 -0700 Subject: [PATCH 27/36] Fix error --- sql-odbc/src/odfesqlodbc/multibyte.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql-odbc/src/odfesqlodbc/multibyte.c b/sql-odbc/src/odfesqlodbc/multibyte.c index 4b6e902e40e..94620fba6ba 100644 --- a/sql-odbc/src/odfesqlodbc/multibyte.c +++ b/sql-odbc/src/odfesqlodbc/multibyte.c @@ -91,14 +91,14 @@ int opensearch_CS_code(const char *characterset_string) { int i, c = -1; for (i = 0; CS_Table[i].code != OTHER; i++) { - if (0 == stricmp(stat_string, CS_Table[i].name)) { + if (0 == stricmp(characterset_string, CS_Table[i].name)) { c = CS_Table[i].code; break; } } if (c < 0) { for (i = 0; CS_Alias[i].code != OTHER; i++) { - if (0 == stricmp(stat_string, CS_Alias[i].name)) { + if (0 == stricmp(characterset_string, CS_Alias[i].name)) { c = CS_Alias[i].code; break; } From fb33284261a6b8acd46ffefb8061747f0b7bbd0a Mon Sep 17 00:00:00 2001 From: Dai Date: Tue, 13 Apr 2021 22:09:56 -0700 Subject: [PATCH 28/36] Fix error --- sql-odbc/src/odfesqlodbc/opensearch_api30.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql-odbc/src/odfesqlodbc/opensearch_api30.c b/sql-odbc/src/odfesqlodbc/opensearch_api30.c index a601dc02703..c1114fcb827 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_api30.c +++ b/sql-odbc/src/odfesqlodbc/opensearch_api30.c @@ -233,10 +233,10 @@ RETCODE SQL_API OPENSEARCHAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Han case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO: ret = SQL_SUCCESS; - if (pcbErrm > 0 && stmt->openSearchError) + if (pcbErrm > 0 && stmt->opensearch_error) *((SQLINTEGER *)DiagInfoPtr) = - (pcbErrm - 1) / stmt->openSearchError->recsize + 1; + (pcbErrm - 1) / stmt->opensearch_error->recsize + 1; break; default: break; From f1beabc7e77864663c49b11bdf2e339d352544ae Mon Sep 17 00:00:00 2001 From: Dai Date: Wed, 14 Apr 2021 10:48:17 -0700 Subject: [PATCH 29/36] More renaming --- .../{elasticsearch.yml => opensearch.yml} | 0 .../PTODBCInfo/performance_odbc_info.cpp | 10 +++++----- 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/connection.c | 6 +++--- sql-odbc/src/odfesqlodbc/opensearch_connection.cpp | 12 ++++++------ sql-odbc/src/odfesqlodbc/opensearch_connection.h | 4 ++-- sql-odbc/src/odfesqlodbc/resource.h | 2 +- 9 files changed, 28 insertions(+), 28 deletions(-) rename sql-odbc/docs/dev/example_config_files/{elasticsearch.yml => opensearch.yml} (100%) rename sql-odbc/src/odfeenlist/{elasticenlist.h => opensearch_enlist.h} (80%) 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/src/PerformanceTests/PTODBCInfo/performance_odbc_info.cpp b/sql-odbc/src/PerformanceTests/PTODBCInfo/performance_odbc_info.cpp index b3e924928db..9481cd02f06 100644 --- a/sql-odbc/src/PerformanceTests/PTODBCInfo/performance_odbc_info.cpp +++ b/sql-odbc/src/PerformanceTests/PTODBCInfo/performance_odbc_info.cpp @@ -78,19 +78,19 @@ runtime_options rt_opts = []() { void GetVersionInfoString(std::string& version_info) { // Connect to DB - OpenSearchCommunication 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/odfeenlist/CMakeLists.txt b/sql-odbc/src/odfeenlist/CMakeLists.txt index 23103f8f043..3b5e503553e 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 e3fade30c43..5c5b29d2e3b 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 0e33bf9394a..393b5e8cc44 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/connection.c b/sql-odbc/src/odfesqlodbc/connection.c index 3544dac3236..390906b1360 100644 --- a/sql-odbc/src/odfesqlodbc/connection.c +++ b/sql-odbc/src/odfesqlodbc/connection.c @@ -417,15 +417,15 @@ CC_cleanup(ConnectionClass *self, BOOL keepCommunication) { /* We are always in the middle of a transaction, */ /* even if we are in auto commit. */ if (self->opensearchconn) { - QLOG(0, "LIBES_disconnect: %p\n", self->opensearchconn); - LIBES_disconnect(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(OPENSEARCH_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++) { diff --git a/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp b/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp index 58e503c92c6..48d7736e264 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_connection.cpp @@ -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; @@ -116,7 +116,7 @@ int LIBES_connect(ConnectionClass *self) { std::string err = GetErrorMsg(opensearchconn); CC_set_error(self, CONN_OPENDB_ERROR, (err.empty()) ? "OpenSearchConnectDBParams error" : err.c_str(), - "LIBES_connect"); + "LIBOPENSEARCH_connect"); return 0; } @@ -131,7 +131,7 @@ 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"); + "LIBOPENSEARCH_connect"); OpenSearchDisconnect(opensearchconn); return 0; } @@ -201,6 +201,6 @@ void CC_initialize_opensearch_version(ConnectionClass *self) { self->opensearch_version_minor = 4; } -void LIBES_disconnect(void *conn) { +void LIBOPENSEARCH_disconnect(void *conn) { OpenSearchDisconnect(conn); } diff --git a/sql-odbc/src/odfesqlodbc/opensearch_connection.h b/sql-odbc/src/odfesqlodbc/opensearch_connection.h index 9ea91a623df..4a233b97e60 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_connection.h +++ b/sql-odbc/src/odfesqlodbc/opensearch_connection.h @@ -409,8 +409,8 @@ 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_opensearch_version(ConnectionClass *self); diff --git a/sql-odbc/src/odfesqlodbc/resource.h b/sql-odbc/src/odfesqlodbc/resource.h index fe17397e22b..ff5fc59c8dc 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 From eab79f867d298e8289a05163993fdbdda414c9ca Mon Sep 17 00:00:00 2001 From: Dai Date: Wed, 14 Apr 2021 10:58:40 -0700 Subject: [PATCH 30/36] Fix elasticenlist error --- sql-odbc/src/odfesqlodbc/loadlib.c | 58 +++++++++++++++--------------- sql-odbc/src/odfesqlodbc/setup.c | 2 +- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/sql-odbc/src/odfesqlodbc/loadlib.c b/sql-odbc/src/odfesqlodbc/loadlib.c index d9500bbecdd..c7c0573ad8b 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; /* @@ -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; } @@ -172,15 +172,15 @@ 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(OPENSEARCH_DEBUG, "Freeing Library %s\n", elasticenlistdll); + MYLOG(OPENSEARCH_DEBUG, "Freeing Library %s\n", opensearch_enlistdll); FreeLibrary(enlist_module); } - MYLOG(OPENSEARCH_DEBUG, "%s unloading\n", elasticenlistdll); - success = (*func)(elasticenlistdll); - MYLOG(OPENSEARCH_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(OPENSEARCH_DEBUG, "%s unloading\n", elasticodbcdll); @@ -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/setup.c b/sql-odbc/src/odfesqlodbc/setup.c index 3486b4653bd..7e678b21e15 100644 --- a/sql-odbc/src/odfesqlodbc/setup.c +++ b/sql-odbc/src/odfesqlodbc/setup.c @@ -15,7 +15,7 @@ */ #ifdef WIN32 -#include "elasticenlist.h" +#include "opensearch_enlist.h" #include "opensearch_odbc.h" #include "loadlib.h" #include "misc.h" // strncpy_null From 4e819bac30c262cd70c2a7b5e49ae77392bbccca Mon Sep 17 00:00:00 2001 From: Dai Date: Wed, 14 Apr 2021 17:26:53 -0700 Subject: [PATCH 31/36] Replace Kibana --- sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md | 2 +- ...pensearch_dashboards_sample_data_types.md} | 8 +- .../{kibana.yml => opensearch_dashboards.yml} | 0 sql-odbc/docs/dev/run_tests.md | 12 +- sql-odbc/docs/test/exporting_csv_files.md | 2 +- sql-odbc/docs/test/refresh_data.md | 2 +- sql-odbc/docs/user/microsoft_excel_support.md | 2 +- .../ITODBCCatalog/test_odbc_catalog.cpp | 42 +- .../test_odbc_descriptors.cpp | 6 +- .../ITODBCExecution/test_odbc_execution.cpp | 14 +- .../ITODBCPagination/test_odbc_pagination.cpp | 4 +- .../ITODBCResults/test_odbc_results.cpp | 4 +- .../ITODBCTableauQueries/queries_all.txt | 432 +++++++++--------- .../performance_odbc_execution.cpp | 2 +- .../performance_odbc_results.cpp | 2 +- .../UnitTests/UTConn/test_query_execution.cpp | 6 +- 16 files changed, 270 insertions(+), 270 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/{kibana.yml => opensearch_dashboards.yml} (100%) diff --git a/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md b/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md index 0ac9d3f935c..06908a85cea 100644 --- a/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md +++ b/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md @@ -115,7 +115,7 @@ To disable SSL/TLS in the tests, the main CMakeLists.txt file must be edited. Th 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/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 5f2e0fc1858..5ad09b910e4 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/kibana.yml b/sql-odbc/docs/dev/example_config_files/opensearch_dashboards.yml similarity index 100% rename from sql-odbc/docs/dev/example_config_files/kibana.yml rename to sql-odbc/docs/dev/example_config_files/opensearch_dashboards.yml diff --git a/sql-odbc/docs/dev/run_tests.md b/sql-odbc/docs/dev/run_tests.md index 8f7fb1b87aa..b48adb9c6af 100644 --- a/sql-odbc/docs/dev/run_tests.md +++ b/sql-odbc/docs/dev/run_tests.md @@ -8,22 +8,22 @@ ### 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 [OpenDistro for Elasticsearch](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/test/exporting_csv_files.md b/sql-odbc/docs/test/exporting_csv_files.md index 393b3f07d52..624b1e39429 100644 --- a/sql-odbc/docs/test/exporting_csv_files.md +++ b/sql-odbc/docs/test/exporting_csv_files.md @@ -2,7 +2,7 @@ * Load data from Open Distro For Elasticsearch 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/refresh_data.md b/sql-odbc/docs/test/refresh_data.md index 3ddc1b4e410..6c42238a673 100644 --- a/sql-odbc/docs/test/refresh_data.md +++ b/sql-odbc/docs/test/refresh_data.md @@ -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/microsoft_excel_support.md b/sql-odbc/docs/user/microsoft_excel_support.md index 158e2d75431..a71f26207fb 100644 --- a/sql-odbc/docs/user/microsoft_excel_support.md +++ b/sql-odbc/docs/user/microsoft_excel_support.md @@ -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/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp b/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp index 34428b88a13..c18101d6b5c 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp @@ -93,7 +93,7 @@ const std::vector< short > flights_sql_data_type = { SQL_WVARCHAR, SQL_WVARCHAR, SQL_WVARCHAR, SQL_WVARCHAR, SQL_WVARCHAR}; const std::string flights_catalog_odfe = "odfe-cluster"; const std::string flights_catalog_elas = "opensearch"; -const std::string flights_table_name = "kibana_sample_data_flights"; +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/ITODBCDescriptors/test_odbc_descriptors.cpp b/sql-odbc/src/IntegrationTests/ITODBCDescriptors/test_odbc_descriptors.cpp index e47e326b7fa..69851d265eb 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; @@ -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 b3d14633370..534ccf53d00 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/ITODBCPagination/test_odbc_pagination.cpp b/sql-odbc/src/IntegrationTests/ITODBCPagination/test_odbc_pagination.cpp index 25d0259174c..f701ed90365 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCPagination/test_odbc_pagination.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCPagination/test_odbc_pagination.cpp @@ -81,14 +81,14 @@ 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={OpenSearch ODBC};" diff --git a/sql-odbc/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp b/sql-odbc/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp index 61aeaf10027..122198ef49b 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 8fb32237329..721bd26d4f9 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 9e73803e505..04be5012a2c 100644 --- a/sql-odbc/src/PerformanceTests/PTODBCExecution/performance_odbc_execution.cpp +++ b/sql-odbc/src/PerformanceTests/PTODBCExecution/performance_odbc_execution.cpp @@ -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/PTODBCResults/performance_odbc_results.cpp b/sql-odbc/src/PerformanceTests/PTODBCResults/performance_odbc_results.cpp index b435b5e3c5d..6304e208a5c 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/UnitTests/UTConn/test_query_execution.cpp b/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp index 05a77ad5fb4..5d5ed44d9d8 100644 --- a/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp +++ b/sql-odbc/src/UnitTests/UTConn/test_query_execution.cpp @@ -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; From afe4c3fbc3721c448e16f18e9600a872a92e8ee8 Mon Sep 17 00:00:00 2001 From: Dai Date: Fri, 16 Apr 2021 13:27:19 -0700 Subject: [PATCH 32/36] Fix links to old repo --- sql-odbc/CONTRIBUTING.md | 2 +- sql-odbc/docs/dev/Pagination.md | 4 ++-- sql-odbc/docs/user/microsoft_excel_support.md | 2 +- sql-odbc/docs/user/microsoft_excel_support_mac.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sql-odbc/CONTRIBUTING.md b/sql-odbc/CONTRIBUTING.md index 2cc7222a5ce..54744f61e50 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/docs/dev/Pagination.md b/sql-odbc/docs/dev/Pagination.md index b05018c854a..4a8dea1cf43 100644 --- a/sql-odbc/docs/dev/Pagination.md +++ b/sql-odbc/docs/dev/Pagination.md @@ -3,7 +3,7 @@ ## Overview 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 OpenSearch 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 OpenSearch server, check [ * 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/user/microsoft_excel_support.md b/sql-odbc/docs/user/microsoft_excel_support.md index a71f26207fb..2036f802a03 100644 --- a/sql-odbc/docs/user/microsoft_excel_support.md +++ b/sql-odbc/docs/user/microsoft_excel_support.md @@ -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. diff --git a/sql-odbc/docs/user/microsoft_excel_support_mac.md b/sql-odbc/docs/user/microsoft_excel_support_mac.md index df061429ac6..12cf8fd437b 100644 --- a/sql-odbc/docs/user/microsoft_excel_support_mac.md +++ b/sql-odbc/docs/user/microsoft_excel_support_mac.md @@ -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. From ada67ba479210f4d67c950b03b2f058f3a836a48 Mon Sep 17 00:00:00 2001 From: Dai Date: Fri, 16 Apr 2021 13:31:04 -0700 Subject: [PATCH 33/36] Fix plugin name in github action --- .github/workflows/sql-odbc-release-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sql-odbc-release-workflow.yml b/.github/workflows/sql-odbc-release-workflow.yml index 2d70355bd89..d940fe37068 100644 --- a/.github/workflows/sql-odbc-release-workflow.yml +++ b/.github/workflows/sql-odbc-release-workflow.yml @@ -11,7 +11,7 @@ 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 + PLUGIN_NAME: opensearch-sql-odbc OD_VERSION: 1.15.0.0 jobs: From 0127662a796436d65b60b89bda0f50af3c34ccd0 Mon Sep 17 00:00:00 2001 From: Dai Date: Fri, 16 Apr 2021 13:43:33 -0700 Subject: [PATCH 34/36] Change plugin name to OpenSearch --- .github/workflows/sql-odbc-release-workflow.yml | 8 ++++---- .../sql-odbc-rename-and-release-workflow.yml | 12 ++++++------ sql-odbc/README.md | 12 ++++++------ sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md | 4 ++-- sql-odbc/docs/dev/Pagination.md | 2 +- sql-odbc/docs/dev/sign_installers.md | 8 ++++---- sql-odbc/docs/test/excel_connection.md | 2 +- sql-odbc/docs/user/mac_configure_dsn.md | 2 +- sql-odbc/docs/user/microsoft_excel_support.md | 2 +- sql-odbc/docs/user/microsoft_excel_support_mac.md | 2 +- sql-odbc/docs/user/power_bi_support.md | 4 ++-- sql-odbc/docs/user/tableau_support.md | 2 +- .../opendistro-elasticsearch-odbc.release-notes.md | 2 +- .../release-notes/sql-odbc.release-notes-1.7.0.0.md | 2 +- .../src/PowerBIConnector/OdfeSqlOdbcPBIConnector.pq | 2 +- .../TableauConnector/odfe_sql_odbc_dev/manifest.xml | 2 +- sql-odbc/src/installer/CMakeLists.txt | 10 +++++----- sql-odbc/src/installer/Resources/Welcome.txt | 2 +- 18 files changed, 40 insertions(+), 40 deletions(-) diff --git a/.github/workflows/sql-odbc-release-workflow.yml b/.github/workflows/sql-odbc-release-workflow.yml index d940fe37068..160c65b2c05 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: @@ -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 775b498b5ac..23c9d1e82f7 100644 --- a/.github/workflows/sql-odbc-rename-and-release-workflow.yml +++ b/.github/workflows/sql-odbc-rename-and-release-workflow.yml @@ -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/README.md b/sql-odbc/README.md index 6f1d07383d4..cf742b4c62c 100644 --- a/sql-odbc/README.md +++ b/sql-odbc/README.md @@ -1,6 +1,6 @@ -# Open Distro for Elasticsearch ODBC Driver +# OpenSearch ODBC Driver -OpenSearchODBC 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,7 +25,7 @@ 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: @@ -35,10 +35,10 @@ This will customize the connection from Tableau to Open Distro for Elasticsearch ### 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`. diff --git a/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md b/sql-odbc/docs/dev/BUILD_INSTRUCTIONS.md index 06908a85cea..9e7d45ecf20 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) diff --git a/sql-odbc/docs/dev/Pagination.md b/sql-odbc/docs/dev/Pagination.md index 4a8dea1cf43..4e82d534802 100644 --- a/sql-odbc/docs/dev/Pagination.md +++ b/sql-odbc/docs/dev/Pagination.md @@ -1,4 +1,4 @@ -# Opendistro ODBC Driver Cursor (Pagination) Support Design Documentation +# OpenSearch ODBC Driver Cursor (Pagination) Support Design Documentation ## Overview OpenSearch ODBC Driver supports forward-only cursor. This document illustrates how the cursor(pagination) is handled in the driver. diff --git a/sql-odbc/docs/dev/sign_installers.md b/sql-odbc/docs/dev/sign_installers.md index 7f02c6fd8be..fc1880ca44f 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 9d34c7515ac..7860b73556a 100644 --- a/sql-odbc/docs/test/excel_connection.md +++ b/sql-odbc/docs/test/excel_connection.md @@ -1,7 +1,7 @@ # Testing Microsoft Excel Connection ## Prerequisites -* [Download and install](../../README.md) Open Distro for Elasticsearch SQL ODBC Driver. +* [Download and install](../../README.md) OpenSearch SQL ODBC Driver. * [Install and configure](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) Open Distro for Elasticsearch. * 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`. diff --git a/sql-odbc/docs/user/mac_configure_dsn.md b/sql-odbc/docs/user/mac_configure_dsn.md index c4dd6b3faaf..e52c80d409c 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**. diff --git a/sql-odbc/docs/user/microsoft_excel_support.md b/sql-odbc/docs/user/microsoft_excel_support.md index 2036f802a03..76e05398061 100644 --- a/sql-odbc/docs/user/microsoft_excel_support.md +++ b/sql-odbc/docs/user/microsoft_excel_support.md @@ -4,7 +4,7 @@ * 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 SQL ODBC driver](https://opendistro.github.io/for-elasticsearch-docs/docs/sql/odbc/) * A preconfigured [User or System DSN](../../README.md) ## Test Successful Connection diff --git a/sql-odbc/docs/user/microsoft_excel_support_mac.md b/sql-odbc/docs/user/microsoft_excel_support_mac.md index 12cf8fd437b..1f8f5a8ffa7 100644 --- a/sql-odbc/docs/user/microsoft_excel_support_mac.md +++ b/sql-odbc/docs/user/microsoft_excel_support_mac.md @@ -4,7 +4,7 @@ * 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 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 diff --git a/sql-odbc/docs/user/power_bi_support.md b/sql-odbc/docs/user/power_bi_support.md index e1555615186..da874457b2a 100644 --- a/sql-odbc/docs/user/power_bi_support.md +++ b/sql-odbc/docs/user/power_bi_support.md @@ -3,7 +3,7 @@ ## 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 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 @@ -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 6f4bb4ecef5..828977857a3 100644 --- a/sql-odbc/docs/user/tableau_support.md +++ b/sql-odbc/docs/user/tableau_support.md @@ -8,7 +8,7 @@ Connect an Open Distro For ElasticSearch data source to Tableau Desktop via the * 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) +* 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 070d15b31cc..6a1934e86fa 100644 --- a/sql-odbc/opendistro-elasticsearch-odbc.release-notes.md +++ b/sql-odbc/opendistro-elasticsearch-odbc.release-notes.md @@ -4,7 +4,7 @@ This is the first release of OpenDistro For ELasticsearch 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: +OpenSearch 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: * ODBC API implementation as per ODBC 3.51 specifications * Support for MacOS and Windows installers diff --git a/sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md b/sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md index d364e473ca5..7a37cf8615b 100644 --- a/sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md +++ b/sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md @@ -2,7 +2,7 @@ This is the first release of OpenDistro For ELasticsearch 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: +OpenSearch 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: * ODBC API implementation as per ODBC 3.51 specifications * Support for MacOS and Windows installers diff --git a/sql-odbc/src/PowerBIConnector/OdfeSqlOdbcPBIConnector.pq b/sql-odbc/src/PowerBIConnector/OdfeSqlOdbcPBIConnector.pq index e5659bf21f4..f75f9704aee 100644 --- a/sql-odbc/src/PowerBIConnector/OdfeSqlOdbcPBIConnector.pq +++ b/sql-odbc/src/PowerBIConnector/OdfeSqlOdbcPBIConnector.pq @@ -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/TableauConnector/odfe_sql_odbc_dev/manifest.xml b/sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/manifest.xml index f58e8eccf2e..506c5c48f8e 100644 --- a/sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/manifest.xml +++ b/sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/manifest.xml @@ -1,6 +1,6 @@ - + diff --git a/sql-odbc/src/installer/CMakeLists.txt b/sql-odbc/src/installer/CMakeLists.txt index 0b47894b646..fe30ec4199b 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/Welcome.txt b/sql-odbc/src/installer/Resources/Welcome.txt index 8e9d0c1bcfd..b4412f3294f 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 From 5d62b4a612d0058975cf38a8fb88409e3b1b5740 Mon Sep 17 00:00:00 2001 From: Dai Date: Fri, 16 Apr 2021 13:51:54 -0700 Subject: [PATCH 35/36] Replace all other ODFE and links --- sql-odbc/README.md | 8 ++++---- sql-odbc/docs/dev/run_tests.md | 4 ++-- sql-odbc/docs/test/excel_connection.md | 4 ++-- sql-odbc/docs/test/exporting_csv_files.md | 2 +- sql-odbc/docs/test/microsoft_query_connection.md | 2 +- sql-odbc/docs/test/query_wizard_connection.md | 2 +- sql-odbc/docs/test/refresh_data.md | 2 +- sql-odbc/docs/user/mac_configure_dsn.md | 2 +- sql-odbc/docs/user/microsoft_excel_support.md | 4 ++-- sql-odbc/docs/user/microsoft_excel_support_mac.md | 4 ++-- sql-odbc/docs/user/power_bi_service_support.md | 6 +++--- sql-odbc/docs/user/power_bi_support.md | 8 ++++---- sql-odbc/docs/user/tableau_support.md | 6 +++--- sql-odbc/opendistro-elasticsearch-odbc.release-notes.md | 4 ++-- sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md | 2 +- sql-odbc/src/PowerBIConnector/OdfeSqlOdbcPBIConnector.pq | 4 ++-- sql-odbc/src/PowerBIConnector/resources.resx | 6 +++--- sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml | 4 ++-- .../src/TableauConnector/odfe_sql_odbc_dev/manifest.xml | 8 ++++---- sql-odbc/src/installer/Resources/README.txt | 2 +- sql-odbc/src/odfesqlodbc/opensearch_communication.cpp | 2 +- 21 files changed, 43 insertions(+), 43 deletions(-) diff --git a/sql-odbc/README.md b/sql-odbc/README.md index cf742b4c62c..86850449057 100644 --- a/sql-odbc/README.md +++ b/sql-odbc/README.md @@ -31,7 +31,7 @@ You can use the installers generated as part of the most recent release. 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 @@ -43,7 +43,7 @@ iODBC Driver Manager should be installed before installing the OpenSearch SQL OD 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 @@ -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/run_tests.md b/sql-odbc/docs/dev/run_tests.md index b48adb9c6af..3995d8cefb5 100644 --- a/sql-odbc/docs/dev/run_tests.md +++ b/sql-odbc/docs/dev/run_tests.md @@ -2,13 +2,13 @@ ## 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 [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. +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 OpenSearch Dashboards to support it. See the [build instructions](./BUILD_INSTRUCTIONS.md) for more info. diff --git a/sql-odbc/docs/test/excel_connection.md b/sql-odbc/docs/test/excel_connection.md index 7860b73556a..e73dfa27ec5 100644 --- a/sql-odbc/docs/test/excel_connection.md +++ b/sql-odbc/docs/test/excel_connection.md @@ -2,7 +2,7 @@ ## Prerequisites * [Download and install](../../README.md) OpenSearch SQL ODBC Driver. -* [Install and configure](https://opendistro.github.io/for-elasticsearch-docs/docs/install/) Open Distro for Elasticsearch. +* [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`. @@ -14,7 +14,7 @@ There are multiple ways to load data from OpenSearch in Microsoft Excel. * [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 624b1e39429..9a32378f836 100644 --- a/sql-odbc/docs/test/exporting_csv_files.md +++ b/sql-odbc/docs/test/exporting_csv_files.md @@ -1,6 +1,6 @@ ## 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 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 c7b7c54b006..10acf075437 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 e14a94b1252..823fef7bd18 100644 --- a/sql-odbc/docs/test/query_wizard_connection.md +++ b/sql-odbc/docs/test/query_wizard_connection.md @@ -19,7 +19,7 @@ -* 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 6c42238a673..3f6be89bf87 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. diff --git a/sql-odbc/docs/user/mac_configure_dsn.md b/sql-odbc/docs/user/mac_configure_dsn.md index e52c80d409c..6c4ce75c49a 100644 --- a/sql-odbc/docs/user/mac_configure_dsn.md +++ b/sql-odbc/docs/user/mac_configure_dsn.md @@ -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 76e05398061..d2ea78166e2 100644 --- a/sql-odbc/docs/user/microsoft_excel_support.md +++ b/sql-odbc/docs/user/microsoft_excel_support.md @@ -1,9 +1,9 @@ -# 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/) +* [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) diff --git a/sql-odbc/docs/user/microsoft_excel_support_mac.md b/sql-odbc/docs/user/microsoft_excel_support_mac.md index 1f8f5a8ffa7..67182e888b0 100644 --- a/sql-odbc/docs/user/microsoft_excel_support_mac.md +++ b/sql-odbc/docs/user/microsoft_excel_support_mac.md @@ -1,9 +1,9 @@ -# 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/) +* [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) diff --git a/sql-odbc/docs/user/power_bi_service_support.md b/sql-odbc/docs/user/power_bi_service_support.md index 1f2a1d8e50d..1ccb20cceac 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 Distro 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 da874457b2a..66c9e647b14 100644 --- a/sql-odbc/docs/user/power_bi_support.md +++ b/sql-odbc/docs/user/power_bi_support.md @@ -1,8 +1,8 @@ -# 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/) +* [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", diff --git a/sql-odbc/docs/user/tableau_support.md b/sql-odbc/docs/user/tableau_support.md index 828977857a3..1c0cea4a650 100644 --- a/sql-odbc/docs/user/tableau_support.md +++ b/sql-odbc/docs/user/tableau_support.md @@ -1,13 +1,13 @@ -# 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/) +* 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 6a1934e86fa..540b341a188 100644 --- a/sql-odbc/opendistro-elasticsearch-odbc.release-notes.md +++ b/sql-odbc/opendistro-elasticsearch-odbc.release-notes.md @@ -2,9 +2,9 @@ ### Notable Changes -This is the first release of OpenDistro For ELasticsearch ODBC driver. +This is the first release of OpenSearch ODBC driver. -OpenSearch 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: +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: * ODBC API implementation as per ODBC 3.51 specifications * Support for MacOS and Windows installers diff --git a/sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md b/sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md index 7a37cf8615b..9adf609f03d 100644 --- a/sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md +++ b/sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md @@ -1,6 +1,6 @@ ## 2020-05-05, Version 1.7 -This is the first release of OpenDistro For ELasticsearch ODBC driver. +This is the first release of OpenSearch ODBC driver. OpenSearch 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/PowerBIConnector/OdfeSqlOdbcPBIConnector.pq b/sql-odbc/src/PowerBIConnector/OdfeSqlOdbcPBIConnector.pq index f75f9704aee..1ae78f11df5 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 => diff --git a/sql-odbc/src/PowerBIConnector/resources.resx b/sql-odbc/src/PowerBIConnector/resources.resx index 8fe822c55cf..3642a474fe2 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/manifest.xml b/sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml index 72e96108d96..8fe3aad6269 100644 --- a/sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml +++ b/sql-odbc/src/TableauConnector/odfe_sql_odbc/manifest.xml @@ -3,8 +3,8 @@ - - + + 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 506c5c48f8e..dcc45b9b536 100644 --- a/sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/manifest.xml +++ b/sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/manifest.xml @@ -2,12 +2,12 @@ - - - + + + - + diff --git a/sql-odbc/src/installer/Resources/README.txt b/sql-odbc/src/installer/Resources/README.txt index 30ef5eb42a2..dc5b7f485d0 100644 --- a/sql-odbc/src/installer/Resources/README.txt +++ b/sql-odbc/src/installer/Resources/README.txt @@ -16,4 +16,4 @@ For example, if you want to use Tableau with OpenSearch Server, 4. Click on 'Connect'. All connection attributes will be retrived. 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/odfesqlodbc/opensearch_communication.cpp b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp index 01d0ef876e9..f9cde1b5dc1 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp @@ -41,7 +41,7 @@ static const std::string ALLOCATION_TAG = "AWS_SIGV4_AUTH"; static const std::string SERVICE_NAME = "es"; 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 OpenSearch data "\"type\": \"object\"," From 5d1f4341d0b177ce4e179bce4be4bd7e4ff9f2f5 Mon Sep 17 00:00:00 2001 From: Dai Date: Fri, 16 Apr 2021 15:34:35 -0700 Subject: [PATCH 36/36] Revert release notes --- sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md b/sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md index 9adf609f03d..d364e473ca5 100644 --- a/sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md +++ b/sql-odbc/release-notes/sql-odbc.release-notes-1.7.0.0.md @@ -1,8 +1,8 @@ ## 2020-05-05, Version 1.7 -This is the first release of OpenSearch ODBC driver. +This is the first release of OpenDistro For ELasticsearch ODBC driver. -OpenSearch 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: +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: * ODBC API implementation as per ODBC 3.51 specifications * Support for MacOS and Windows installers