diff --git a/libraries/VisualLeakDetector/lib/vld.lib b/libraries/VisualLeakDetector/lib/vld.lib new file mode 100644 index 00000000..96339e27 Binary files /dev/null and b/libraries/VisualLeakDetector/lib/vld.lib differ diff --git a/libraries/VisualLeakDetector/lib64/vld.lib b/libraries/VisualLeakDetector/lib64/vld.lib new file mode 100644 index 00000000..878dde2d Binary files /dev/null and b/libraries/VisualLeakDetector/lib64/vld.lib differ diff --git a/src/IntegrationTests/ITODBCAwsAuth/test_aws_auth_dsn.reg b/src/IntegrationTests/ITODBCAwsAuth/test_aws_auth_dsn.reg new file mode 100644 index 00000000..0d172088 --- /dev/null +++ b/src/IntegrationTests/ITODBCAwsAuth/test_aws_auth_dsn.reg @@ -0,0 +1,17 @@ +Windows Registry Editor Version 5.00 + +[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers] +"ElasticsearchODBC"="Installed" + +[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ElasticsearchODBC] +"Driver"="\\bin64\\Release\\elasticodbc.dll" +"Setup"="\\bin64\\Release\\elasticodbc.dll" + +[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources] +"test_aws_auth_dsn"="ElasticsearchODBC" + +[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" +"auth"="AWS_SIGV4" +"region"="eu-west-3" +"useSSL"="0" diff --git a/src/IntegrationTests/ITODBCAwsAuth/test_odbc.ini b/src/IntegrationTests/ITODBCAwsAuth/test_odbc.ini new file mode 100644 index 00000000..c5116456 --- /dev/null +++ b/src/IntegrationTests/ITODBCAwsAuth/test_odbc.ini @@ -0,0 +1,8 @@ +[ODBC Data Sources] +test_aws_auth_dsn = ElasticsearchODBC + +[test_aws_auth_dsn] +host = https://search-sept-cdg-david-test-domain-gouok3seqeupz64smuvfxyddui.eu-west-3.es.amazonaws.com +auth = AWS_SIGV4 +region = eu-west-3 +useSSL = 0 \ No newline at end of file diff --git a/src/IntegrationTests/ITODBCAwsAuth/test_odbc_aws_auth.cpp b/src/IntegrationTests/ITODBCAwsAuth/test_odbc_aws_auth.cpp index a0132183..04db51f3 100644 --- a/src/IntegrationTests/ITODBCAwsAuth/test_odbc_aws_auth.cpp +++ b/src/IntegrationTests/ITODBCAwsAuth/test_odbc_aws_auth.cpp @@ -19,7 +19,7 @@ #include "it_odbc_helper.h" // clang-format on -std::wstring dsn_name = L"test_dsn"; +std::wstring dsn_name = L"test_aws_auth_dsn"; std::wstring aws_auth_conn_string = L"Driver={Elasticsearch};DataBase=database_name;" L"Server=https://" diff --git a/src/IntegrationTests/ITODBCAwsAuth/test_odbcinst.ini b/src/IntegrationTests/ITODBCAwsAuth/test_odbcinst.ini new file mode 100644 index 00000000..01894e69 --- /dev/null +++ b/src/IntegrationTests/ITODBCAwsAuth/test_odbcinst.ini @@ -0,0 +1,6 @@ +[ODBC Drivers] +ElasticsearchODBC = Installed + +[ElasticsearchODBC] +Driver = /lib64/libelasticodbc.dylib +Setup = /lib64/libelasticodbc.dylib \ No newline at end of file diff --git a/src/IntegrationTests/ITODBCConnection/test_dsn.reg b/src/IntegrationTests/ITODBCConnection/test_dsn.reg index 5e8b646a..38aeb379 100644 --- a/src/IntegrationTests/ITODBCConnection/test_dsn.reg +++ b/src/IntegrationTests/ITODBCConnection/test_dsn.reg @@ -11,7 +11,11 @@ Windows Registry Editor Version 5.00 "test_dsn"="ElasticsearchODBC" [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\test_dsn] -"Host"="localhost" -"Port"="9200" -"Username"="admin" -"Password"="admin" +"host"="localhost" +"port"="9200" +"user"="admin" +"password"="admin" +"auth"="BASIC" +"useSSL"="0" +"responseTimeout"="10" + diff --git a/src/IntegrationTests/ITODBCConnection/test_odbc.ini b/src/IntegrationTests/ITODBCConnection/test_odbc.ini index 8f16c351..f1b38ef2 100644 --- a/src/IntegrationTests/ITODBCConnection/test_odbc.ini +++ b/src/IntegrationTests/ITODBCConnection/test_odbc.ini @@ -1,8 +1,11 @@ [ODBC Data Sources] -test_dsn = ElasticsearchODBC +test_dsn = ElasticsearchODBC [test_dsn] -Host = localhost -Port = 9200 -Username = admin -Password = admin \ No newline at end of file +host = localhost +port = 9200 +user = admin +password = admin +auth = BASIC +useSSL = 0 +responseTimeout = 10 \ No newline at end of file diff --git a/src/IntegrationTests/ITODBCConnection/test_odbc_connection.cpp b/src/IntegrationTests/ITODBCConnection/test_odbc_connection.cpp index cdf960e0..66f8a8ba 100644 --- a/src/IntegrationTests/ITODBCConnection/test_odbc_connection.cpp +++ b/src/IntegrationTests/ITODBCConnection/test_odbc_connection.cpp @@ -147,7 +147,7 @@ TEST(TestSqlDriverConnect, SqlDriverNoprompt) { // std::wstring invalid_driver_conn_string = // L"Driver=xxxx;DataBase=database_name;" // L"Server=localhost;port=9200;" -// L"Uid=admin;Pwd=admin;"; +// L"username=admin;password=admin;"; // SQLRETURN ret; // ExecuteSqlDriverConnect((SQLTCHAR*)invalid_driver_conn_string.c_str(), @@ -156,10 +156,17 @@ TEST(TestSqlDriverConnect, SqlDriverNoprompt) { // } TEST(TestSqlDriverConnect, InvalidHost) { - std::wstring invalid_host_conn_string = - L"Driver={SQL Server};DataBase=database_name;" - L"Host=8.8.8.8;Port=9200;" - L"Username=admin;Password=admin;AuthenticationMode=BASIC"; + std::wstring invalid_host_conn_string = + use_ssl ? L"Driver={Elasticsearch 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=10;" + : L"Driver={Elasticsearch 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:\\;" + L"responseTimeout=10;"; SQLRETURN ret; ExecuteSqlDriverConnect((SQLTCHAR*)invalid_host_conn_string.c_str(), @@ -169,9 +176,16 @@ TEST(TestSqlDriverConnect, InvalidHost) { TEST(TestSqlDriverConnect, InvalidPort) { std::wstring invalid_port_conn_string = - L"Driver={SQL Server};DataBase=database_name;" - L"Host=localhost;Port=5432;" - L"Username=admin;Password=admin;"; + use_ssl ? L"Driver={Elasticsearch 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"host=localhost;port=5432;" + L"user=admin;password=admin;auth=BASIC;useSSL=" + L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" + L"responseTimeout=10;"; SQLRETURN ret; ExecuteSqlDriverConnect((SQLTCHAR*)invalid_port_conn_string.c_str(), @@ -184,9 +198,16 @@ TEST(TestSqlDriverConnect, InvalidPort) { // string attribute) TEST(TestSqlDriverConnect, UnsupportedKeyword) { std::wstring unsupported_keyword_conn_string = - L"Driver={SQL Server};DataBase=database_name;" - L"Host=localhost;Port=5432;" - L"Username=admin;Password=admin;extra=1;"; + use_ssl ? L"Driver={Elasticsearch 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"host=localhost;port=5432;" + L"user=admin;password=admin;auth=BASIC;useSSL=" + L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" + L"responseTimeout=10;extra=1"; SQLRETURN ret; ExecuteSqlDriverConnect((SQLTCHAR*)unsupported_keyword_conn_string.c_str(), @@ -195,10 +216,17 @@ TEST(TestSqlDriverConnect, UnsupportedKeyword) { } TEST(TestSqlDriverConnect, Timeout1Second) { - std::wstring one_second_timeout = - L"Driver={SQL Server};DataBase=elasticsearch;" - L"Host=8.8.8.8;Port=9200;" - L"Username=admin;Password=admin;ResponseTimeout=1;"; + std::wstring one_second_timeout = + use_ssl ? L"Driver={Elasticsearch 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"host=8.8.8.8;port=9200;" + L"user=admin;password=admin;auth=BASIC;useSSL=" + L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" + L"responseTimeout=1;"; SQLRETURN ret; auto start = std::chrono::steady_clock::now(); @@ -223,10 +251,17 @@ TEST(TestSqlDriverConnect, Timeout1Second) { } TEST(TestSqlDriverConnect, Timeout3Second) { - std::wstring one_second_timeout = - L"Driver={SQL Server};DataBase=elasticsearch;" - L"Host=8.8.8.8;Port=9200;" - L"Username=admin;Password=admin;ResponseTimeout=3;"; + std::wstring one_second_timeout = + use_ssl ? L"Driver={Elasticsearch 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"host=8.8.8.8;port=9200;" + L"user=admin;password=admin;auth=BASIC;useSSL=" + L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" + L"responseTimeout=3;"; SQLRETURN ret; auto start = std::chrono::steady_clock::now(); @@ -251,10 +286,17 @@ TEST(TestSqlDriverConnect, Timeout3Second) { } TEST(TestSqlDriverConnect, Timeout7Second) { - std::wstring seven_second_timeout = - L"Driver={SQL Server};DataBase=elasticsearch;" - L"Host=8.8.8.8;Port=9200;" - L"Username=admin;Password=admin;ResponseTimeout=7;"; + std::wstring seven_second_timeout = + use_ssl ? L"Driver={Elasticsearch 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"host=8.8.8.8;port=9200;" + L"user=admin;password=admin;auth=BASIC;useSSL=" + L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" + L"responseTimeout=7;"; SQLRETURN ret; auto start = std::chrono::steady_clock::now(); diff --git a/src/IntegrationTests/ITODBCHelper/it_odbc_helper.cpp b/src/IntegrationTests/ITODBCHelper/it_odbc_helper.cpp index 18c49583..0f1d8edf 100644 --- a/src/IntegrationTests/ITODBCHelper/it_odbc_helper.cpp +++ b/src/IntegrationTests/ITODBCHelper/it_odbc_helper.cpp @@ -48,11 +48,6 @@ void AllocConnection(SQLTCHAR* connection_string, SQLHDBC* db_connection, SQLTCHAR out_conn_string[1024]; SQLSMALLINT out_conn_string_length; - // TODO: Integration tests hanging for tests with no SQL_ERROR test case - // (AE-114) - SQLDriverConnect(*db_connection, NULL, (SQLTCHAR*)L"", SQL_NTS, - out_conn_string, IT_SIZEOF(out_conn_string), - &out_conn_string_length, SQL_DRIVER_COMPLETE); EXECUTION_HANDLER( throw_on_error, log_diag, SQL_HANDLE_DBC, *db_connection, ret_code, SQLDriverConnect(*db_connection, NULL, connection_string, SQL_NTS, diff --git a/src/IntegrationTests/ITODBCHelper/it_odbc_helper.h b/src/IntegrationTests/ITODBCHelper/it_odbc_helper.h index b93bd976..8abf387e 100644 --- a/src/IntegrationTests/ITODBCHelper/it_odbc_helper.h +++ b/src/IntegrationTests/ITODBCHelper/it_odbc_helper.h @@ -22,9 +22,11 @@ #endif #include #include -#include "unit_test_helper.h" + #include +#include "unit_test_helper.h" + // SQLSTATEs #define SQLSTATE_STRING_DATA_RIGHT_TRUNCATED (SQLWCHAR*)L"01004" #define SQLSTATE_INVALID_DESCRIPTOR_INDEX (SQLWCHAR*)L"07009" @@ -34,13 +36,16 @@ #define IT_SIZEOF(x) (NULL == (x) ? 0 : (sizeof((x)) / sizeof((x)[0]))) std::wstring conn_string = - use_ssl ? L"Driver={SQL Server};DataBase=database_name;" - L"Server=https://localhost;port=9200;" - L"Username=admin;Password=admin;AuthenticationMode=BASIC;SSLUse=" - L"1;SSLVerifyServer=0;" - : L"Driver={SQL Server};DataBase=database_name;" - L"Server=localhost;port=9200;SSLUse=0;SSLVerifyServer=0;" - L"Username=admin;Password=admin;AuthenticationMode=BASIC;"; + use_ssl ? L"Driver={Elasticsearch 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"host=localhost;port=9200;" + L"user=admin;password=admin;auth=BASIC;useSSL=" + L"0;hostnameVerification=0;logLevel=0;logOutput=C:\\;" + L"responseTimeout=10;"; void AllocConnection(SQLTCHAR* connection_string, SQLHDBC* db_connection, bool throw_on_error, bool log_diag); diff --git a/src/UnitTests/UTConn/test_conn.cpp b/src/UnitTests/UTConn/test_conn.cpp index 1accbe08..1a2170b8 100644 --- a/src/UnitTests/UTConn/test_conn.cpp +++ b/src/UnitTests/UTConn/test_conn.cpp @@ -31,14 +31,14 @@ const std::string invalid_host = "10.1.1.189"; const std::string invalid_port = "920"; const std::string invalid_user = "amin"; const std::string invalid_pw = "amin"; -runtime_options valid_opt_val = {{valid_host, valid_port, "elasticsearch", "1"}, +runtime_options valid_opt_val = {{valid_host, valid_port, "1"}, {"BASIC", valid_user, valid_pw}, {use_ssl, false, "", "", "", ""}}; runtime_options invalid_opt_val = { - {invalid_host, invalid_port, "elasticsearch", "1"}, + {invalid_host, invalid_port, "1"}, {"BASIC", invalid_user, invalid_pw}, {use_ssl, false, "", "", "", ""}}; -runtime_options missing_opt_val = {{"", "", "elasticsearch", "1"}, +runtime_options missing_opt_val = {{"", "", "1"}, {"BASIC", "", invalid_pw}, {use_ssl, false, "", "", "", ""}}; diff --git a/src/UnitTests/UTConn/test_query_execution.cpp b/src/UnitTests/UTConn/test_query_execution.cpp index e7b6c1c4..bb34585d 100644 --- a/src/UnitTests/UTConn/test_query_execution.cpp +++ b/src/UnitTests/UTConn/test_query_execution.cpp @@ -38,7 +38,7 @@ const int EXECUTION_ERROR = -1; const int all_columns_flights_count = 25; const int some_columns_flights_count = 2; runtime_options valid_conn_opt_val = { - {valid_host, valid_port, "elasticsearch", "1"}, + {valid_host, valid_port, "1"}, {"BASIC", valid_user, valid_pw}, {use_ssl, false, "", "", "", ""}}; diff --git a/src/elasticodbc/connection.c b/src/elasticodbc/connection.c index cfd52f59..a42ae305 100644 --- a/src/elasticodbc/connection.c +++ b/src/elasticodbc/connection.c @@ -113,7 +113,7 @@ RETCODE SQL_API ESAPI_Connect(HDBC hdbc, const SQLCHAR *szDSN, /* get the values for the DSN from the registry */ getDSNinfo(ci, NULL); - logs_on_off(1, ci->drivers.debug, ci->drivers.commlog); + logs_on_off(1, ci->drivers.loglevel, ci->drivers.loglevel); /* initialize es_version from connInfo.protocol */ CC_initialize_es_version(conn); @@ -186,8 +186,8 @@ RETCODE SQL_API ESAPI_Disconnect(HDBC hdbc) { return SQL_ERROR; } - logs_on_off(-1, conn->connInfo.drivers.debug, - conn->connInfo.drivers.commlog); + logs_on_off(-1, conn->connInfo.drivers.loglevel, + conn->connInfo.drivers.loglevel); MYLOG(0, "about to CC_cleanup\n"); /* Close the connection and free statements */ @@ -495,43 +495,6 @@ CC_cleanup(ConnectionClass *self, BOOL keepCommunication) { return ret; } -int CC_set_translation(ConnectionClass *self) { - UNUSED(self); -#ifdef WIN32 - CSTR func = "CC_set_translation"; - - if (self->translation_handle != NULL) { - FreeLibrary(self->translation_handle); - self->translation_handle = NULL; - } - - if (self->connInfo.translation_dll[0] == 0) - return TRUE; - - self->translation_option = atoi(self->connInfo.translation_option); - self->translation_handle = LoadLibrary(self->connInfo.translation_dll); - - if (self->translation_handle == NULL) { - CC_set_error(self, CONN_UNABLE_TO_LOAD_DLL, - "Could not load the translation DLL.", func); - return FALSE; - } - - self->DataSourceToDriver = (DataSourceToDriverProc)GetProcAddress( - self->translation_handle, "SQLDataSourceToDriver"); - - self->DriverToDataSource = (DriverToDataSourceProc)GetProcAddress( - self->translation_handle, "SQLDriverToDataSource"); - - if (self->DataSourceToDriver == NULL || self->DriverToDataSource == NULL) { - CC_set_error(self, CONN_UNABLE_TO_LOAD_DLL, - "Could not find translation DLL functions.", func); - return FALSE; - } -#endif - return TRUE; -} - #ifndef ES_DIAG_SEVERITY_NONLOCALIZED #define ES_DIAG_SEVERITY_NONLOCALIZED 'V' #endif @@ -692,14 +655,8 @@ void CC_log_error(const char *func, const char *desc, } const char *CurrCat(const ConnectionClass *conn) { - /* - * Returning the database name causes problems in MS Query. It - * generates query like: "SELECT DISTINCT a FROM byronnbad3 - * bad3" - */ - if (isMsQuery()) /* MS Query */ - return NULL; - return conn->connInfo.database; + UNUSED(conn); + return NULL; } const char *CurrCatString(const ConnectionClass *conn) { diff --git a/src/elasticodbc/convert.c b/src/elasticodbc/convert.c index 0e5256d0..b60995f2 100644 --- a/src/elasticodbc/convert.c +++ b/src/elasticodbc/convert.c @@ -26,16 +26,16 @@ #include #include #include +#include #include "multibyte.h" - -#include #ifdef HAVE_LOCALE_H #include #endif #include #include #include + #include "bind.h" #include "catfunc.h" #include "es_apifunc.h" @@ -683,7 +683,7 @@ static int setup_getdataclass(SQLLEN *const length_return, int needbuflen = 0; int result = COPY_OK; - BOOL lf_conv = conn->connInfo.lf_conversion; + BOOL lf_conv = 0; int bytea_process_kind = 0; BOOL already_processed = FALSE; BOOL changed = FALSE; @@ -710,7 +710,7 @@ static int setup_getdataclass(SQLLEN *const length_return, if (get_convtype() > 0) /* coversion between the current locale is available */ { - BOOL wcs_debug = conn->connInfo.wcs_debug; + BOOL wcs_debug = 0; BOOL same_encoding = (conn->ccsc == es_CS_code(conn->locale_encoding)); BOOL is_utf8 = (UTF8 == conn->ccsc); @@ -1065,54 +1065,11 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, field_type, fCType, (value == NULL) ? "" : value, cbValueMax); if (!value) { - MYLOG(0, "null_cvt_date_string=%d\n", - conn->connInfo.cvt_null_date_string); - /* a speicial handling for FOXPRO NULL -> NULL_STRING */ - if (conn->connInfo.cvt_null_date_string > 0 - && (ES_TYPE_DATE == field_type || ES_TYPE_DATETIME == field_type - || ES_TYPE_TIMESTAMP_NO_TMZONE == field_type) - && (SQL_C_CHAR == fCType || -#ifdef UNICODE_SUPPORT - SQL_C_WCHAR == fCType || -#endif /* UNICODE_SUPPORT */ - SQL_C_DATE == fCType || SQL_C_TYPE_DATE == fCType - || SQL_C_DEFAULT == fCType)) { - if (pcbValueBindRow) - *pcbValueBindRow = 0; - switch (fCType) { - case SQL_C_CHAR: - if (rgbValueBindRow && cbValueMax > 0) - *rgbValueBindRow = '\0'; - else - result = COPY_RESULT_TRUNCATED; - break; - case SQL_C_DATE: - case SQL_C_TYPE_DATE: - case SQL_C_DEFAULT: - if (rgbValueBindRow - && cbValueMax >= (SQLLEN)sizeof(DATE_STRUCT)) { - memset(rgbValueBindRow, 0, cbValueMax); - if (pcbValueBindRow) - *pcbValueBindRow = sizeof(DATE_STRUCT); - } else - result = COPY_RESULT_TRUNCATED; - break; -#ifdef UNICODE_SUPPORT - case SQL_C_WCHAR: - if (rgbValueBindRow && cbValueMax >= (SQLLEN)WCLEN) - memset(rgbValueBindRow, 0, WCLEN); - else - result = COPY_RESULT_TRUNCATED; - break; -#endif /* UNICODE_SUPPORT */ - } - return result; - } /* * handle a null just by returning SQL_NULL_DATA in pcbValue, and * doing nothing to the buffer. */ - else if (pIndicator) { + if (pIndicator) { *pIndicatorBindRow = SQL_NULL_DATA; return COPY_OK; } else { @@ -1212,8 +1169,6 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, break; case ES_TYPE_BOOL: { /* change T/F to 1/0 */ - const ConnInfo *ci = &(conn->connInfo); - switch (((char *)value)[0]) { case 'f': case 'F': @@ -1223,10 +1178,7 @@ int copy_and_convert_field(StatementClass *stmt, OID field_type, int atttypmod, STRCPY_FIXED(booltemp, "0"); break; default: - if (ci->true_is_minus1) - STRCPY_FIXED(booltemp, "-1"); - else - STRCPY_FIXED(booltemp, "1"); + STRCPY_FIXED(booltemp, "1"); } neut_str = booltemp; } break; diff --git a/src/elasticodbc/dlg_specific.c b/src/elasticodbc/dlg_specific.c index 8b26efa7..0ad712f2 100644 --- a/src/elasticodbc/dlg_specific.c +++ b/src/elasticodbc/dlg_specific.c @@ -32,151 +32,10 @@ static esNAME decode_or_remove_braces(const char *in); (BIT_FORCEABBREVCONNSTR | BIT_FAKE_MSS | BIT_BDE_ENVIRONMENT \ | BIT_CVT_NULL_DATE | BIT_ACCESSIBLE_ONLY | BIT_IGNORE_ROUND_TRIP_TIME \ | BIT_DISABLE_KEEPALIVE) -UInt4 getExtraOptions(const ConnInfo *ci) { - UInt4 flag = ci->extra_opts & (~OVR_EXTRA_BITS); - - if (ci->force_abbrev_connstr > 0) - flag |= BIT_FORCEABBREVCONNSTR; - else if (ci->force_abbrev_connstr == 0) - flag &= (~BIT_FORCEABBREVCONNSTR); - if (ci->fake_mss > 0) - flag |= BIT_FAKE_MSS; - else if (ci->fake_mss == 0) - flag &= (~BIT_FAKE_MSS); - if (ci->bde_environment > 0) - flag |= BIT_BDE_ENVIRONMENT; - else if (ci->bde_environment == 0) - flag &= (~BIT_BDE_ENVIRONMENT); - if (ci->cvt_null_date_string > 0) - flag |= BIT_CVT_NULL_DATE; - else if (ci->cvt_null_date_string == 0) - flag &= (~BIT_CVT_NULL_DATE); - if (ci->accessible_only > 0) - flag |= BIT_ACCESSIBLE_ONLY; - else if (ci->accessible_only == 0) - flag &= (~BIT_ACCESSIBLE_ONLY); - if (ci->ignore_round_trip_time > 0) - flag |= BIT_IGNORE_ROUND_TRIP_TIME; - else if (ci->ignore_round_trip_time == 0) - flag &= (~BIT_IGNORE_ROUND_TRIP_TIME); - if (ci->disable_keepalive > 0) - flag |= BIT_DISABLE_KEEPALIVE; - else if (ci->disable_keepalive == 0) - flag &= (~BIT_DISABLE_KEEPALIVE); - - return flag; -} CSTR hex_format = "%x"; CSTR dec_format = "%u"; CSTR octal_format = "%o"; -static UInt4 replaceExtraOptions(ConnInfo *ci, UInt4 flag, BOOL overwrite) { - if (overwrite) - ci->extra_opts = flag; - else - ci->extra_opts |= (flag & ~(OVR_EXTRA_BITS)); - if (overwrite || ci->force_abbrev_connstr < 0) - ci->force_abbrev_connstr = (0 != (flag & BIT_FORCEABBREVCONNSTR)); - if (overwrite || ci->fake_mss < 0) - ci->fake_mss = (0 != (flag & BIT_FAKE_MSS)); - if (overwrite || ci->bde_environment < 0) - ci->bde_environment = (0 != (flag & BIT_BDE_ENVIRONMENT)); - if (overwrite || ci->cvt_null_date_string < 0) - ci->cvt_null_date_string = (0 != (flag & BIT_CVT_NULL_DATE)); - if (overwrite || ci->accessible_only < 0) - ci->accessible_only = (0 != (flag & BIT_ACCESSIBLE_ONLY)); - if (overwrite || ci->ignore_round_trip_time < 0) - ci->ignore_round_trip_time = (0 != (flag & BIT_IGNORE_ROUND_TRIP_TIME)); - if (overwrite || ci->disable_keepalive < 0) - ci->disable_keepalive = (0 != (flag & BIT_DISABLE_KEEPALIVE)); - - return (ci->extra_opts = getExtraOptions(ci)); -} -BOOL setExtraOptions(ConnInfo *ci, const char *optstr, const char *format) { - UInt4 flag = 0; - - if (!format) { - if ('0' == *optstr) { - switch (optstr[1]) { - case '\0': - format = dec_format; - break; - case 'x': - case 'X': - optstr += 2; - format = hex_format; - break; - default: - format = octal_format; - break; - } - } else - format = dec_format; - } - - if (sscanf(optstr, format, &flag) < 1) - return FALSE; - replaceExtraOptions(ci, flag, TRUE); - return TRUE; -} -UInt4 add_removeExtraOptions(ConnInfo *ci, UInt4 aflag, UInt4 dflag) { - ci->extra_opts |= aflag; - ci->extra_opts &= (~dflag); - if (0 != (aflag & BIT_FORCEABBREVCONNSTR)) - ci->force_abbrev_connstr = TRUE; - if (0 != (aflag & BIT_FAKE_MSS)) - ci->fake_mss = TRUE; - if (0 != (aflag & BIT_BDE_ENVIRONMENT)) - ci->bde_environment = TRUE; - if (0 != (aflag & BIT_CVT_NULL_DATE)) - ci->cvt_null_date_string = TRUE; - if (0 != (aflag & BIT_ACCESSIBLE_ONLY)) - ci->accessible_only = TRUE; - if (0 != (aflag & BIT_IGNORE_ROUND_TRIP_TIME)) - ci->ignore_round_trip_time = TRUE; - if (0 != (aflag & BIT_DISABLE_KEEPALIVE)) - ci->disable_keepalive = TRUE; - if (0 != (dflag & BIT_FORCEABBREVCONNSTR)) - ci->force_abbrev_connstr = FALSE; - if (0 != (dflag & BIT_FAKE_MSS)) - ci->fake_mss = FALSE; - if (0 != (dflag & BIT_CVT_NULL_DATE)) - ci->cvt_null_date_string = FALSE; - if (0 != (dflag & BIT_ACCESSIBLE_ONLY)) - ci->accessible_only = FALSE; - if (0 != (dflag & BIT_IGNORE_ROUND_TRIP_TIME)) - ci->ignore_round_trip_time = FALSE; - if (0 != (dflag & BIT_DISABLE_KEEPALIVE)) - ci->disable_keepalive = FALSE; - - return (ci->extra_opts = getExtraOptions(ci)); -} - -static char *makeKeepaliveConnectString(char *target, int buflen, - const ConnInfo *ci, BOOL abbrev) { - char *buf = target; - *buf = '\0'; - - if (ci->disable_keepalive) - return target; - - if (ci->keepalive_idle >= 0) { - if (abbrev) - snprintf(buf, buflen, ABBR_KEEPALIVETIME "=%u;", - ci->keepalive_idle); - else - snprintf(buf, buflen, INI_KEEPALIVETIME "=%u;", ci->keepalive_idle); - } - if (ci->keepalive_interval >= 0) { - if (abbrev) - snprintfcat(buf, buflen, ABBR_KEEPALIVEINTERVAL "=%u;", - ci->keepalive_interval); - else - snprintfcat(buf, buflen, INI_KEEPALIVEINTERVAL "=%u;", - ci->keepalive_interval); - } - return target; -} #define OPENING_BRACKET '{' #define CLOSING_BRACKET '}' @@ -213,59 +72,34 @@ static const char *makeBracketConnectString(BOOL in_str, char **target, return buf; } -#ifdef _HANDLE_ENLIST_IN_DTC_ -char *makeXaOptConnectString(char *target, int buflen, const ConnInfo *ci, - BOOL abbrev) { - char *buf = target; - *buf = '\0'; - - if (ci->xa_opt < 0) - return target; - - if (abbrev) { - if (DEFAULT_XAOPT != ci->xa_opt) - snprintf(buf, buflen, ABBR_XAOPT "=%u;", ci->xa_opt); - } else - snprintf(buf, buflen, INI_XAOPT "=%u;", ci->xa_opt); - return target; -} -#endif /* _HANDLE_ENLIST_IN_DTC_ */ - #ifdef __APPLE__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wembedded-directive" #endif // __APPLE__ void makeConnectString(char *connect_string, const ConnInfo *ci, UWORD len) { + UNUSED(len); char got_dsn = (ci->dsn[0] != '\0'); char encoded_item[LARGE_REGISTRY_LEN]; char *connsetStr = NULL; char *esoptStr = NULL; - char keepaliveStr[64]; #ifdef _HANDLE_ENLIST_IN_DTC_ char xaOptStr[16]; #endif ssize_t hlen, nlen, olen; - /*BOOL abbrev = (len <= 400);*/ - BOOL abbrev = (len < 1024) || 0 < ci->force_abbrev_connstr; - UInt4 flag; - MYLOG(0, "%s row_versioning=%s\n", __FUNCTION__, ci->row_versioning); - - MYLOG(DETAIL_LOG_LEVEL, "force_abbrev=%d abbrev=%d\n", - ci->force_abbrev_connstr, abbrev); encode(ci->password, encoded_item, sizeof(encoded_item)); /* fundamental info */ nlen = MAX_CONNECT_STRING; - olen = snprintf( - connect_string, nlen, - "%s=%s;DATABASE=%s;SERVER=%s;PORT=%s;UID=%s;PWD=%s;" - "ResponseTimeout=%s;" INI_SSL_USE "=%d;" INI_SSL_VERIFY_SERVER - "=%d;" INI_SSL_ALLOW_SELF_SIGNED "=%d;" INI_SSL_CERTIFICATE - "=%s;" INI_SSL_KEY " =%s;" INI_AUTH_MODE "=%s;" INI_REGION "=%s;", - got_dsn ? "DSN" : "DRIVER", got_dsn ? ci->dsn : ci->drivername, - ci->database, ci->server, ci->port, ci->username, encoded_item, - ci->response_timeout, (int)ci->use_ssl, (int)ci->verify_server, - (int)ci->trust_self_signed, ci->certificate, ci->key, ci->authtype, ci->region); + olen = snprintf(connect_string, nlen, + "%s=%s;" INI_SERVER "=%s;" INI_PORT "=%s;" INI_USERNAME + "=%s;" INI_PASSWORD "=%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;", + got_dsn ? "DSN" : "DRIVER", got_dsn ? ci->dsn : ci->drivername, + ci->server, ci->port, ci->username, encoded_item, ci->authtype, + ci->region, (int)ci->use_ssl, (int)ci->verify_server, + (int)ci->drivers.loglevel, ci->drivers.output_dir, + ci->response_timeout); if (olen < 0 || olen >= nlen) { connect_string[0] = '\0'; return; @@ -274,168 +108,6 @@ void makeConnectString(char *connect_string, const ConnInfo *ci, UWORD len) { /* extra info */ hlen = strlen(connect_string); nlen = MAX_CONNECT_STRING - hlen; - MYLOG(DETAIL_LOG_LEVEL, "hlen=" FORMAT_SSIZE_T "\n", hlen); - if (!abbrev) { - char protocol_and[16]; - - if (ci->rollback_on_error >= 0) - SPRINTF_FIXED(protocol_and, "7.4-%d", ci->rollback_on_error); - else - STRCPY_FIXED(protocol_and, "7.4"); - olen = snprintf( - &connect_string[hlen], nlen, - ";" INI_READONLY "=%s;" INI_PROTOCOL "=%s;" INI_FAKEOIDINDEX - "=%s;" INI_SHOWOIDCOLUMN "=%s;" INI_ROWVERSIONING - "=%s;" INI_SHOWSYSTEMTABLES - "=%s;" - "%s" /* INI_CONNSETTINGS */ - INI_FETCH "=%d;" INI_UNKNOWNSIZES "=%d;" INI_MAXVARCHARSIZE - "=%d;" INI_MAXLONGVARCHARSIZE "=%d;" INI_DEBUG "=%d;" INI_COMMLOG - "=%d;" INI_USEDECLAREFETCH "=%d;" INI_TEXTASLONGVARCHAR - "=%d;" INI_UNKNOWNSASLONGVARCHAR "=%d;" INI_BOOLSASCHAR - "=%d;" INI_PARSE "=%d;" INI_EXTRASYSTABLEPREFIXES - "=%s;" INI_LFCONVERSION "=%d;" INI_UPDATABLECURSORS - "=%d;" INI_TRUEISMINUS1 "=%d;" INI_INT8AS - "=%d;" INI_BYTEAASLONGVARBINARY "=%d;" INI_USESERVERSIDEPREPARE - "=%d;" INI_LOWERCASEIDENTIFIER - "=%d;" - "%s" /* INI_ESOPT */ - "%s" /* INIKEEPALIVE TIME/INTERVAL */ - INI_NUMERIC_AS "=%d;" -#ifdef _HANDLE_ENLIST_IN_DTC_ - INI_XAOPT "=%d" /* XAOPT */ -#endif /* _HANDLE_ENLIST_IN_DTC_ */ - , - ci->onlyread, protocol_and, ci->fake_oid_index, ci->show_oid_column, - ci->row_versioning, ci->show_system_tables, - makeBracketConnectString(ci->conn_settings_in_str, &connsetStr, - ci->conn_settings, INI_CONNSETTINGS), - ci->drivers.fetch_max, ci->drivers.unknown_sizes, - ci->drivers.max_varchar_size, ci->drivers.max_longvarchar_size, - ci->drivers.debug, ci->drivers.commlog, - ci->drivers.use_declarefetch, ci->drivers.text_as_longvarchar, - ci->drivers.unknowns_as_longvarchar, ci->drivers.bools_as_char, - ci->drivers.parse, ci->drivers.extra_systable_prefixes, - ci->lf_conversion, ci->allow_keyset, ci->true_is_minus1, - ci->int8_as, ci->bytea_as_longvarbinary, - ci->use_server_side_prepare, ci->lower_case_identifier, - makeBracketConnectString(ci->esopt_in_str, &esoptStr, ci->esopt, - INI_ESOPT), - makeKeepaliveConnectString(keepaliveStr, sizeof(keepaliveStr), ci, - FALSE), - ci->numeric_as -#ifdef _HANDLE_ENLIST_IN_DTC_ - , - ci->xa_opt -#endif /* _HANDLE_ENLIST_IN_DTC_ */ - ); - } - /* Abbreviation is needed ? */ - if (abbrev || olen >= nlen || olen < 0) { - flag = 0; - if (ci->allow_keyset) - flag |= BIT_UPDATABLECURSORS; - if (ci->lf_conversion) - flag |= BIT_LFCONVERSION; - if (ci->drivers.unique_index) - flag |= BIT_UNIQUEINDEX; - switch (ci->drivers.unknown_sizes) { - case UNKNOWNS_AS_DONTKNOW: - flag |= BIT_UNKNOWN_DONTKNOW; - break; - case UNKNOWNS_AS_MAX: - flag |= BIT_UNKNOWN_ASMAX; - break; - } - if (ci->drivers.commlog) - flag |= BIT_COMMLOG; - if (ci->drivers.debug) - flag |= BIT_DEBUG; - if (ci->drivers.parse) - flag |= BIT_PARSE; - if (ci->drivers.use_declarefetch) - flag |= BIT_USEDECLAREFETCH; - if (ci->onlyread[0] == '1') - flag |= BIT_READONLY; - if (ci->drivers.text_as_longvarchar) - flag |= BIT_TEXTASLONGVARCHAR; - if (ci->drivers.unknowns_as_longvarchar) - flag |= BIT_UNKNOWNSASLONGVARCHAR; - if (ci->drivers.bools_as_char) - flag |= BIT_BOOLSASCHAR; - if (ci->row_versioning[0] == '1') - flag |= BIT_ROWVERSIONING; - if (ci->show_system_tables[0] == '1') - flag |= BIT_SHOWSYSTEMTABLES; - if (ci->show_oid_column[0] == '1') - flag |= BIT_SHOWOIDCOLUMN; - if (ci->fake_oid_index[0] == '1') - flag |= BIT_FAKEOIDINDEX; - if (ci->true_is_minus1) - flag |= BIT_TRUEISMINUS1; - if (ci->bytea_as_longvarbinary) - flag |= BIT_BYTEAASLONGVARBINARY; - if (ci->use_server_side_prepare) - flag |= BIT_USESERVERSIDEPREPARE; - if (ci->lower_case_identifier) - flag |= BIT_LOWERCASEIDENTIFIER; - - hlen = strlen(connect_string); - nlen = MAX_CONNECT_STRING - hlen; - olen = snprintf( - &connect_string[hlen], nlen, - ";" - "%s" /* ABBR_CONNSETTINGS */ - ABBR_FETCH "=%d;" ABBR_MAXVARCHARSIZE "=%d;" ABBR_MAXLONGVARCHARSIZE - "=%d;" INI_INT8AS "=%d;" ABBR_EXTRASYSTABLEPREFIXES - "=%s;" - "%s" /* ABBR_ESOPT */ - "%s" /* ABBRKEEPALIVE TIME/INTERVAL */ - INI_NUMERIC_AS - "=%d;" -#ifdef _HANDLE_ENLIST_IN_DTC_ - "%s" -#endif /* _HANDLE_ENLIST_IN_DTC_ */ - INI_ABBREVIATE "=%02x%x", - makeBracketConnectString(ci->conn_settings_in_str, &connsetStr, - ci->conn_settings, ABBR_CONNSETTINGS), - ci->drivers.fetch_max, ci->drivers.max_varchar_size, - ci->drivers.max_longvarchar_size, ci->int8_as, - ci->drivers.extra_systable_prefixes, - makeBracketConnectString(ci->esopt_in_str, &esoptStr, ci->esopt, - ABBR_ESOPT), - makeKeepaliveConnectString(keepaliveStr, sizeof(keepaliveStr), ci, - TRUE), - ci->numeric_as, -#ifdef _HANDLE_ENLIST_IN_DTC_ - makeXaOptConnectString(xaOptStr, sizeof(xaOptStr), ci, TRUE), -#endif /* _HANDLE_ENLIST_IN_DTC_ */ - EFFECTIVE_BIT_COUNT, flag); - if (olen < nlen || ci->rollback_on_error >= 0) { - hlen = strlen(connect_string); - nlen = MAX_CONNECT_STRING - hlen; - /* - * The PROTOCOL setting must be placed after CX flag - * so that this option can override the CX setting. - */ - if (ci->rollback_on_error >= 0) - olen = snprintf(&connect_string[hlen], nlen, - ";" ABBR_PROTOCOL "=7.4-%d", - ci->rollback_on_error); - else - olen = snprintf(&connect_string[hlen], nlen, - ";" ABBR_PROTOCOL "=7.4"); - } - } - if (olen < nlen) { - flag = getExtraOptions(ci); - if (0 != flag) { - hlen = strlen(connect_string); - nlen = MAX_CONNECT_STRING - hlen; - olen = snprintf(&connect_string[hlen], nlen, - ";" INI_EXTRAOPTIONS "=%x;", flag); - } - } if (olen < 0 || olen >= nlen) /* failed */ connect_string[0] = '\0'; @@ -448,53 +120,6 @@ void makeConnectString(char *connect_string, const ConnInfo *ci, UWORD len) { #pragma clang diagnostic pop #endif // __APPLE__ -static void unfoldCXAttribute(ConnInfo *ci, const char *value) { - int count; - UInt4 flag; - - if (strlen(value) < 2) { - count = 3; - sscanf(value, "%x", &flag); - } else { - char cnt[8]; - memcpy(cnt, value, 2); - cnt[2] = '\0'; - sscanf(cnt, "%x", &count); - sscanf(value + 2, "%x", &flag); - } - ci->allow_keyset = (char)((flag & BIT_UPDATABLECURSORS) != 0); - ci->lf_conversion = (char)((flag & BIT_LFCONVERSION) != 0); - if (count < 4) - return; - ci->drivers.unique_index = (char)((flag & BIT_UNIQUEINDEX) != 0); - if ((flag & BIT_UNKNOWN_DONTKNOW) != 0) - ci->drivers.unknown_sizes = UNKNOWNS_AS_DONTKNOW; - else if ((flag & BIT_UNKNOWN_ASMAX) != 0) - ci->drivers.unknown_sizes = UNKNOWNS_AS_MAX; - else - ci->drivers.unknown_sizes = UNKNOWNS_AS_LONGEST; - ci->drivers.commlog = (char)((flag & BIT_COMMLOG) != 0); - ci->drivers.debug = (char)((flag & BIT_DEBUG) != 0); - ci->drivers.parse = (char)((flag & BIT_PARSE) != 0); - ci->drivers.use_declarefetch = (char)((flag & BIT_USEDECLAREFETCH) != 0); - ITOA_FIXED(ci->onlyread, (char)((flag & BIT_READONLY) != 0)); - ci->drivers.text_as_longvarchar = - (char)((flag & BIT_TEXTASLONGVARCHAR) != 0); - ci->drivers.unknowns_as_longvarchar = - (char)((flag & BIT_UNKNOWNSASLONGVARCHAR) != 0); - ci->drivers.bools_as_char = (char)((flag & BIT_BOOLSASCHAR) != 0); - ITOA_FIXED(ci->row_versioning, (char)((flag & BIT_ROWVERSIONING) != 0)); - ITOA_FIXED(ci->show_system_tables, - (char)((flag & BIT_SHOWSYSTEMTABLES) != 0)); - ITOA_FIXED(ci->show_oid_column, (char)((flag & BIT_SHOWOIDCOLUMN) != 0)); - ITOA_FIXED(ci->fake_oid_index, (char)((flag & BIT_FAKEOIDINDEX) != 0)); - ci->true_is_minus1 = (char)((flag & BIT_TRUEISMINUS1) != 0); - ci->bytea_as_longvarbinary = (char)((flag & BIT_BYTEAASLONGVARBINARY) != 0); - ci->use_server_side_prepare = - (char)((flag & BIT_USESERVERSIDEPREPARE) != 0); - ci->lower_case_identifier = (char)((flag & BIT_LOWERCASEIDENTIFIER) != 0); -} - BOOL get_DSN_or_Driver(ConnInfo *ci, const char *attribute, const char *value) { BOOL found = TRUE; @@ -511,187 +136,37 @@ BOOL get_DSN_or_Driver(ConnInfo *ci, const char *attribute, const char *value) { BOOL copyConnAttributes(ConnInfo *ci, const char *attribute, const char *value) { BOOL found = TRUE, printed = FALSE; - if (stricmp(attribute, "DSN") == 0) STRCPY_FIXED(ci->dsn, value); else if (stricmp(attribute, "driver") == 0) STRCPY_FIXED(ci->drivername, value); - else if (stricmp(attribute, INI_KDESC) == 0) - STRCPY_FIXED(ci->desc, value); - else if (stricmp(attribute, INI_DATABASE) == 0 - || stricmp(attribute, ABBR_DATABASE) == 0) - STRCPY_FIXED(ci->database, value); - else if (stricmp(attribute, INI_SERVER) == 0 - || stricmp(attribute, SPEC_SERVER) == 0) + else if (stricmp(attribute, INI_SERVER) == 0) STRCPY_FIXED(ci->server, value); - else if (stricmp(attribute, INI_USERNAME) == 0 - || stricmp(attribute, INI_UID) == 0) + else if (stricmp(attribute, INI_PORT) == 0) + STRCPY_FIXED(ci->port, value); + else if (stricmp(attribute, INI_USERNAME) == 0) STRCPY_FIXED(ci->username, value); - else if (stricmp(attribute, INI_TIMEOUT) == 0) - STRCPY_FIXED(ci->response_timeout, value); - else if (stricmp(attribute, INI_SSL_CERTIFICATE) == 0) - STRCPY_FIXED(ci->certificate, value); - else if (stricmp(attribute, INI_SSL_KEY) == 0) - STRCPY_FIXED(ci->key, value); - else if (stricmp(attribute, INI_AUTH_MODE) == 0) - STRCPY_FIXED(ci->authtype, value); - else if (stricmp(attribute, INI_REGION) == 0) - STRCPY_FIXED(ci->region, value); - else if (stricmp(attribute, INI_PASSWORD) == 0 - || stricmp(attribute, "pwd") == 0) { + else if (stricmp(attribute, INI_PASSWORD) == 0) { ci->password = decode_or_remove_braces(value); #ifndef FORCE_PASSWORDE_DISPLAY MYLOG(0, "key='%s' value='xxxxxxxx'\n", attribute); printed = TRUE; #endif - } else if (stricmp(attribute, INI_PORT) == 0) - STRCPY_FIXED(ci->port, value); - else if (stricmp(attribute, INI_READONLY) == 0 - || stricmp(attribute, ABBR_READONLY) == 0) - STRCPY_FIXED(ci->onlyread, value); + } + else if (stricmp(attribute, INI_AUTH_MODE) == 0) + STRCPY_FIXED(ci->authtype, value); + else if (stricmp(attribute, INI_REGION) == 0) + STRCPY_FIXED(ci->region, value); else if (stricmp(attribute, INI_SSL_USE) == 0) ci->use_ssl = (char)atoi(value); - else if (stricmp(attribute, INI_SSL_VERIFY_SERVER) == 0) + else if (stricmp(attribute, INI_SSL_HOST_VERIFY) == 0) ci->verify_server = (char)atoi(value); - else if (stricmp(attribute, INI_PROTOCOL) == 0 - || stricmp(attribute, ABBR_PROTOCOL) == 0) { - char *ptr; - /* - * The first part of the Protocol used to be "6.2", "6.3" or - * "7.4" to denote which protocol version to use. Nowadays we - * only support the 7.4 protocol, also known as the protocol - * version 3. So just ignore the first part of the string, - * parsing only the rollback_on_error value. - */ - ptr = strchr(value, '-'); - if (ptr) { - if ('-' != *value) { - *ptr = '\0'; - /* ignore first part */ - } - ci->rollback_on_error = (char)atoi(ptr + 1); - MYLOG(0, "key='%s' value='%s' rollback_on_error=%d\n", attribute, - value, ci->rollback_on_error); - printed = TRUE; - } - } else if (stricmp(attribute, INI_SHOWOIDCOLUMN) == 0 - || stricmp(attribute, ABBR_SHOWOIDCOLUMN) == 0) - STRCPY_FIXED(ci->show_oid_column, value); - else if (stricmp(attribute, INI_FAKEOIDINDEX) == 0 - || stricmp(attribute, ABBR_FAKEOIDINDEX) == 0) - STRCPY_FIXED(ci->fake_oid_index, value); - else if (stricmp(attribute, INI_ROWVERSIONING) == 0 - || stricmp(attribute, ABBR_ROWVERSIONING) == 0) - STRCPY_FIXED(ci->row_versioning, value); - else if (stricmp(attribute, INI_SHOWSYSTEMTABLES) == 0 - || stricmp(attribute, ABBR_SHOWSYSTEMTABLES) == 0) - STRCPY_FIXED(ci->show_system_tables, value); - else if (stricmp(attribute, INI_CONNSETTINGS) == 0 - || stricmp(attribute, ABBR_CONNSETTINGS) == 0) { - /* We can use the conn_settings directly when they are enclosed with - * braces */ - ci->conn_settings_in_str = TRUE; - ci->conn_settings = decode_or_remove_braces(value); - } else if ((stricmp(attribute, INI_ESOPT) == 0) - || (stricmp(attribute, ABBR_ESOPT) == 0)) { - ci->esopt_in_str = TRUE; - ci->esopt = decode_or_remove_braces(value); - } else if (stricmp(attribute, INI_UPDATABLECURSORS) == 0 - || stricmp(attribute, ABBR_UPDATABLECURSORS) == 0) - ci->allow_keyset = (char)atoi(value); - else if (stricmp(attribute, INI_LFCONVERSION) == 0 - || stricmp(attribute, ABBR_LFCONVERSION) == 0) - ci->lf_conversion = (char)atoi(value); - else if (stricmp(attribute, INI_TRUEISMINUS1) == 0 - || stricmp(attribute, ABBR_TRUEISMINUS1) == 0) - ci->true_is_minus1 = (char)atoi(value); - else if (stricmp(attribute, INI_INT8AS) == 0) - ci->int8_as = (char)atoi(value); - else if (stricmp(attribute, INI_NUMERIC_AS) == 0) - ci->numeric_as = (char)atoi(value); - else if (stricmp(attribute, INI_BYTEAASLONGVARBINARY) == 0 - || stricmp(attribute, ABBR_BYTEAASLONGVARBINARY) == 0) - ci->bytea_as_longvarbinary = (char)atoi(value); - else if (stricmp(attribute, INI_USESERVERSIDEPREPARE) == 0 - || stricmp(attribute, ABBR_USESERVERSIDEPREPARE) == 0) - ci->use_server_side_prepare = (char)atoi(value); - else if (stricmp(attribute, INI_LOWERCASEIDENTIFIER) == 0 - || stricmp(attribute, ABBR_LOWERCASEIDENTIFIER) == 0) - ci->lower_case_identifier = (char)atoi(value); - else if (stricmp(attribute, INI_KEEPALIVETIME) == 0 - || stricmp(attribute, ABBR_KEEPALIVETIME) == 0) - ci->keepalive_idle = atoi(value); - else if (stricmp(attribute, INI_KEEPALIVEINTERVAL) == 0 - || stricmp(attribute, ABBR_KEEPALIVEINTERVAL) == 0) - ci->keepalive_interval = atoi(value); - else if (stricmp(attribute, INI_ABBREVIATE) == 0) - unfoldCXAttribute(ci, value); -#ifdef _HANDLE_ENLIST_IN_DTC_ - else if (stricmp(attribute, INI_XAOPT) == 0) - ci->xa_opt = atoi(value); -#endif /* _HANDLE_ENLIST_IN_DTC_ */ - else if (stricmp(attribute, INI_EXTRAOPTIONS) == 0) { - UInt4 val1 = 0, val2 = 0; - - if ('+' == value[0]) { - sscanf(value + 1, "%x-%x", &val1, &val2); - add_removeExtraOptions(ci, val1, val2); - } else if ('-' == value[0]) { - sscanf(value + 1, "%x", &val2); - add_removeExtraOptions(ci, 0, val2); - } else { - setExtraOptions(ci, value, hex_format); - } - MYLOG(0, - "key='%s' value='%s'(force_abbrev=%d bde=%d cvt_null_date=%x)\n", - attribute, value, ci->force_abbrev_connstr, ci->bde_environment, - ci->cvt_null_date_string); - printed = TRUE; - } - - else if (stricmp(attribute, INI_FETCH) == 0 - || stricmp(attribute, ABBR_FETCH) == 0) - ci->drivers.fetch_max = atoi(value); - else if (stricmp(attribute, INI_DEBUG) == 0 - || stricmp(attribute, ABBR_DEBUG) == 0) - ci->drivers.debug = (char)atoi(value); - else if (stricmp(attribute, INI_COMMLOG) == 0 - || stricmp(attribute, ABBR_COMMLOG) == 0) - ci->drivers.commlog = (char)atoi(value); - /* - * else if (stricmp(attribute, INI_UNIQUEINDEX) == 0 || - * stricmp(attribute, "UIX") == 0) ci->drivers.unique_index = - * atoi(value); - */ - else if (stricmp(attribute, INI_UNKNOWNSIZES) == 0 - || stricmp(attribute, ABBR_UNKNOWNSIZES) == 0) - ci->drivers.unknown_sizes = atoi(value); - else if (stricmp(attribute, INI_LIE) == 0) - ci->drivers.lie = (char)atoi(value); - else if (stricmp(attribute, INI_PARSE) == 0 - || stricmp(attribute, ABBR_PARSE) == 0) - ci->drivers.parse = (char)atoi(value); - else if (stricmp(attribute, INI_USEDECLAREFETCH) == 0 - || stricmp(attribute, ABBR_USEDECLAREFETCH) == 0) - ci->drivers.use_declarefetch = (char)atoi(value); - else if (stricmp(attribute, INI_MAXVARCHARSIZE) == 0 - || stricmp(attribute, ABBR_MAXVARCHARSIZE) == 0) - ci->drivers.max_varchar_size = atoi(value); - else if (stricmp(attribute, INI_MAXLONGVARCHARSIZE) == 0 - || stricmp(attribute, ABBR_MAXLONGVARCHARSIZE) == 0) - ci->drivers.max_longvarchar_size = atoi(value); - else if (stricmp(attribute, INI_TEXTASLONGVARCHAR) == 0 - || stricmp(attribute, ABBR_TEXTASLONGVARCHAR) == 0) - ci->drivers.text_as_longvarchar = (char)atoi(value); - else if (stricmp(attribute, INI_UNKNOWNSASLONGVARCHAR) == 0 - || stricmp(attribute, ABBR_UNKNOWNSASLONGVARCHAR) == 0) - ci->drivers.unknowns_as_longvarchar = (char)atoi(value); - else if (stricmp(attribute, INI_BOOLSASCHAR) == 0 - || stricmp(attribute, ABBR_BOOLSASCHAR) == 0) - ci->drivers.bools_as_char = (char)atoi(value); - else if (stricmp(attribute, INI_EXTRASYSTABLEPREFIXES) == 0 - || stricmp(attribute, ABBR_EXTRASYSTABLEPREFIXES) == 0) - STRCPY_FIXED(ci->drivers.extra_systable_prefixes, value); + else if (stricmp(attribute, INI_LOG_LEVEL) == 0) + ci->drivers.loglevel = (char)atoi(value); + else if (stricmp(attribute, INI_LOG_OUTPUT) == 0) + STRCPY_FIXED(ci->drivers.output_dir, value); + else if (stricmp(attribute, INI_TIMEOUT) == 0) + STRCPY_FIXED(ci->response_timeout, value); else found = FALSE; @@ -703,48 +178,20 @@ BOOL copyConnAttributes(ConnInfo *ci, const char *attribute, } static void getCiDefaults(ConnInfo *ci) { - MYLOG(0, "entering\n"); - - ci->drivers.debug = DEFAULT_DEBUG; - ci->drivers.commlog = DEFAULT_COMMLOG; + strncpy(ci->desc, DEFAULT_DESC, MEDIUM_REGISTRY_LEN); + strncpy(ci->drivername, DEFAULT_DRIVERNAME, MEDIUM_REGISTRY_LEN); + strncpy(ci->server, DEFAULT_HOST, MEDIUM_REGISTRY_LEN); + strncpy(ci->port, DEFAULT_PORT, SMALL_REGISTRY_LEN); + strncpy(ci->response_timeout, DEFAULT_RESPONSE_TIMEOUT_STR, SMALL_REGISTRY_LEN); + strncpy(ci->authtype, DEFAULT_AUTHTYPE, MEDIUM_REGISTRY_LEN); + if(ci->password.name != NULL) + ci->password.name = _strdup(""); + ci->password.name = NULL; + strncpy(ci->username, DEFAULT_USERNAME, MEDIUM_REGISTRY_LEN); + strncpy(ci->region, DEFAULT_REGION, MEDIUM_REGISTRY_LEN); ci->use_ssl = DEFAULT_USE_SSL; ci->verify_server = DEFAULT_VERIFY_SERVER; - ci->trust_self_signed = DEFAULT_TRUST_SELF_SIGNED; - strcpy(ci->authtype, DEFAULT_AUTH_MODE); - strcpy(ci->region, DEFAULT_REGION); - strcpy(ci->certificate, DEFAULT_CERTIFICATE); - strcpy(ci->key, DEFAULT_KEY); - ITOA_FIXED(ci->onlyread, DEFAULT_READONLY); - ITOA_FIXED(ci->fake_oid_index, DEFAULT_FAKEOIDINDEX); - ITOA_FIXED(ci->show_oid_column, DEFAULT_SHOWOIDCOLUMN); - ITOA_FIXED(ci->show_system_tables, DEFAULT_SHOWSYSTEMTABLES); - ITOA_FIXED(ci->row_versioning, DEFAULT_ROWVERSIONING); - ci->allow_keyset = DEFAULT_UPDATABLECURSORS; - ci->lf_conversion = DEFAULT_LFCONVERSION; - ci->true_is_minus1 = DEFAULT_TRUEISMINUS1; - ci->int8_as = DEFAULT_INT8AS; - ci->numeric_as = DEFAULT_NUMERIC_AS; - ci->bytea_as_longvarbinary = DEFAULT_BYTEAASLONGVARBINARY; - ci->use_server_side_prepare = DEFAULT_USESERVERSIDEPREPARE; - ci->lower_case_identifier = DEFAULT_LOWERCASEIDENTIFIER; - ci->force_abbrev_connstr = 0; - ci->fake_mss = 0; - ci->bde_environment = 0; - ci->cvt_null_date_string = 0; - ci->accessible_only = 0; - ci->ignore_round_trip_time = 0; - ci->disable_keepalive = 0; - { - const char *p; - - ci->wcs_debug = 0; - if (NULL != (p = getenv("ELASTICSEARCHODBC_WCS_DEBUG"))) - if (strcmp(p, "1") == 0) - ci->wcs_debug = 1; - } -#ifdef _HANDLE_ENLIST_IN_DTC_ - ci->xa_opt = DEFAULT_XAOPT; -#endif /* _HANDLE_ENLIST_IN_DTC_ */ + strcpy(ci->drivers.output_dir, "C:\\"); } #ifdef __APPLE__ @@ -774,29 +221,7 @@ int getDriverNameFromDSN(const char *dsn, char *driver_name, int namelen) { #endif // __APPLE__ } -static void Global_defset(GLOBAL_VALUES *comval) { - comval->fetch_max = FETCH_MAX; - comval->unique_index = DEFAULT_UNIQUEINDEX; - comval->unknown_sizes = DEFAULT_UNKNOWNSIZES; - comval->lie = DEFAULT_LIE; - comval->parse = DEFAULT_PARSE; - comval->use_declarefetch = DEFAULT_USEDECLAREFETCH; - comval->max_varchar_size = MAX_VARCHAR_SIZE; - comval->max_longvarchar_size = TEXT_FIELD_SIZE; - comval->text_as_longvarchar = DEFAULT_TEXTASLONGVARCHAR; - comval->unknowns_as_longvarchar = DEFAULT_UNKNOWNSASLONGVARCHAR; - comval->bools_as_char = DEFAULT_BOOLSASCHAR; - STRCPY_FIXED(comval->extra_systable_prefixes, - DEFAULT_EXTRASYSTABLEPREFIXES); - STRCPY_FIXED(comval->protocol, DEFAULT_PROTOCOL); -} - -static void get_Ci_Drivers(const char *section, const char *filename, - GLOBAL_VALUES *comval); - void getDriversDefaults(const char *drivername, GLOBAL_VALUES *comval) { - MYLOG(0, "%p of the driver %s\n", comval, NULL_IF_NULL(drivername)); - get_Ci_Drivers(drivername, ODBCINST_INI, comval); if (NULL != drivername) STR_TO_NAME(comval->drivername, drivername); } @@ -805,14 +230,6 @@ void getDSNinfo(ConnInfo *ci, const char *configDrvrname) { char *DSN = ci->dsn; char temp[LARGE_REGISTRY_LEN]; const char *drivername; - - /* - * If a driver keyword was present, then dont use a DSN and return. - * If DSN is null and no driver, then use the default datasource. - */ - MYLOG(0, "entering DSN=%s driver=%s&%s\n", DSN, ci->drivername, - NULL_IF_NULL(configDrvrname)); - getCiDefaults(ci); drivername = ci->drivername; if (DSN[0] == '\0') { @@ -828,7 +245,7 @@ void getDSNinfo(ConnInfo *ci, const char *configDrvrname) { /* brute-force chop off trailing blanks... */ while (*(DSN + strlen(DSN) - 1) == ' ') *(DSN + strlen(DSN) - 1) = '\0'; - + if (!drivername[0] && DSN[0]) getDriverNameFromDSN(DSN, (char *)drivername, sizeof(ci->drivername)); MYLOG(0, "drivername=%s\n", drivername); @@ -840,249 +257,51 @@ void getDSNinfo(ConnInfo *ci, const char *configDrvrname) { return; /* Proceed with getting info for the given DSN. */ - - SQLGetPrivateProfileString(DSN, INI_KDESC, NULL_STRING, ci->desc, - sizeof(ci->desc), ODBC_INI); - if (SQLGetPrivateProfileString(DSN, INI_SERVER, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0) STRCPY_FIXED(ci->server, temp); - - if (SQLGetPrivateProfileString(DSN, INI_DATABASE, NULL_STRING, temp, + if (SQLGetPrivateProfileString(DSN, INI_PORT, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0) - STRCPY_FIXED(ci->database, temp); - + STRCPY_FIXED(ci->port, temp); if (SQLGetPrivateProfileString(DSN, INI_USERNAME, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0) STRCPY_FIXED(ci->username, temp); - - if (SQLGetPrivateProfileString(DSN, INI_REGION, NULL_STRING, temp, + if (SQLGetPrivateProfileString(DSN, INI_PASSWORD, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0) - STRCPY_FIXED(ci->region, temp); - - if (SQLGetPrivateProfileString(DSN, INI_AUTH_MODE, NULL_STRING, temp, + ci->password = decode(temp); + if (SQLGetPrivateProfileString(DSN, INI_AUTH_MODE, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0) STRCPY_FIXED(ci->authtype, temp); - - if (SQLGetPrivateProfileString(DSN, INI_TIMEOUT, NULL_STRING, temp, + if (SQLGetPrivateProfileString(DSN, INI_REGION, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0) - STRCPY_FIXED(ci->response_timeout, temp); - + STRCPY_FIXED(ci->region, temp); if (SQLGetPrivateProfileString(DSN, INI_SSL_USE, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0) ci->use_ssl = (char)atoi(temp); - - if (SQLGetPrivateProfileString(DSN, INI_SSL_VERIFY_SERVER, NULL_STRING, - temp, sizeof(temp), ODBC_INI) - > 0) - ci->verify_server = (char)atoi(temp); - - if (SQLGetPrivateProfileString(DSN, INI_TIMEOUT, NULL_STRING, temp, + if (SQLGetPrivateProfileString(DSN, INI_SSL_HOST_VERIFY, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0) - STRCPY_FIXED(ci->response_timeout, temp); - - if (SQLGetPrivateProfileString(DSN, INI_PASSWORD, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - ci->password = decode(temp); - - if (SQLGetPrivateProfileString(DSN, INI_PORT, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - STRCPY_FIXED(ci->port, temp); - - /* It's appropriate to handle debug and commlog here */ - if (SQLGetPrivateProfileString(DSN, INI_DEBUG, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - ci->drivers.debug = (char)atoi(temp); - if (SQLGetPrivateProfileString(DSN, INI_COMMLOG, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - ci->drivers.commlog = (char)atoi(temp); - - if (SQLGetPrivateProfileString(DSN, INI_READONLY, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - STRCPY_FIXED(ci->onlyread, temp); - - if (SQLGetPrivateProfileString(DSN, INI_SHOWOIDCOLUMN, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - STRCPY_FIXED(ci->show_oid_column, temp); - - if (SQLGetPrivateProfileString(DSN, INI_FAKEOIDINDEX, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - STRCPY_FIXED(ci->fake_oid_index, temp); - - if (SQLGetPrivateProfileString(DSN, INI_ROWVERSIONING, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - STRCPY_FIXED(ci->row_versioning, temp); - - if (SQLGetPrivateProfileString(DSN, INI_SHOWSYSTEMTABLES, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - STRCPY_FIXED(ci->show_system_tables, temp); - - SQLGetPrivateProfileString(DSN, INI_PROTOCOL, ENTRY_TEST, temp, - sizeof(temp), ODBC_INI); - if (strcmp(temp, ENTRY_TEST)) /* entry exists */ - { - char *ptr; - - if (ptr = strchr(temp, '-'), NULL != ptr) { - *ptr = '\0'; - ci->rollback_on_error = (char)atoi(ptr + 1); - MYLOG(0, "rollback_on_error=%d\n", ci->rollback_on_error); - } - } - - SQLGetPrivateProfileString(DSN, INI_CONNSETTINGS, ENTRY_TEST, temp, - sizeof(temp), ODBC_INI); - if (strcmp(temp, ENTRY_TEST)) /* entry exists */ - { - const UCHAR *ptr; - BOOL percent_encoded = TRUE, pspace; - int nspcnt; - - /* - * percent-encoding was used before. - * Note that there's no space in percent-encoding. - */ - for (ptr = (UCHAR *)temp, pspace = TRUE, nspcnt = 0; *ptr; ptr++) { - if (isspace(*ptr)) - pspace = TRUE; - else { - if (pspace) { - if (nspcnt++ > 1) { - percent_encoded = FALSE; - break; - } - } - pspace = FALSE; - } - } - if (percent_encoded) - ci->conn_settings = decode(temp); - else - STRX_TO_NAME(ci->conn_settings, temp); - } - SQLGetPrivateProfileString(DSN, INI_ESOPT, ENTRY_TEST, temp, sizeof(temp), - ODBC_INI); - if (strcmp(temp, ENTRY_TEST)) /* entry exists */ - STRX_TO_NAME(ci->esopt, temp); - - if (SQLGetPrivateProfileString(DSN, INI_TRANSLATIONDLL, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - STRCPY_FIXED(ci->translation_dll, temp); - - if (SQLGetPrivateProfileString(DSN, INI_TRANSLATIONOPTION, NULL_STRING, - temp, sizeof(temp), ODBC_INI) - > 0) - STRCPY_FIXED(ci->translation_option, temp); - - if (SQLGetPrivateProfileString(DSN, INI_UPDATABLECURSORS, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - ci->allow_keyset = (char)atoi(temp); - - if (SQLGetPrivateProfileString(DSN, INI_LFCONVERSION, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - ci->lf_conversion = (char)atoi(temp); - - if (SQLGetPrivateProfileString(DSN, INI_TRUEISMINUS1, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - ci->true_is_minus1 = (char)atoi(temp); - - if (SQLGetPrivateProfileString(DSN, INI_INT8AS, NULL_STRING, temp, + ci->verify_server = (char)atoi(temp); + if (SQLGetPrivateProfileString(DSN, INI_LOG_LEVEL, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0) - ci->int8_as = (char)atoi(temp); - - if (SQLGetPrivateProfileString(DSN, INI_NUMERIC_AS, NULL_STRING, temp, + ci->drivers.loglevel = (char)atoi(temp); + if (SQLGetPrivateProfileString(DSN, INI_LOG_OUTPUT, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0) - ci->numeric_as = (char)atoi(temp); - - if (SQLGetPrivateProfileString(DSN, INI_BYTEAASLONGVARBINARY, NULL_STRING, - temp, sizeof(temp), ODBC_INI) - > 0) - ci->bytea_as_longvarbinary = (char)atoi(temp); - - if (SQLGetPrivateProfileString(DSN, INI_USESERVERSIDEPREPARE, NULL_STRING, - temp, sizeof(temp), ODBC_INI) - > 0) - ci->use_server_side_prepare = (char)atoi(temp); - - if (SQLGetPrivateProfileString(DSN, INI_LOWERCASEIDENTIFIER, NULL_STRING, - temp, sizeof(temp), ODBC_INI) - > 0) - ci->lower_case_identifier = (char)atoi(temp); - - if (SQLGetPrivateProfileString(DSN, INI_KEEPALIVETIME, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) - if (0 == (ci->keepalive_idle = atoi(temp))) - ci->keepalive_idle = -1; - if (SQLGetPrivateProfileString(DSN, INI_KEEPALIVEINTERVAL, NULL_STRING, - temp, sizeof(temp), ODBC_INI) - > 0) - if (0 == (ci->keepalive_interval = atoi(temp))) - ci->keepalive_interval = -1; - -#ifdef _HANDLE_ENLIST_IN_DTC_ - if (SQLGetPrivateProfileString(DSN, INI_XAOPT, NULL_STRING, temp, + STRCPY_FIXED(ci->drivers.output_dir, temp); + if (SQLGetPrivateProfileString(DSN, INI_TIMEOUT, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0) - ci->xa_opt = atoi(temp); -#endif /* _HANDLE_ENLIST_IN_DTC_ */ - - /* Force abbrev connstr or bde */ - if (SQLGetPrivateProfileString(DSN, INI_EXTRAOPTIONS, NULL_STRING, temp, - sizeof(temp), ODBC_INI) - > 0) { - UInt4 val = 0; - - sscanf(temp, "%x", &val); - replaceExtraOptions(ci, val, TRUE); - MYLOG(0, "force_abbrev=%d bde=%d cvt_null_date=%d\n", - ci->force_abbrev_connstr, ci->bde_environment, - ci->cvt_null_date_string); - } - - /* Allow override of odbcinst.ini parameters here */ - get_Ci_Drivers(DSN, ODBC_INI, &(ci->drivers)); + STRCPY_FIXED(ci->response_timeout, temp); STR_TO_NAME(ci->drivers.drivername, drivername); - - MYLOG(DETAIL_LOG_LEVEL, - "DSN info: " - "DSN='%s',server='%s',port='%s',dbase='%s',user='%s',passwd='%s'\n", - DSN, ci->server, ci->port, ci->database, ci->username, - NAME_IS_VALID(ci->password) ? "xxxxx" : ""); - MYLOG(DETAIL_LOG_LEVEL, - " " - "onlyread='%s',showoid='%s',fakeoidindex='%s',showsystable='%s'\n", - ci->onlyread, ci->show_oid_column, ci->fake_oid_index, - ci->show_system_tables); - - { - MYLOG(DETAIL_LOG_LEVEL, - " translation_dll='%s',translation_option='%s'\n", - ci->translation_dll, ci->translation_option); - } } /* * This function writes any global parameters (that can be manipulated) @@ -1090,85 +309,10 @@ void getDSNinfo(ConnInfo *ci, const char *configDrvrname) { */ int write_Ci_Drivers(const char *fileName, const char *sectionName, const GLOBAL_VALUES *comval) { - char tmp[128]; - int errc = 0; - - if (stricmp(ODBCINST_INI, fileName) == 0) { - if (NULL == sectionName) - sectionName = DBMS_NAME; - } - - if (stricmp(ODBCINST_INI, fileName) == 0) - return errc; - - ITOA_FIXED(tmp, comval->commlog); - if (!SQLWritePrivateProfileString(sectionName, INI_COMMLOG, tmp, fileName)) - errc--; - - ITOA_FIXED(tmp, comval->debug); - if (!SQLWritePrivateProfileString(sectionName, INI_DEBUG, tmp, fileName)) - errc--; + UNUSED(comval, fileName, sectionName); - ITOA_FIXED(tmp, comval->fetch_max); - if (!SQLWritePrivateProfileString(sectionName, INI_FETCH, tmp, fileName)) - errc--; - - ITOA_FIXED(tmp, comval->unique_index); - if (!SQLWritePrivateProfileString(sectionName, INI_UNIQUEINDEX, tmp, - fileName)) - errc--; - - ITOA_FIXED(tmp, comval->use_declarefetch); - if (!SQLWritePrivateProfileString(sectionName, INI_USEDECLAREFETCH, tmp, - fileName)) - errc--; - - ITOA_FIXED(tmp, comval->unknown_sizes); - if (!SQLWritePrivateProfileString(sectionName, INI_UNKNOWNSIZES, tmp, - fileName)) - errc--; - - ITOA_FIXED(tmp, comval->text_as_longvarchar); - if (!SQLWritePrivateProfileString(sectionName, INI_TEXTASLONGVARCHAR, tmp, - fileName)) - errc--; - - ITOA_FIXED(tmp, comval->unknowns_as_longvarchar); - if (!SQLWritePrivateProfileString(sectionName, INI_UNKNOWNSASLONGVARCHAR, - tmp, fileName)) - errc--; - - ITOA_FIXED(tmp, comval->bools_as_char); - if (!SQLWritePrivateProfileString(sectionName, INI_BOOLSASCHAR, tmp, - fileName)) - errc--; - - ITOA_FIXED(tmp, comval->parse); - if (!SQLWritePrivateProfileString(sectionName, INI_PARSE, tmp, fileName)) - errc--; - - ITOA_FIXED(tmp, comval->max_varchar_size); - if (!SQLWritePrivateProfileString(sectionName, INI_MAXVARCHARSIZE, tmp, - fileName)) - errc--; - - ITOA_FIXED(tmp, comval->max_longvarchar_size); - if (!SQLWritePrivateProfileString(sectionName, INI_MAXLONGVARCHARSIZE, tmp, - fileName)) - errc--; - - if (!SQLWritePrivateProfileString(sectionName, INI_EXTRASYSTABLEPREFIXES, - comval->extra_systable_prefixes, - fileName)) - errc--; - - /* - * Never update the conn_setting from this module - * SQLWritePrivateProfileString(sectionName, INI_CONNSETTINGS, - * comval->conn_settings, fileName); - */ - - return errc; + // We don't need anything here + return 0; } int writeDriversDefaults(const char *drivername, const GLOBAL_VALUES *comval) { @@ -1179,208 +323,23 @@ int writeDriversDefaults(const char *drivername, const GLOBAL_VALUES *comval) { void writeDSNinfo(const ConnInfo *ci) { const char *DSN = ci->dsn; char encoded_item[MEDIUM_REGISTRY_LEN], temp[SMALL_REGISTRY_LEN]; - - SQLWritePrivateProfileString(DSN, INI_KDESC, ci->desc, ODBC_INI); - - SQLWritePrivateProfileString(DSN, INI_DATABASE, ci->database, ODBC_INI); - + SQLWritePrivateProfileString(DSN, INI_SERVER, ci->server, ODBC_INI); - SQLWritePrivateProfileString(DSN, INI_PORT, ci->port, ODBC_INI); - SQLWritePrivateProfileString(DSN, INI_USERNAME, ci->username, ODBC_INI); - SQLWritePrivateProfileString(DSN, INI_UID, ci->username, ODBC_INI); - SQLWritePrivateProfileString(DSN, INI_TIMEOUT, ci->response_timeout, - ODBC_INI); + encode(ci->password, encoded_item, sizeof(encoded_item)); + SQLWritePrivateProfileString(DSN, INI_PASSWORD, encoded_item, ODBC_INI); SQLWritePrivateProfileString(DSN, INI_AUTH_MODE, ci->authtype, ODBC_INI); SQLWritePrivateProfileString(DSN, INI_REGION, ci->region, ODBC_INI); - SQLWritePrivateProfileString(DSN, INI_SSL_CERTIFICATE, ci->certificate, - ODBC_INI); - SQLWritePrivateProfileString(DSN, INI_SSL_KEY, ci->key, ODBC_INI); - ITOA_FIXED(temp, ci->trust_self_signed); - SQLWritePrivateProfileString(DSN, INI_SSL_ALLOW_SELF_SIGNED, temp, - ODBC_INI); ITOA_FIXED(temp, ci->use_ssl); SQLWritePrivateProfileString(DSN, INI_SSL_USE, temp, ODBC_INI); ITOA_FIXED(temp, ci->verify_server); - SQLWritePrivateProfileString(DSN, INI_SSL_VERIFY_SERVER, temp, ODBC_INI); - - encode(ci->password, encoded_item, sizeof(encoded_item)); - SQLWritePrivateProfileString(DSN, INI_PASSWORD, encoded_item, ODBC_INI); - - SQLWritePrivateProfileString(DSN, INI_READONLY, ci->onlyread, ODBC_INI); - - SQLWritePrivateProfileString(DSN, INI_SHOWOIDCOLUMN, ci->show_oid_column, - ODBC_INI); - - SQLWritePrivateProfileString(DSN, INI_FAKEOIDINDEX, ci->fake_oid_index, - ODBC_INI); - - SQLWritePrivateProfileString(DSN, INI_ROWVERSIONING, ci->row_versioning, - ODBC_INI); - - SQLWritePrivateProfileString(DSN, INI_SHOWSYSTEMTABLES, - ci->show_system_tables, ODBC_INI); - - if (ci->rollback_on_error >= 0) - SPRINTF_FIXED(temp, "7.4-%d", ci->rollback_on_error); - else - STRCPY_FIXED(temp, NULL_STRING); - SQLWritePrivateProfileString(DSN, INI_PROTOCOL, temp, ODBC_INI); - - SQLWritePrivateProfileString(DSN, INI_CONNSETTINGS, - SAFE_NAME(ci->conn_settings), ODBC_INI); - - SQLWritePrivateProfileString(DSN, INI_ESOPT, SAFE_NAME(ci->esopt), + SQLWritePrivateProfileString(DSN, INI_SSL_HOST_VERIFY, temp, ODBC_INI); + ITOA_FIXED(temp, ci->drivers.loglevel); + SQLWritePrivateProfileString(DSN, INI_SSL_HOST_VERIFY, temp, ODBC_INI); + SQLWritePrivateProfileString(DSN, INI_LOG_OUTPUT, ci->drivers.output_dir, ODBC_INI); + SQLWritePrivateProfileString(DSN, INI_TIMEOUT, ci->response_timeout, ODBC_INI); - - ITOA_FIXED(temp, ci->allow_keyset); - SQLWritePrivateProfileString(DSN, INI_UPDATABLECURSORS, temp, ODBC_INI); - ITOA_FIXED(temp, ci->lf_conversion); - SQLWritePrivateProfileString(DSN, INI_LFCONVERSION, temp, ODBC_INI); - ITOA_FIXED(temp, ci->true_is_minus1); - SQLWritePrivateProfileString(DSN, INI_TRUEISMINUS1, temp, ODBC_INI); - ITOA_FIXED(temp, ci->int8_as); - SQLWritePrivateProfileString(DSN, INI_INT8AS, temp, ODBC_INI); - ITOA_FIXED(temp, ci->numeric_as); - SQLWritePrivateProfileString(DSN, INI_NUMERIC_AS, temp, ODBC_INI); - SPRINTF_FIXED(temp, "%x", getExtraOptions(ci)); - SQLWritePrivateProfileString(DSN, INI_EXTRAOPTIONS, temp, ODBC_INI); - ITOA_FIXED(temp, ci->bytea_as_longvarbinary); - SQLWritePrivateProfileString(DSN, INI_BYTEAASLONGVARBINARY, temp, ODBC_INI); - ITOA_FIXED(temp, ci->use_server_side_prepare); - SQLWritePrivateProfileString(DSN, INI_USESERVERSIDEPREPARE, temp, ODBC_INI); - ITOA_FIXED(temp, ci->lower_case_identifier); - SQLWritePrivateProfileString(DSN, INI_LOWERCASEIDENTIFIER, temp, ODBC_INI); - ITOA_FIXED(temp, ci->keepalive_idle); - SQLWritePrivateProfileString(DSN, INI_KEEPALIVETIME, temp, ODBC_INI); - ITOA_FIXED(temp, ci->keepalive_interval); - SQLWritePrivateProfileString(DSN, INI_KEEPALIVEINTERVAL, temp, ODBC_INI); -#ifdef _HANDLE_ENLIST_IN_DTC_ - ITOA_FIXED(temp, ci->xa_opt); - SQLWritePrivateProfileString(DSN, INI_XAOPT, temp, ODBC_INI); -#endif /* _HANDLE_ENLIST_IN_DTC_ */ -} - -/* - * This function reads the ODBCINST.INI portion of - * the registry and gets any driver defaults. - */ -static void get_Ci_Drivers(const char *section, const char *filename, - GLOBAL_VALUES *comval) { - char temp[256]; - BOOL inst_position = (stricmp(filename, ODBCINST_INI) == 0); - - if (0 != strcmp(ODBCINST_INI, filename)) - MYLOG(0, "setting %s position of %s(%p)\n", filename, section, comval); - - /* - * It's not appropriate to handle debug or commlog here. - * Now they are handled in getDSNinfo(). - */ - - if (inst_position) - Global_defset(comval); - if (NULL == section || strcmp(section, INVALID_DRIVER) == 0) - return; - /* - * If inst_position of xxxxxx is present(usually not present), - * it is the default of ci->drivers.xxxxxx . - */ - /* Fetch Count is stored in driver section */ - if (SQLGetPrivateProfileString(section, INI_FETCH, NULL_STRING, temp, - sizeof(temp), filename) - > 0) { - if (atoi(temp) > 0) - comval->fetch_max = atoi(temp); - } - - /* Recognize Unique Index is stored in the driver section only */ - if (SQLGetPrivateProfileString(section, INI_UNIQUEINDEX, NULL_STRING, temp, - sizeof(temp), filename) - > 0) - comval->unique_index = (char)atoi(temp); - - /* Unknown Sizes is stored in the driver section only */ - if (SQLGetPrivateProfileString(section, INI_UNKNOWNSIZES, NULL_STRING, temp, - sizeof(temp), filename) - > 0) - comval->unknown_sizes = atoi(temp); - - /* Lie about supported functions? */ - if (SQLGetPrivateProfileString(section, INI_LIE, NULL_STRING, temp, - sizeof(temp), filename) - > 0) - comval->lie = (char)atoi(temp); - - /* Parse statements */ - if (SQLGetPrivateProfileString(section, INI_PARSE, NULL_STRING, temp, - sizeof(temp), filename) - > 0) - comval->parse = (char)atoi(temp); - - /* UseDeclareFetch is stored in the driver section only */ - if (SQLGetPrivateProfileString(section, INI_USEDECLAREFETCH, NULL_STRING, - temp, sizeof(temp), filename) - > 0) - comval->use_declarefetch = (char)atoi(temp); - - /* Max Varchar Size */ - if (SQLGetPrivateProfileString(section, INI_MAXVARCHARSIZE, NULL_STRING, - temp, sizeof(temp), filename) - > 0) - comval->max_varchar_size = atoi(temp); - - /* Max TextField Size */ - if (SQLGetPrivateProfileString(section, INI_MAXLONGVARCHARSIZE, NULL_STRING, - temp, sizeof(temp), filename) - > 0) - comval->max_longvarchar_size = atoi(temp); - - /* Text As LongVarchar */ - if (SQLGetPrivateProfileString(section, INI_TEXTASLONGVARCHAR, NULL_STRING, - temp, sizeof(temp), filename) - > 0) - comval->text_as_longvarchar = (char)atoi(temp); - - /* Unknowns As LongVarchar */ - if (SQLGetPrivateProfileString(section, INI_UNKNOWNSASLONGVARCHAR, - NULL_STRING, temp, sizeof(temp), filename) - > 0) - comval->unknowns_as_longvarchar = (char)atoi(temp); - - /* Bools As Char */ - if (SQLGetPrivateProfileString(section, INI_BOOLSASCHAR, NULL_STRING, temp, - sizeof(temp), filename) - > 0) - comval->bools_as_char = (char)atoi(temp); - - /* Extra Systable prefixes */ - - /* - * Use ENTRY_TEST to distinguish between blank extra prefixes and no key - * entry - */ - SQLGetPrivateProfileString(section, INI_EXTRASYSTABLEPREFIXES, ENTRY_TEST, - temp, sizeof(temp), filename); - if (strcmp(temp, ENTRY_TEST)) - STRCPY_FIXED(comval->extra_systable_prefixes, temp); - - MYLOG(0, "comval=%p comval->extra_systable_prefixes = '%s'\n", comval, - comval->extra_systable_prefixes); - - /* Dont allow override of an override! */ - if (inst_position) { - /* - * Default state for future DSN's protocol attribute This isn't a - * real driver option YET. This is more intended for - * customization from the install. - */ - SQLGetPrivateProfileString(section, INI_PROTOCOL, ENTRY_TEST, temp, - sizeof(temp), filename); - if (strcmp(temp, ENTRY_TEST)) - STRCPY_FIXED(comval->protocol, temp); - } } static void encode(const esNAME in, char *out, int outlen) { @@ -1491,25 +450,8 @@ static esNAME decode_or_remove_braces(const char *in) { return decode(in); } -signed char ci_updatable_cursors_set(ConnInfo *ci) { - ci->updatable_cursors = DISALLOW_UPDATABLE_CURSORS; - if (ci->allow_keyset) { - if (ci->drivers.lie || !ci->drivers.use_declarefetch) - ci->updatable_cursors |= - (ALLOW_STATIC_CURSORS | ALLOW_KEYSET_DRIVEN_CURSORS - | ALLOW_BULK_OPERATIONS | SENSE_SELF_OPERATIONS); - else - ci->updatable_cursors |= - (ALLOW_STATIC_CURSORS | ALLOW_BULK_OPERATIONS - | SENSE_SELF_OPERATIONS); - } - return ci->updatable_cursors; -} - void CC_conninfo_release(ConnInfo *conninfo) { NULL_THE_NAME(conninfo->password); - NULL_THE_NAME(conninfo->conn_settings); - NULL_THE_NAME(conninfo->esopt); finalize_globals(&conninfo->drivers); } @@ -1520,45 +462,29 @@ void CC_conninfo_init(ConnInfo *conninfo, UInt4 option) { CC_conninfo_release(conninfo); memset(conninfo, 0, sizeof(ConnInfo)); - strncpy(conninfo->response_timeout, DEFAULT_RESPONSE_TIMEOUT_STR, - SMALL_REGISTRY_LEN); - strncpy(conninfo->certificate, DEFAULT_CERTIFICATE, MEDIUM_REGISTRY_LEN); - strncpy(conninfo->key, DEFAULT_KEY, MEDIUM_REGISTRY_LEN); + strncpy(conninfo->dsn, DEFAULT_DSN, MEDIUM_REGISTRY_LEN); + strncpy(conninfo->desc, DEFAULT_DESC, MEDIUM_REGISTRY_LEN); + strncpy(conninfo->drivername, DEFAULT_DRIVERNAME, MEDIUM_REGISTRY_LEN); + strncpy(conninfo->server, DEFAULT_HOST, MEDIUM_REGISTRY_LEN); + strncpy(conninfo->port, DEFAULT_PORT, SMALL_REGISTRY_LEN); + strncpy(conninfo->response_timeout, DEFAULT_RESPONSE_TIMEOUT_STR, SMALL_REGISTRY_LEN); strncpy(conninfo->authtype, DEFAULT_AUTHTYPE, MEDIUM_REGISTRY_LEN); + if(conninfo->password.name != NULL) + free(conninfo->password.name); + conninfo->password.name = _strdup(""); + strncpy(conninfo->username, DEFAULT_USERNAME, MEDIUM_REGISTRY_LEN); strncpy(conninfo->region, DEFAULT_REGION, MEDIUM_REGISTRY_LEN); conninfo->use_ssl = DEFAULT_USE_SSL; conninfo->verify_server = DEFAULT_VERIFY_SERVER; - conninfo->trust_self_signed = DEFAULT_TRUST_SELF_SIGNED; - conninfo->allow_keyset = 0; - conninfo->lf_conversion = -1; - conninfo->true_is_minus1 = -1; - conninfo->int8_as = -101; - conninfo->numeric_as = DEFAULT_NUMERIC_AS; - conninfo->bytea_as_longvarbinary = -1; - conninfo->use_server_side_prepare = -1; - conninfo->lower_case_identifier = -1; - conninfo->rollback_on_error = -1; - conninfo->force_abbrev_connstr = -1; - conninfo->bde_environment = -1; - conninfo->fake_mss = -1; - conninfo->cvt_null_date_string = -1; - conninfo->accessible_only = -1; - conninfo->ignore_round_trip_time = -1; - conninfo->disable_keepalive = -1; - conninfo->keepalive_idle = -1; - conninfo->keepalive_interval = -1; - conninfo->wcs_debug = -1; -#ifdef _HANDLE_ENLIST_IN_DTC_ - conninfo->xa_opt = -1; -#endif /* _HANDLE_ENLIST_IN_DTC_ */ + if (0 != (INIT_GLOBALS & option)) init_globals(&(conninfo->drivers)); } void init_globals(GLOBAL_VALUES *glbv) { memset(glbv, 0, sizeof(*glbv)); - glbv->debug = -1; - glbv->commlog = -1; + glbv->loglevel = DEFAULT_LOGLEVEL; + glbv->output_dir[0] = '\0'; } #define CORR_STRCPY(item) strncpy_null(to->item, from->item, sizeof(to->item)) @@ -1566,28 +492,8 @@ void init_globals(GLOBAL_VALUES *glbv) { void copy_globals(GLOBAL_VALUES *to, const GLOBAL_VALUES *from) { memset(to, 0, sizeof(*to)); - /*** - memcpy(to, from, sizeof(GLOBAL_VALUES)); - SET_NAME_DIRECTLY(to->drivername, NULL); - ***/ NAME_TO_NAME(to->drivername, from->drivername); - CORR_VALCPY(fetch_max); - CORR_VALCPY(unknown_sizes); - CORR_VALCPY(max_varchar_size); - CORR_VALCPY(max_longvarchar_size); - CORR_VALCPY(debug); - CORR_VALCPY(commlog); - CORR_VALCPY(unique_index); - CORR_VALCPY(use_declarefetch); - CORR_VALCPY(text_as_longvarchar); - CORR_VALCPY(unknowns_as_longvarchar); - CORR_VALCPY(bools_as_char); - CORR_VALCPY(lie); - CORR_VALCPY(parse); - CORR_STRCPY(extra_systable_prefixes); - CORR_STRCPY(protocol); - - MYLOG(0, "driver=%s\n", SAFE_NAME(to->drivername)); + CORR_VALCPY(loglevel); } void finalize_globals(GLOBAL_VALUES *glbv) { @@ -1601,57 +507,19 @@ void finalize_globals(GLOBAL_VALUES *glbv) { void CC_copy_conninfo(ConnInfo *ci, const ConnInfo *sci) { memset(ci, 0, sizeof(ConnInfo)); - CORR_STRCPY(dsn); CORR_STRCPY(desc); CORR_STRCPY(drivername); CORR_STRCPY(server); - CORR_STRCPY(database); CORR_STRCPY(username); CORR_STRCPY(authtype); CORR_STRCPY(region); - CORR_STRCPY(certificate); - CORR_STRCPY(key); NAME_TO_NAME(ci->password, sci->password); - CORR_VALCPY(trust_self_signed); CORR_VALCPY(use_ssl); CORR_VALCPY(verify_server); CORR_STRCPY(port); - CORR_STRCPY(onlyread); - CORR_STRCPY(fake_oid_index); - CORR_STRCPY(show_oid_column); - CORR_STRCPY(row_versioning); - CORR_STRCPY(show_system_tables); - CORR_STRCPY(translation_dll); - CORR_STRCPY(translation_option); - CORR_VALCPY(password_required); CORR_STRCPY(response_timeout); - NAME_TO_NAME(ci->conn_settings, sci->conn_settings); - CORR_VALCPY(allow_keyset); - CORR_VALCPY(updatable_cursors); - CORR_VALCPY(lf_conversion); - CORR_VALCPY(true_is_minus1); - CORR_VALCPY(int8_as); - CORR_VALCPY(numeric_as); - CORR_VALCPY(bytea_as_longvarbinary); - CORR_VALCPY(use_server_side_prepare); - CORR_VALCPY(lower_case_identifier); - CORR_VALCPY(rollback_on_error); - CORR_VALCPY(force_abbrev_connstr); - CORR_VALCPY(bde_environment); - CORR_VALCPY(fake_mss); - CORR_VALCPY(cvt_null_date_string); - CORR_VALCPY(accessible_only); - CORR_VALCPY(ignore_round_trip_time); - CORR_VALCPY(disable_keepalive); - CORR_VALCPY(extra_opts); - CORR_VALCPY(keepalive_idle); - CORR_VALCPY(keepalive_interval); -#ifdef _HANDLE_ENLIST_IN_DTC_ - CORR_VALCPY(xa_opt); -#endif - copy_globals(&(ci->drivers), - &(sci->drivers)); /* moved from driver's option */ + copy_globals(&(ci->drivers), &(sci->drivers)); } #undef CORR_STRCPY #undef CORR_VALCPY diff --git a/src/elasticodbc/dlg_specific.h b/src/elasticodbc/dlg_specific.h index aa02d496..a4be2c1c 100644 --- a/src/elasticodbc/dlg_specific.h +++ b/src/elasticodbc/dlg_specific.h @@ -51,144 +51,30 @@ extern "C" { #define INI_DSN "Elasticsearch30" #endif /* UNICODE_SUPPORT */ -#define INI_KDESC \ - "Description" /* Data source \ \ - * description */ -#define INI_SERVER \ - "Host" /* Name of Server \ \ - * running the Elasticsearch \ \ - * service */ -#define SPEC_SERVER "server" -#define INI_PORT \ - "Port" /* Port on which the \ \ - * Postmaster is listening */ -#define INI_DATABASE "Database" /* Database Name */ -#define ABBR_DATABASE "DX" /* Database Name */ -#define INI_AUTH_MODE "AuthenticationMode" /* Default Authentication Mode */ -#define INI_REGION "Region" /* Default Region */ -#define INI_UID "UID" /* Default User Name */ -#define INI_USERNAME "Username" /* Default User Name */ -#define INI_PASSWORD "Password" /* Default Password */ -#define INI_TIMEOUT "ResponseTimeout" /* Default Response Timeout */ -#define INI_SSL_USE "SSLUse" /* Default Use SSL */ -#define INI_SSL_VERIFY_SERVER "SSLVerifyServer" /* Default Verify Server */ -#define INI_SSL_ALLOW_SELF_SIGNED "SSLSelfSigned" /* Default SSL Self Signed*/ -#define INI_SSL_CERTIFICATE "SSLCertificate" /* Default SSL Certificate */ -#define INI_SSL_KEY "SSLKey" /* Default SSL Key */ - -#define INI_ABBREVIATE "CX" -#define INI_DEBUG "Debug" /* Debug flag */ -#define ABBR_DEBUG "B2" -#define INI_FETCH "Fetch" /* Fetch Max Count */ -#define ABBR_FETCH "A7" -#define INI_READONLY "ReadOnly" /* Database is read only */ -#define ABBR_READONLY "A0" -#define INI_COMMLOG \ - "CommLog" /* Communication to \ \ - * backend logging */ -#define ABBR_COMMLOG "B3" -#define INI_PROTOCOL \ - "Protocol" /* Controls rollback-on-error \ \ - * behavior. Called "Protocol" \ \ - * for historical reasons */ -#define ABBR_PROTOCOL "A1" -/* "Optimizer", abbreviated to B4 used to stand for "disable genetic query - * optimizer". No longer supported, you can use generic ConnSettings instead. -#define INI_OPTIMIZER "Optimizer" -#define ABBR_OPTIMIZER "B4" -*/ -/* "Ksqo", abbreviated to B5 was used with pre-7.1 server versions for - * "keyset query optimization". No longer used. -#define INI_KSQO "Ksqo" -#define ABBR_KSQO "B5" -*/ -#define INI_CONNSETTINGS \ - "ConnSettings" /* Anything to send to \ \ - * backend on successful \ \ - * connection */ -#define ABBR_CONNSETTINGS "A6" -#define INI_UNIQUEINDEX \ - "UniqueIndex" /* Recognize unique \ \ - * indexes */ -#define INI_UNKNOWNSIZES \ - "UnknownSizes" /* How to handle unknown \ \ - * result set sizes */ -#define ABBR_UNKNOWNSIZES "A9" - -/* "CancelAsFreeStmt", abbreviated to "C1" was used with ODBC versions older - * than 3.51. It was a hack that made SQLCancel to imply - * SQLFreeStmt(SQL_CLOSE). It never had an effect in > 3.51 mode. -#define INI_CANCELASFREESTMT "CancelAsFreeStmt" -#define ABBR_CANCELASFREESTMT "C1" -*/ -#define INI_USEDECLAREFETCH \ - "UseDeclareFetch" /* Use Declare/Fetch \ \ - * cursors */ -#define ABBR_USEDECLAREFETCH "B6" - -/* More ini stuff */ -#define INI_TEXTASLONGVARCHAR "TextAsLongVarchar" -#define ABBR_TEXTASLONGVARCHAR "B7" -#define INI_UNKNOWNSASLONGVARCHAR "UnknownsAsLongVarchar" -#define ABBR_UNKNOWNSASLONGVARCHAR "B8" -#define INI_BOOLSASCHAR "BoolsAsChar" -#define ABBR_BOOLSASCHAR "B9" -#define INI_MAXVARCHARSIZE "MaxVarcharSize" -#define ABBR_MAXVARCHARSIZE "B0" -#define INI_MAXLONGVARCHARSIZE "MaxLongVarcharSize" -#define ABBR_MAXLONGVARCHARSIZE "B1" - -#define INI_FAKEOIDINDEX "FakeOidIndex" -#define ABBR_FAKEOIDINDEX "A2" -#define INI_SHOWOIDCOLUMN "ShowOidColumn" -#define ABBR_SHOWOIDCOLUMN "A3" -#define INI_ROWVERSIONING "RowVersioning" -#define ABBR_ROWVERSIONING "A4" -#define INI_SHOWSYSTEMTABLES "ShowSystemTables" -#define ABBR_SHOWSYSTEMTABLES "A5" -#define INI_LIE "Lie" -#define INI_PARSE "Parse" -#define ABBR_PARSE "C0" -#define INI_EXTRASYSTABLEPREFIXES "ExtraSysTablePrefixes" -#define ABBR_EXTRASYSTABLEPREFIXES "C2" - -#define INI_TRANSLATIONNAME "TranslationName" -#define INI_TRANSLATIONDLL "TranslationDLL" -#define INI_TRANSLATIONOPTION "TranslationOption" -/* - * "DisallowPremature", abbreviated "C3", used to mean that we should not - * execute a statement prematurely, before SQLExecute() when e.g. - * SQLPrepare+SQLDescribeCol is called. We never do that anymore. - * -#define INI_DISALLOWPREMATURE "DisallowPremature" -#define ABBR_DISALLOWPREMATURE "C3" -*/ -#define INI_UPDATABLECURSORS "UpdatableCursors" -#define ABBR_UPDATABLECURSORS "C4" -#define INI_LFCONVERSION "LFConversion" -#define ABBR_LFCONVERSION "C5" -#define INI_TRUEISMINUS1 "TrueIsMinus1" -#define ABBR_TRUEISMINUS1 "C6" -#define INI_INT8AS "BI" -#define INI_NUMERIC_AS "D6" -#define INI_BYTEAASLONGVARBINARY "ByteaAsLongVarBinary" -#define ABBR_BYTEAASLONGVARBINARY "C7" -#define INI_USESERVERSIDEPREPARE "UseServerSidePrepare" -#define ABBR_USESERVERSIDEPREPARE "C8" -#define INI_LOWERCASEIDENTIFIER "LowerCaseIdentifier" -#define ABBR_LOWERCASEIDENTIFIER "C9" -#define INI_EXTRAOPTIONS "AB" -#define INI_LOGDIR "Logdir" -#define INI_KEEPALIVETIME "KeepaliveTime" -#define ABBR_KEEPALIVETIME "D1" -#define INI_KEEPALIVEINTERVAL "KeepaliveInterval" -#define ABBR_KEEPALIVEINTERVAL "D2" -#define INI_ESOPT "esopt" -#define ABBR_ESOPT \ - "D5" // TODO AE-170: Revise this value / consider removing if it is not - // desired -#define INI_DTCLOG "Dtclog" -#define ABBR_XAOPT "D4" +#define INI_SERVER "host" +#define INI_PORT "port" +#define INI_USERNAME "user" +#define INI_PASSWORD "password" +#define INI_AUTH_MODE "auth" +#define INI_REGION "region" +#define INI_SSL_USE "useSSL" +#define INI_SSL_HOST_VERIFY "hostnameVerification" +#define INI_LOG_LEVEL "logLevel" +#define INI_LOG_OUTPUT "logOutput" +#define INI_TIMEOUT "responseTimeout" + +#define DEFAULT_RESPONSE_TIMEOUT 10 // Seconds +#define DEFAULT_RESPONSE_TIMEOUT_STR "10" +#define DEFAULT_AUTHTYPE "NONE" +#define DEFAULT_HOST "" +#define DEFAULT_PORT "" +#define DEFAULT_USERNAME "" +#define DEFAULT_PASSWORD "" +#define DEFAULT_DRIVERNAME "" +#define DEFAULT_DESC "" +#define DEFAULT_DSN "" +#define DEFAULT_REGION "" +#define DEFAULT_VERIFY_SERVER 1 #define AUTHTYPE_NONE "NONE" #define AUTHTYPE_BASIC "BASIC" @@ -243,8 +129,7 @@ extern "C" { #define DEFAULT_UNKNOWNSASLONGVARCHAR 0 #define DEFAULT_BOOLSASCHAR 0 #define DEFAULT_UNIQUEINDEX 1 /* dont recognize */ -#define DEFAULT_COMMLOG 0 /* dont log */ -#define DEFAULT_DEBUG 0 +#define DEFAULT_LOGLEVEL 0 #define DEFAULT_USE_SSL 0 #define DEFAULT_TRUST_SELF_SIGNED 0 #define DEFAULT_AUTH_MODE "NONE" @@ -308,8 +193,6 @@ BOOL get_DSN_or_Driver(ConnInfo *ci, const char *attribute, const char *value); BOOL copyConnAttributes(ConnInfo *ci, const char *attribute, const char *value); int getDriverNameFromDSN(const char *dsn, char *driver_name, int namelen); UInt4 getExtraOptions(const ConnInfo *); -BOOL setExtraOptions(ConnInfo *, const char *str, const char *format); -signed char ci_updatable_cursors_set(ConnInfo *ci); void SetAuthenticationVisibility(HWND hdlg, const struct authmode *am); const struct authmode *GetCurrentAuthMode(HWND hdlg); diff --git a/src/elasticodbc/dlg_wingui.c b/src/elasticodbc/dlg_wingui.c index 8bddeb23..24ffbb3d 100644 --- a/src/elasticodbc/dlg_wingui.c +++ b/src/elasticodbc/dlg_wingui.c @@ -55,7 +55,6 @@ void SetAuthenticationVisibility(HWND hdlg, const struct authmode *am) { void SetDlgStuff(HWND hdlg, const ConnInfo *ci) { // Connection - SetDlgItemText(hdlg, IDC_DATABASE, ci->database); SetDlgItemText(hdlg, IDC_SERVER, ci->server); SetDlgItemText(hdlg, IDC_PORT, ci->port); SetDlgItemText(hdlg, IDC_CONNTIMEOUT, ci->response_timeout); @@ -72,11 +71,9 @@ void SetDlgStuff(HWND hdlg, const ConnInfo *ci) { ShowWindow(GetDlgItem(hdlg, IDC_CERTIFICATE_STATIC), use_ssl); ShowWindow(GetDlgItem(hdlg, IDC_KEY), use_ssl); ShowWindow(GetDlgItem(hdlg, IDC_KEY_STATIC), use_ssl); - SetDlgItemText(hdlg, IDC_CERTIFICATE, ci->certificate); - SetDlgItemText(hdlg, IDC_KEY, ci->key); // Misc - UINT log_button_checked = ci->drivers.commlog && ci->drivers.debug; + UINT log_button_checked = ci->drivers.loglevel; CheckDlgButton(hdlg, IDC_CHECK1, log_button_checked); } @@ -89,7 +86,6 @@ static void GetNameField(HWND hdlg, int item, esNAME *name) { void GetDlgStuff(HWND hdlg, ConnInfo *ci) { // Connection GetDlgItemText(hdlg, IDC_DESC, ci->desc, sizeof(ci->desc)); - GetDlgItemText(hdlg, IDC_DATABASE, ci->database, sizeof(ci->database)); GetDlgItemText(hdlg, IDC_SERVER, ci->server, sizeof(ci->server)); GetDlgItemText(hdlg, IDC_CONNTIMEOUT, ci->response_timeout, sizeof(ci->response_timeout)); @@ -109,14 +105,10 @@ void GetDlgStuff(HWND hdlg, ConnInfo *ci) { ShowWindow(GetDlgItem(hdlg, IDC_CERTIFICATE), ci->use_ssl); ShowWindow(GetDlgItem(hdlg, IDC_CERTIFICATE_STATIC), ci->use_ssl); ShowWindow(GetDlgItem(hdlg, IDC_CERTIFICATENOTE_STATIC), ci->use_ssl); - GetDlgItemText(hdlg, IDC_CERTIFICATE, ci->certificate, - sizeof(ci->certificate)); - GetDlgItemText(hdlg, IDC_KEY, ci->key, sizeof(ci->key)); // Misc - ci->drivers.commlog = ci->drivers.debug = - (IsDlgButtonChecked(hdlg, IDC_CHECK1) ? 1 : 0); - setGlobalCommlog(ci->drivers.commlog); + ci->drivers.loglevel = (IsDlgButtonChecked(hdlg, IDC_CHECK1) ? 1 : 0); + setGlobalCommlog(ci->drivers.loglevel); } const struct authmode *GetAuthModes(unsigned int *count) { diff --git a/src/elasticodbc/drvconn.c b/src/elasticodbc/drvconn.c index 0a822f1f..a35d2360 100644 --- a/src/elasticodbc/drvconn.c +++ b/src/elasticodbc/drvconn.c @@ -138,17 +138,8 @@ LRESULT CALLBACK dconn_FDriverConnectProc(HWND hdlg, UINT wMsg, WPARAM wParam, SetWindowLongPtr(hdlg, DWLP_USER, lParam); /* Save the ConnInfo for the "OK" */ SetDlgStuff(hdlg, ci); - - if (ci->password_required) { - HWND notu = GetDlgItem(hdlg, IDC_NOTICE_USER); - - SetFocus(GetDlgItem(hdlg, IDC_PASSWORD)); - SetWindowText(notu, " Supply password "); - ShowWindow(notu, SW_SHOW); - SendMessage(notu, WM_CTLCOLOR, 0, 0); - } else if (ci->database[0] == '\0') - ; /* default focus */ - else if (ci->server[0] == '\0') + + if (ci->server[0] == '\0') SetFocus(GetDlgItem(hdlg, IDC_SERVER)); else if (ci->port[0] == '\0') SetFocus(GetDlgItem(hdlg, IDC_PORT)); @@ -190,19 +181,6 @@ LRESULT CALLBACK dconn_FDriverConnectProc(HWND hdlg, UINT wMsg, WPARAM wParam, case IDOK: ci = (ConnInfo *)GetWindowLongPtr(hdlg, DWLP_USER); GetDlgStuff(hdlg, ci); - - if (ci->use_ssl) { - if ((strcmp(ci->key, "") == 0) - && (strcmp(ci->certificate, "") == 0)) { - MessageBox(hdlg, - "If SSL is checked, certificate and key " - "must be provided.", - "Configuration is invalid.", - MB_ICONEXCLAMATION | MB_OK); - break; - } - } - case IDCANCEL: EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK); return TRUE; @@ -212,19 +190,6 @@ LRESULT CALLBACK dconn_FDriverConnectProc(HWND hdlg, UINT wMsg, WPARAM wParam, ConnInfo tmp_info; ci = (ConnInfo *)GetWindowLongPtr(hdlg, DWLP_USER); GetDlgStuff(hdlg, ci); - - if (ci->use_ssl) { - if ((strcmp(ci->key, "") == 0) - && (strcmp(ci->certificate, "") == 0)) { - MessageBox(hdlg, - "If SSL is checked, certificate and key " - "must be provided.", - "Configuration is invalid.", - MB_ICONEXCLAMATION | MB_OK); - break; - } - } - CC_copy_conninfo(&tmp_info, ci); test_connection(hdlg, &tmp_info, FALSE); CC_conninfo_release(&tmp_info); diff --git a/src/elasticodbc/es_api30.c b/src/elasticodbc/es_api30.c index 6857be55..b6a3956f 100644 --- a/src/elasticodbc/es_api30.c +++ b/src/elasticodbc/es_api30.c @@ -383,45 +383,10 @@ RETCODE SQL_API ESAPI_GetConnectAttr(HDBC ConnectionHandle, *((SQLUINTEGER *)Value) = conn->stmtOptions.metadata_id; break; case SQL_ATTR_ESOPT_DEBUG: - *((SQLINTEGER *)Value) = conn->connInfo.drivers.debug; + *((SQLINTEGER *)Value) = conn->connInfo.drivers.loglevel; break; case SQL_ATTR_ESOPT_COMMLOG: - *((SQLINTEGER *)Value) = conn->connInfo.drivers.commlog; - break; - case SQL_ATTR_ESOPT_PARSE: - *((SQLINTEGER *)Value) = conn->connInfo.drivers.parse; - break; - case SQL_ATTR_ESOPT_USE_DECLAREFETCH: - *((SQLINTEGER *)Value) = conn->connInfo.drivers.use_declarefetch; - break; - case SQL_ATTR_ESOPT_SERVER_SIDE_PREPARE: - *((SQLINTEGER *)Value) = conn->connInfo.use_server_side_prepare; - break; - case SQL_ATTR_ESOPT_FETCH: - *((SQLINTEGER *)Value) = conn->connInfo.drivers.fetch_max; - break; - case SQL_ATTR_ESOPT_UNKNOWNSIZES: - *((SQLINTEGER *)Value) = conn->connInfo.drivers.unknown_sizes; - break; - case SQL_ATTR_ESOPT_TEXTASLONGVARCHAR: - *((SQLINTEGER *)Value) = conn->connInfo.drivers.text_as_longvarchar; - break; - case SQL_ATTR_ESOPT_UNKNOWNSASLONGVARCHAR: - *((SQLINTEGER *)Value) = - conn->connInfo.drivers.unknowns_as_longvarchar; - break; - case SQL_ATTR_ESOPT_BOOLSASCHAR: - *((SQLINTEGER *)Value) = conn->connInfo.drivers.bools_as_char; - break; - case SQL_ATTR_ESOPT_MAXVARCHARSIZE: - *((SQLINTEGER *)Value) = conn->connInfo.drivers.max_varchar_size; - break; - case SQL_ATTR_ESOPT_MAXLONGVARCHARSIZE: - *((SQLINTEGER *)Value) = - conn->connInfo.drivers.max_longvarchar_size; - break; - case SQL_ATTR_ESOPT_MSJET: - *((SQLINTEGER *)Value) = conn->ms_jet; + *((SQLINTEGER *)Value) = conn->connInfo.drivers.loglevel; break; default: ret = ESAPI_GetConnectOption(ConnectionHandle, (UWORD)Attribute, @@ -1631,92 +1596,31 @@ RETCODE SQL_API ESAPI_SetConnectAttr(HDBC ConnectionHandle, case SQL_ATTR_ESOPT_DEBUG: newValue = CAST_UPTR(SQLCHAR, Value); if (newValue > 0) { - logs_on_off(-1, conn->connInfo.drivers.debug, 0); - conn->connInfo.drivers.debug = (char)newValue; - logs_on_off(1, conn->connInfo.drivers.debug, 0); - MYLOG(0, "debug => %d\n", conn->connInfo.drivers.debug); - } else if (newValue == 0 && conn->connInfo.drivers.debug > 0) { + 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(0, "debug => %d\n", conn->connInfo.drivers.loglevel); + } else if (newValue == 0 && conn->connInfo.drivers.loglevel > 0) { MYLOG(0, "debug => %d\n", newValue); - logs_on_off(-1, conn->connInfo.drivers.debug, 0); - conn->connInfo.drivers.debug = (char)newValue; + logs_on_off(-1, conn->connInfo.drivers.loglevel, 0); + conn->connInfo.drivers.loglevel = (char)newValue; logs_on_off(1, 0, 0); } break; case SQL_ATTR_ESOPT_COMMLOG: newValue = CAST_UPTR(SQLCHAR, Value); if (newValue > 0) { - logs_on_off(-1, 0, conn->connInfo.drivers.commlog); - conn->connInfo.drivers.commlog = (char)newValue; - logs_on_off(1, 0, conn->connInfo.drivers.commlog); - MYLOG(0, "commlog => %d\n", conn->connInfo.drivers.commlog); - } else if (newValue == 0 && conn->connInfo.drivers.commlog > 0) { + 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(0, "commlog => %d\n", conn->connInfo.drivers.loglevel); + } else if (newValue == 0 && conn->connInfo.drivers.loglevel > 0) { MYLOG(0, "commlog => %d\n", newValue); - logs_on_off(-1, 0, conn->connInfo.drivers.commlog); - conn->connInfo.drivers.debug = (char)newValue; + logs_on_off(-1, 0, conn->connInfo.drivers.loglevel); + conn->connInfo.drivers.loglevel = (char)newValue; logs_on_off(1, 0, 0); } break; - case SQL_ATTR_ESOPT_PARSE: - conn->connInfo.drivers.parse = CAST_UPTR(SQLCHAR, Value); - MYLOG(0, "parse => %d\n", conn->connInfo.drivers.parse); - break; - case SQL_ATTR_ESOPT_USE_DECLAREFETCH: - conn->connInfo.drivers.use_declarefetch = CAST_UPTR(SQLCHAR, Value); - ci_updatable_cursors_set(&conn->connInfo); - MYLOG(0, "declarefetch => %d\n", - conn->connInfo.drivers.use_declarefetch); - break; - case SQL_ATTR_ESOPT_SERVER_SIDE_PREPARE: - conn->connInfo.use_server_side_prepare = CAST_UPTR(SQLCHAR, Value); - MYLOG(0, "server_side_prepare => %d\n", - conn->connInfo.use_server_side_prepare); - break; - case SQL_ATTR_ESOPT_FETCH: - conn->connInfo.drivers.fetch_max = CAST_PTR(SQLINTEGER, Value); - MYLOG(0, "fetch => %d\n", conn->connInfo.drivers.fetch_max); - break; - case SQL_ATTR_ESOPT_UNKNOWNSIZES: - conn->connInfo.drivers.unknown_sizes = CAST_PTR(SQLINTEGER, Value); - MYLOG(0, "unknown_sizes => %d\n", - conn->connInfo.drivers.unknown_sizes); - break; - case SQL_ATTR_ESOPT_TEXTASLONGVARCHAR: - conn->connInfo.drivers.text_as_longvarchar = - CAST_PTR(SQLCHAR, Value); - MYLOG(0, "text_as_longvarchar => %d\n", - conn->connInfo.drivers.text_as_longvarchar); - break; - case SQL_ATTR_ESOPT_UNKNOWNSASLONGVARCHAR: - conn->connInfo.drivers.unknowns_as_longvarchar = - CAST_PTR(SQLCHAR, Value); - MYLOG(0, "unknowns_as_long_varchar => %d\n", - conn->connInfo.drivers.unknowns_as_longvarchar); - break; - case SQL_ATTR_ESOPT_BOOLSASCHAR: - conn->connInfo.drivers.bools_as_char = CAST_PTR(SQLCHAR, Value); - MYLOG(0, "bools_as_char => %d\n", - conn->connInfo.drivers.bools_as_char); - break; - case SQL_ATTR_ESOPT_MAXVARCHARSIZE: - conn->connInfo.drivers.max_varchar_size = - CAST_PTR(SQLINTEGER, Value); - MYLOG(0, "max_varchar_size => %d\n", - conn->connInfo.drivers.max_varchar_size); - break; - case SQL_ATTR_ESOPT_MAXLONGVARCHARSIZE: - conn->connInfo.drivers.max_longvarchar_size = - CAST_PTR(SQLINTEGER, Value); - MYLOG(0, "max_longvarchar_size => %d\n", - conn->connInfo.drivers.max_longvarchar_size); - break; - case SQL_ATTR_ESOPT_WCSDEBUG: - conn->connInfo.wcs_debug = CAST_PTR(SQLCHAR, Value); - MYLOG(0, "wcs_debug => %d\n", conn->connInfo.wcs_debug); - break; - case SQL_ATTR_ESOPT_MSJET: - conn->ms_jet = CAST_PTR(SQLCHAR, Value); - MYLOG(0, "ms_jet => %d\n", conn->ms_jet); - break; default: if (Attribute < 65536) ret = ESAPI_SetConnectOption( diff --git a/src/elasticodbc/es_connection.cpp b/src/elasticodbc/es_connection.cpp index b788403c..c8414f83 100644 --- a/src/elasticodbc/es_connection.cpp +++ b/src/elasticodbc/es_connection.cpp @@ -64,15 +64,6 @@ char CC_connect(ConnectionClass *self) { if (conn_code <= 0) return static_cast< char >(conn_code); - // Set translation and check for errors - CC_set_translation(self); - if ((CC_get_errornumber(self) > 0) || (self->status == CONN_DOWN)) { - const char *err_msg = CC_get_errormsg(self); - if (err_msg != NULL) - CC_set_error(self, -1, err_msg, "CC_connect"); - return 0; - } - // Set encodings CC_determine_locale_encoding(self); #ifdef UNICODE_SUPPORT @@ -90,10 +81,8 @@ char CC_connect(ConnectionClass *self) { } // Set cursor parameters based on connection info - ci_updatable_cursors_set(&(self->connInfo)); self->status = CONN_CONNECTED; - if ((CC_is_in_unicode_driver(self)) - && ((CC_is_in_ansi_app(self)) || (self->connInfo.bde_environment > 0))) + if ((CC_is_in_unicode_driver(self)) && (CC_is_in_ansi_app(self))) self->unicode |= CONN_DISALLOW_WCHAR; // 1 is SQL_SUCCESS and 2 is SQL_SCCUESS_WITH_INFO @@ -110,7 +99,6 @@ int LIBES_connect(ConnectionClass *self) { // Connection rt_opts.conn.server.assign(self->connInfo.server); rt_opts.conn.port.assign(self->connInfo.port); - rt_opts.conn.database.assign(self->connInfo.database); rt_opts.conn.timeout.assign(self->connInfo.response_timeout); // Authentication @@ -124,14 +112,6 @@ int LIBES_connect(ConnectionClass *self) { rt_opts.crypt.use_ssl = (self->connInfo.use_ssl == 1); // TODO AE-288: Add settings if required for Mac support - // Connect to DB with parameters - try { - if (self->connInfo.esopt_in_str) - GetElasticSpecificOpts(rt_opts, SAFE_NAME(self->connInfo.esopt)); - } catch (std::exception &e) { - CC_set_error(self, CONN_OPENDB_ERROR, e.what(), "LIBES_connect"); - return 0; - } void *esconn = ESConnectDBParams(rt_opts, FALSE, OPTION_COUNT); if (esconn == NULL) { const char *err = GetErrorMsg(esconn); diff --git a/src/elasticodbc/es_connection.h b/src/elasticodbc/es_connection.h index 048a55d9..4869d874 100644 --- a/src/elasticodbc/es_connection.h +++ b/src/elasticodbc/es_connection.h @@ -387,7 +387,6 @@ ConnectionClass *CC_Constructor(void); char CC_Destructor(ConnectionClass *self); RETCODE CC_cleanup(ConnectionClass *self, BOOL keepCommunication); BOOL CC_set_autocommit(ConnectionClass *self, BOOL on); -int CC_set_translation(ConnectionClass *self); char CC_add_statement(ConnectionClass *self, StatementClass *stmt); char CC_remove_statement(ConnectionClass *self, StatementClass *stmt); char CC_add_descriptor(ConnectionClass *self, DescriptorClass *desc); diff --git a/src/elasticodbc/es_driver_connect.cpp b/src/elasticodbc/es_driver_connect.cpp index 1ae32b55..413f4155 100644 --- a/src/elasticodbc/es_driver_connect.cpp +++ b/src/elasticodbc/es_driver_connect.cpp @@ -85,7 +85,6 @@ static RETCODE GetRequirementsAndConnect(const SQLUSMALLINT driver_completion, "ESAPI_DriverConnect->GetRequirements"); return SQL_ERROR; } - reqs = ci->password_required ? PASSWORD_IS_REQUIRED : 0; ret_val = CC_connect(conn); return SQL_SUCCESS; } @@ -173,7 +172,7 @@ static SQLRETURN SetupConnString(const SQLCHAR *conn_str_in, // Make connection string and get DSN std::unique_ptr< char, free_delete > conn_str( make_string(conn_str_in, conn_str_in_len, NULL, 0)); - + if (!dconn_get_DSN_or_Driver(conn_str.get(), ci)) { CC_set_error(conn, CONN_OPENDB_ERROR, "Connection string parse error", func); @@ -191,7 +190,7 @@ static SQLRETURN SetupConnString(const SQLCHAR *conn_str_in, func); return SQL_ERROR; } - logs_on_off(1, ci->drivers.debug, ci->drivers.commlog); + logs_on_off(1, ci->drivers.loglevel, ci->drivers.loglevel); return SQL_SUCCESS; } diff --git a/src/elasticodbc/es_helper.cpp b/src/elasticodbc/es_helper.cpp index e1480f9d..d7f7742c 100644 --- a/src/elasticodbc/es_helper.cpp +++ b/src/elasticodbc/es_helper.cpp @@ -100,15 +100,6 @@ void ESClearResult(ESResult* es_result) { delete es_result; } -void GetElasticSpecificOpts(runtime_options& rt_opts, const char* esopts) { - (void)(rt_opts); - std::string opts = esopts; - - // TODO AE-45: Parse out elastic specific runtime options - // NOTE: Throw std::exception on error - error will be propagated to - // connection class -} - // This class provides a cross platform way of entering critical sections class CriticalSectionHelper { public: diff --git a/src/elasticodbc/es_helper.h b/src/elasticodbc/es_helper.h index 32594d6b..c39de832 100644 --- a/src/elasticodbc/es_helper.h +++ b/src/elasticodbc/es_helper.h @@ -28,7 +28,6 @@ void ESClearResult(ESResult* es_result); void* ESConnectDBParams(runtime_options& rt_opts, int expand_dbname, unsigned int option_count); std::string GetServerVersion(void* es_conn); -void GetElasticSpecificOpts(runtime_options& rt_opts, const char* esopts); // C Interface extern "C" { diff --git a/src/elasticodbc/es_odbc.h b/src/elasticodbc/es_odbc.h index 975ef8c9..752b35e2 100644 --- a/src/elasticodbc/es_odbc.h +++ b/src/elasticodbc/es_odbc.h @@ -530,21 +530,8 @@ typedef struct { typedef struct GlobalValues_ { esNAME drivername; - int fetch_max; - int unknown_sizes; - int max_varchar_size; - int max_longvarchar_size; - char debug; - char commlog; - char unique_index; - char use_declarefetch; - char text_as_longvarchar; - char unknowns_as_longvarchar; - char bools_as_char; - char lie; - char parse; - char extra_systable_prefixes[MEDIUM_REGISTRY_LEN]; - char protocol[SMALL_REGISTRY_LEN]; + char output_dir[LARGE_REGISTRY_LEN]; + char loglevel; } GLOBAL_VALUES; void copy_globals(GLOBAL_VALUES *to, const GLOBAL_VALUES *from); @@ -621,73 +608,34 @@ void logs_on_off(int cnopen, int, int); 8192 /* this seems sufficiently big for \ \ * queries used in info.c inoue \ \ * 2001/05/17 */ -#define DEFAULT_RESPONSE_TIMEOUT 10 // Seconds -#define DEFAULT_RESPONSE_TIMEOUT_STR "10" -#define DEFAULT_AUTHTYPE "NONE" -#define DEFAULT_VERIFY_SERVER 1 #define LENADDR_SHIFT(x, sft) ((x) ? (SQLLEN *)((char *)(x) + (sft)) : NULL) /* Structure to hold all the connection attributes for a specific connection (used for both registry and file, DSN and DRIVER) */ -// TODO: STrip out unused entries typedef struct { + // Connection char dsn[MEDIUM_REGISTRY_LEN]; char desc[MEDIUM_REGISTRY_LEN]; char drivername[MEDIUM_REGISTRY_LEN]; char server[MEDIUM_REGISTRY_LEN]; - char database[MEDIUM_REGISTRY_LEN]; + char port[SMALL_REGISTRY_LEN]; + char response_timeout[SMALL_REGISTRY_LEN]; + + // Authentication char authtype[MEDIUM_REGISTRY_LEN]; char username[MEDIUM_REGISTRY_LEN]; esNAME password; char region[MEDIUM_REGISTRY_LEN]; + + // Encryption char use_ssl; char verify_server; - char trust_self_signed; - char certificate[MEDIUM_REGISTRY_LEN]; - char key[MEDIUM_REGISTRY_LEN]; - char port[SMALL_REGISTRY_LEN]; - char onlyread[SMALL_REGISTRY_LEN]; - char fake_oid_index[SMALL_REGISTRY_LEN]; - char show_oid_column[SMALL_REGISTRY_LEN]; - char row_versioning[SMALL_REGISTRY_LEN]; - char show_system_tables[SMALL_REGISTRY_LEN]; - char translation_dll[MEDIUM_REGISTRY_LEN]; - char translation_option[SMALL_REGISTRY_LEN]; - char response_timeout[SMALL_REGISTRY_LEN]; - char password_required; - char conn_settings_in_str; - char esopt_in_str; - esNAME conn_settings; - esNAME esopt; - signed char allow_keyset; - signed char updatable_cursors; - signed char lf_conversion; - signed char true_is_minus1; - signed char int8_as; - signed char bytea_as_longvarbinary; - signed char use_server_side_prepare; - signed char lower_case_identifier; - signed char rollback_on_error; - signed char force_abbrev_connstr; - signed char bde_environment; - signed char fake_mss; - signed char cvt_null_date_string; - signed char accessible_only; - signed char ignore_round_trip_time; - signed char disable_keepalive; - signed char wcs_debug; - signed char numeric_as; - UInt4 extra_opts; - Int4 keepalive_idle; - Int4 keepalive_interval; -#ifdef _HANDLE_ENLIST_IN_DTC_ - signed char xa_opt; -#endif /* _HANDLE_ENLIST_IN_DTC_ */ + GLOBAL_VALUES drivers; /* moved from driver's option */ } ConnInfo; -#define SUPPORT_DESCRIBE_PARAM(conninfo_) (conninfo_->use_server_side_prepare) +#define SUPPORT_DESCRIBE_PARAM(conninfo_) (1) int initialize_global_cs(void); enum { /* CC_conninfo_init option */ diff --git a/src/elasticodbc/es_odbc.rc b/src/elasticodbc/es_odbc.rc index 78e9ac55..76b03aa2 100644 --- a/src/elasticodbc/es_odbc.rc +++ b/src/elasticodbc/es_odbc.rc @@ -7,7 +7,10 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" +#include "winresrc.h" +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif #include "version.h" ///////////////////////////////////////////////////////////////////////////// diff --git a/src/elasticodbc/es_statement.cpp b/src/elasticodbc/es_statement.cpp index fcd1d84e..4ad8aad0 100644 --- a/src/elasticodbc/es_statement.cpp +++ b/src/elasticodbc/es_statement.cpp @@ -171,7 +171,6 @@ RETCODE RePrepareStatement(StatementClass *stmt) { RETCODE PrepareStatement(StatementClass *stmt, const SQLCHAR *stmt_str, SQLINTEGER stmt_sz) { CSTR func = "PrepareStatement"; - const ConnectionClass *conn = SC_get_conn(stmt); RETCODE result = SC_initialize_and_recycle(stmt); if (result != SQL_SUCCESS) return result; @@ -190,14 +189,6 @@ RETCODE PrepareStatement(StatementClass *stmt, const SQLCHAR *stmt_str, stmt->status = STMT_FINISHED; stmt->statement_type = (short)statement_type(stmt->statement); - /* Check if connection is onlyread (only selects are allowed) */ - if (CC_is_onlyread(conn) && STMT_UPDATE(stmt)) { - SC_set_error( - stmt, STMT_EXEC_ERROR, - "Connection is readonly, only select statements are allowed.", - func); - return SQL_ERROR; - } return SQL_SUCCESS; } diff --git a/src/elasticodbc/es_types.c b/src/elasticodbc/es_types.c index d893f4d0..525f9f55 100644 --- a/src/elasticodbc/es_types.c +++ b/src/elasticodbc/es_types.c @@ -45,53 +45,6 @@ SQLSMALLINT ansi_to_wtype(const ConnectionClass *self, SQLSMALLINT ansitype) { #endif /* UNICODE_SUPPORT */ } -Int4 getCharColumnSize(const StatementClass *stmt, OID type, int col, - int handle_unknown_size_as); - -/* - * these are the types we support. all of the estype_ functions should - * return values for each one of these. - * Even types not directly supported are handled as character types - * so all types should work (points, etc.) - */ - -/* - * ALL THESE TYPES ARE NO LONGER REPORTED in SQLGetTypeInfo. Instead, all - * the SQL TYPES are reported and mapped to a corresponding Elasticsearch Type - */ - -/* -OID es_types_defined[][2] = { - {ES_TYPE_CHAR, 0} - ,{ES_TYPE_CHAR2, 0} - ,{ES_TYPE_CHAR4, 0} - ,{ES_TYPE_CHAR8, 0} - ,{ES_TYPE_CHAR16, 0} - ,{ES_TYPE_NAME, 0} - ,{ES_TYPE_VARCHAR, 0} - ,{ES_TYPE_BPCHAR, 0} - ,{ES_TYPE_DATE, 0} - ,{ES_TYPE_TIME, 0} - ,{ES_TYPE_TIME_WITH_TMZONE, 0} - ,{ES_TYPE_DATETIME, 0} - ,{ES_TYPE_ABSTIME, 0} - ,{ES_TYPE_TIMESTAMP_NO_TMZONE, 0} - ,{ES_TYPE_TIMESTAMP, 0} - ,{ES_TYPE_TEXT, 0} - ,{ES_TYPE_INT2, 0} - ,{ES_TYPE_INT4, 0} - ,{ES_TYPE_FLOAT4, 0} - ,{ES_TYPE_FLOAT8, 0} - ,{ES_TYPE_OID, 0} - ,{ES_TYPE_MONEY, 0} - ,{ES_TYPE_BOOL, 0} - ,{ES_TYPE_BYTEA, 0} - ,{ES_TYPE_NUMERIC, 0} - ,{ES_TYPE_XID, 0} - ,{ES_TYPE_LO_UNDEFINED, 0} - ,{0, 0} }; -*/ - /* These are NOW the SQL Types reported in SQLGetTypeInfo. */ SQLSMALLINT sqlTypes[] = { SQL_BIGINT, @@ -138,105 +91,14 @@ OID es_true_type(const ConnectionClass *conn, OID type, OID basetype) { #define MINUTE_BIT (1 << 27) #define SECOND_BIT (1 << 28) -#ifdef ES_INTERVAL_AS_SQL_INTERVAL -static SQLSMALLINT get_interval_type(Int4 atttypmod, const char **name) { - MYLOG(0, "entering atttypmod=%x\n", atttypmod); - if ((-1) == atttypmod) - return 0; - if (0 != (YEAR_BIT & atttypmod)) { - if (0 != (MONTH_BIT & atttypmod)) { - if (name) - *name = "interval year to month"; - return SQL_INTERVAL_YEAR_TO_MONTH; - } - if (name) - *name = "interval year"; - return SQL_INTERVAL_YEAR; - } else if (0 != (MONTH_BIT & atttypmod)) { - if (name) - *name = "interval month"; - return SQL_INTERVAL_MONTH; - } else if (0 != (DAY_BIT & atttypmod)) { - if (0 != (SECOND_BIT & atttypmod)) { - if (name) - *name = "interval day to second"; - return SQL_INTERVAL_DAY_TO_SECOND; - } else if (0 != (MINUTE_BIT & atttypmod)) { - if (name) - *name = "interval day to minute"; - return SQL_INTERVAL_DAY_TO_MINUTE; - } else if (0 != (HOUR_BIT & atttypmod)) { - if (name) - *name = "interval day to hour"; - return SQL_INTERVAL_DAY_TO_HOUR; - } - if (name) - *name = "interval day"; - return SQL_INTERVAL_DAY; - } else if (0 != (HOUR_BIT & atttypmod)) { - if (0 != (SECOND_BIT & atttypmod)) { - if (name) - *name = "interval hour to second"; - return SQL_INTERVAL_HOUR_TO_SECOND; - } else if (0 != (MINUTE_BIT & atttypmod)) { - if (name) - *name = "interval hour to minute"; - return SQL_INTERVAL_HOUR_TO_MINUTE; - } - if (name) - *name = "interval hour"; - return SQL_INTERVAL_HOUR; - } else if (0 != (MINUTE_BIT & atttypmod)) { - if (0 != (SECOND_BIT & atttypmod)) { - if (name) - *name = "interval minute to second"; - return SQL_INTERVAL_MINUTE_TO_SECOND; - } - if (name) - *name = "interval minute"; - return SQL_INTERVAL_MINUTE; - } else if (0 != (SECOND_BIT & atttypmod)) { - if (name) - *name = "interval second"; - return SQL_INTERVAL_SECOND; - } - - if (name) - *name = "interval"; - return 0; -} -#endif // ES_INTERVAL_AS_SQL_INTERVAL - static Int4 getCharColumnSizeX(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as) { int p = -1, maxsize; - const ConnInfo *ci = &(conn->connInfo); - MYLOG(0, "entering type=%d, atttypmod=%d, adtsize_or=%d, unknown = %d\n", type, atttypmod, adtsize_or_longestlen, handle_unknown_size_as); - /* Assign Maximum size based on parameters */ - switch (type) { - case ES_TYPE_TEXT: - if (ci->drivers.text_as_longvarchar) - maxsize = ci->drivers.max_longvarchar_size; - else - maxsize = ci->drivers.max_varchar_size; - break; - - case ES_TYPE_VARCHAR: - case ES_TYPE_BPCHAR: - maxsize = ci->drivers.max_varchar_size; - break; - - default: - if (ci->drivers.unknowns_as_longvarchar) - maxsize = ci->drivers.max_longvarchar_size; - else - maxsize = ci->drivers.max_varchar_size; - break; - } + maxsize = MAX_VARCHAR_SIZE; #ifdef UNICODE_SUPPORT if (CC_is_in_unicode_driver(conn) && isSqlServr() && maxsize > 4000) maxsize = 4000; @@ -330,21 +192,12 @@ static SQLSMALLINT getNumericDecimalDigitsX(const ConnectionClass *conn, static Int4 /* Elasticsearch restritiction */ getNumericColumnSizeX(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longest, int handle_unknown_size_as) { + UNUSED(conn); Int4 default_column_size = 28; - const ConnInfo *ci = &(conn->connInfo); - MYLOG(0, "entering type=%d, typmod=%d\n", type, atttypmod); if (atttypmod > -1) return (atttypmod >> 16) & 0xffff; - switch (ci->numeric_as) { - case SQL_VARCHAR: - return ci->drivers.max_varchar_size; - case SQL_LONGVARCHAR: - return ci->drivers.max_longvarchar_size; - case SQL_DOUBLE: - return ES_DOUBLE_DIGITS; - } switch (handle_unknown_size_as) { case UNKNOWNS_AS_DONTKNOW: return SQL_NO_TOTAL; @@ -387,7 +240,6 @@ SQLSMALLINT estype_attr_to_concise_type(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as) { - const ConnInfo *ci = &(conn->connInfo); EnvironmentClass *env = (EnvironmentClass *)CC_get_env(conn); #ifdef ES_INTERVAL_AS_SQL_INTERVAL SQLSMALLINT sqltype; @@ -406,7 +258,7 @@ estype_attr_to_concise_type(const ConnectionClass *conn, OID type, case ES_TYPE_VARCHAR: if (getCharColumnSizeX(conn, type, atttypmod, adtsize_or_longestlen, handle_unknown_size_as) - > ci->drivers.max_varchar_size) + > MAX_VARCHAR_SIZE) bLongVarchar = TRUE; else bLongVarchar = FALSE; @@ -414,23 +266,19 @@ estype_attr_to_concise_type(const ConnectionClass *conn, OID type, ? SQL_LONGVARCHAR : (bFixed ? SQL_CHAR : SQL_VARCHAR)); case ES_TYPE_TEXT: - bLongVarchar = ci->drivers.text_as_longvarchar; + bLongVarchar = DEFAULT_TEXTASLONGVARCHAR; if (bLongVarchar) { int column_size = getCharColumnSizeX(conn, type, atttypmod, adtsize_or_longestlen, handle_unknown_size_as); - if (column_size > 0 - && column_size <= ci->drivers.max_varchar_size) + if (column_size > 0 && column_size <= MAX_VARCHAR_SIZE) bLongVarchar = FALSE; } return ansi_to_wtype(conn, bLongVarchar ? SQL_LONGVARCHAR : SQL_VARCHAR); case ES_TYPE_BYTEA: - if (ci->bytea_as_longvarbinary) - return SQL_LONGVARBINARY; - else - return SQL_VARBINARY; + return SQL_VARBINARY; case ES_TYPE_LO_UNDEFINED: return SQL_LONGVARBINARY; @@ -444,15 +292,11 @@ estype_attr_to_concise_type(const ConnectionClass *conn, OID type, /* Change this to SQL_BIGINT for ODBC v3 bjm 2001-01-23 */ case ES_TYPE_INT8: - if (ci->int8_as != 0) - return ci->int8_as; if (conn->ms_jet) return SQL_NUMERIC; /* maybe a little better than SQL_VARCHAR */ return SQL_BIGINT; case ES_TYPE_NUMERIC: - if (-1 == atttypmod && DEFAULT_NUMERIC_AS != ci->numeric_as) - return ci->numeric_as; return SQL_NUMERIC; case ES_TYPE_FLOAT4: @@ -477,7 +321,7 @@ estype_attr_to_concise_type(const ConnectionClass *conn, OID type, case ES_TYPE_MONEY: return SQL_FLOAT; case ES_TYPE_BOOL: - return ci->drivers.bools_as_char ? SQL_VARCHAR : SQL_BIT; + return SQL_BIT; case ES_TYPE_XML: return ansi_to_wtype(conn, SQL_LONGVARCHAR); case ES_TYPE_INET: @@ -505,13 +349,13 @@ estype_attr_to_concise_type(const ConnectionClass *conn, OID type, if (type == (OID)conn->lobj_type) return SQL_LONGVARBINARY; - bLongVarchar = ci->drivers.unknowns_as_longvarchar; + bLongVarchar = DEFAULT_UNKNOWNSASLONGVARCHAR; if (bLongVarchar) { int column_size = getCharColumnSizeX(conn, type, atttypmod, adtsize_or_longestlen, handle_unknown_size_as); if (column_size > 0 - && column_size <= ci->drivers.max_varchar_size) + && column_size <= MAX_VARCHAR_SIZE) bLongVarchar = FALSE; } #ifdef EXPERIMENTAL_CURRENTLY @@ -554,7 +398,6 @@ estype_attr_to_datetime_sub(const ConnectionClass *conn, OID type, SQLSMALLINT estype_attr_to_ctype(const ConnectionClass *conn, OID type, int atttypmod) { UNUSED(atttypmod); - const ConnInfo *ci = &(conn->connInfo); EnvironmentClass *env = (EnvironmentClass *)CC_get_env(conn); #ifdef ES_INTERVAL_AS_SQL_INTERVAL SQLSMALLINT ctype; @@ -596,7 +439,7 @@ estype_attr_to_ctype(const ConnectionClass *conn, OID type, int atttypmod) { case ES_TYPE_MONEY: return SQL_C_FLOAT; case ES_TYPE_BOOL: - return ci->drivers.bools_as_char ? SQL_C_CHAR : SQL_C_BIT; + return SQL_C_BIT; case ES_TYPE_BYTEA: return SQL_C_BINARY; @@ -848,12 +691,12 @@ Int4 estype_attr_buffer_length(const ConnectionClass *conn, OID type, return prec * WCLEN; #endif /* UNICODE_SUPPORT */ coef = conn->mb_maxbyte_per_char; - if (coef < 2 && (conn->connInfo).lf_conversion) + if (coef < 2) /* CR -> CR/LF */ coef = 2; if (coef == 1) return prec; - maxvarc = conn->connInfo.drivers.max_varchar_size; + maxvarc = MAX_VARCHAR_SIZE; if (prec <= maxvarc && prec * coef > maxvarc) return maxvarc; return coef * prec; @@ -994,12 +837,12 @@ Int4 estype_attr_transfer_octet_length(const ConnectionClass *conn, OID type, return column_size * WCLEN; #endif /* UNICODE_SUPPORT */ coef = conn->mb_maxbyte_per_char; - if (coef < 2 && (conn->connInfo).lf_conversion) + if (coef < 2) /* CR -> CR/LF */ coef = 2; if (coef == 1) return column_size; - maxvarc = conn->connInfo.drivers.max_varchar_size; + maxvarc = MAX_VARCHAR_SIZE; if (column_size <= maxvarc && column_size * coef > maxvarc) return maxvarc; return coef * column_size; @@ -1083,10 +926,7 @@ const char *sqltype_to_escast(const ConnectionClass *conn, } OID sqltype_to_estype(const ConnectionClass *conn, SQLSMALLINT fSqlType) { - OID esType; - const ConnInfo *ci = &(conn->connInfo); - - esType = 0; /* ??? */ + OID esType = 0; switch (fSqlType) { case SQL_BINARY: esType = ES_TYPE_BYTEA; @@ -1130,21 +970,16 @@ OID sqltype_to_estype(const ConnectionClass *conn, SQLSMALLINT fSqlType) { break; case SQL_LONGVARBINARY: - if (ci->bytea_as_longvarbinary) - esType = ES_TYPE_BYTEA; - else - esType = conn->lobj_type; + esType = conn->lobj_type; break; case SQL_LONGVARCHAR: - esType = ci->drivers.text_as_longvarchar ? ES_TYPE_TEXT - : ES_TYPE_VARCHAR; + esType = ES_TYPE_VARCHAR; break; #ifdef UNICODE_SUPPORT case SQL_WLONGVARCHAR: - esType = ci->drivers.text_as_longvarchar ? ES_TYPE_TEXT - : ES_TYPE_VARCHAR; + esType = ES_TYPE_VARCHAR; break; #endif /* UNICODE_SUPPORT */ diff --git a/src/elasticodbc/es_types.h b/src/elasticodbc/es_types.h index 6f47d9c1..613c171b 100644 --- a/src/elasticodbc/es_types.h +++ b/src/elasticodbc/es_types.h @@ -250,7 +250,6 @@ typedef struct encryption_options { typedef struct connection_options { std::string server; std::string port; - std::string database; std::string timeout; } connection_options; diff --git a/src/elasticodbc/info.c b/src/elasticodbc/info.c index 4647e236..e0498654 100644 --- a/src/elasticodbc/info.c +++ b/src/elasticodbc/info.c @@ -74,7 +74,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, break; case SQL_ACCESSIBLE_TABLES: /* ODBC 1.0 */ - p = CC_accessible_only(conn) ? "Y" : "N"; + p = "N"; break; case SQL_ACTIVE_CONNECTIONS: /* ODBC 1.0 */ @@ -167,10 +167,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, case SQL_CURSOR_ROLLBACK_BEHAVIOR: /* ODBC 1.0 */ len = 2; - if (!ci->drivers.use_declarefetch) - value = SQL_CB_PRESERVE; - else - value = SQL_CB_CLOSE; + value = SQL_CB_PRESERVE; break; case SQL_DATA_SOURCE_NAME: /* ODBC 1.0 */ @@ -178,7 +175,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, break; case SQL_DATA_SOURCE_READ_ONLY: /* ODBC 1.0 */ - p = CC_is_onlyread(conn) ? "Y" : "N"; + p = "Y"; break; case SQL_DATABASE_NAME: /* Support for old ODBC 1.0 Apps */ @@ -194,28 +191,12 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, break; case SQL_DBMS_NAME: /* ODBC 1.0 */ - if (CC_fake_mss(conn)) - p = "Microsoft SQL Server"; - else - p = "Elasticsearch"; + p = "Elasticsearch"; break; case SQL_DBMS_VER: /* ODBC 1.0 */ - - /* - * The ODBC spec wants ##.##.#### ...whatever... so prepend - * the driver - */ - /* version number to the dbms version string */ - /* - SPRINTF_FIXED(tmp, "%s %s", ELASTICDRIVERVERSION, conn->es_version); - tmp[sizeof(tmp) - 1] = '\0'; */ - if (CC_fake_mss(conn)) - p = "09.00.1399"; - else { - STRCPY_FIXED(tmp, conn->es_version); - p = tmp; - } + STRCPY_FIXED(tmp, conn->es_version); + p = tmp; break; case SQL_DEFAULT_TXN_ISOLATION: /* ODBC 1.0 */ @@ -291,10 +272,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, case SQL_LOCK_TYPES: /* ODBC 2.0 */ len = 4; - value = - ci->drivers.lie - ? (SQL_LCK_NO_CHANGE | SQL_LCK_EXCLUSIVE | SQL_LCK_UNLOCK) - : SQL_LCK_NO_CHANGE; + value = SQL_LCK_NO_CHANGE; break; case SQL_MAX_BINARY_LITERAL_LEN: /* ODBC 2.0 */ @@ -491,16 +469,11 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, case SQL_POS_OPERATIONS: /* ODBC 2.0 */ len = 4; value = (SQL_POS_POSITION | SQL_POS_REFRESH); - if (0 != ci->updatable_cursors) - value |= (SQL_POS_UPDATE | SQL_POS_DELETE | SQL_POS_ADD); break; case SQL_POSITIONED_STATEMENTS: /* ODBC 2.0 */ len = 4; - value = ci->drivers.lie - ? (SQL_PS_POSITIONED_DELETE | SQL_PS_POSITIONED_UPDATE - | SQL_PS_SELECT_FOR_UPDATE) - : 0; + value = 0; break; case SQL_PROCEDURE_TERM: /* ODBC 1.0 */ @@ -520,10 +493,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, break; case SQL_QUALIFIER_NAME_SEPARATOR: /* ODBC 1.0 */ - if (CurrCat(conn)) - p = "."; - else - p = NULL_STRING; + p = "."; break; case SQL_QUALIFIER_TERM: /* ODBC 1.0 */ @@ -535,10 +505,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, case SQL_QUALIFIER_USAGE: /* ODBC 2.0 */ len = 4; - if (CurrCat(conn)) - value = SQL_CU_DML_STATEMENTS; - else - value = 0; + value = SQL_CU_DML_STATEMENTS; break; case SQL_QUOTED_IDENTIFIER_CASE: /* ODBC 2.0 */ @@ -553,25 +520,17 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, * Driver doesn't support keyset-driven or mixed cursors, so * not much point in saying row updates are supported */ - p = (0 != ci->updatable_cursors) ? "Y" : "N"; + p = "N"; break; case SQL_SCROLL_CONCURRENCY: /* ODBC 1.0 */ len = 4; value = SQL_SCCO_READ_ONLY; - if (0 != ci->updatable_cursors) - value |= SQL_SCCO_OPT_ROWVER; - if (ci->drivers.lie) - value |= (SQL_SCCO_LOCK | SQL_SCCO_OPT_VALUES); break; case SQL_SCROLL_OPTIONS: /* ODBC 1.0 */ len = 4; value = SQL_SO_FORWARD_ONLY | SQL_SO_STATIC; - if (0 != (ci->updatable_cursors & ALLOW_KEYSET_DRIVEN_CURSORS)) - value |= SQL_SO_KEYSET_DRIVEN; - if (ci->drivers.lie) - value |= (SQL_SO_DYNAMIC | SQL_SO_MIXED); break; case SQL_SEARCH_PATTERN_ESCAPE: /* ODBC 1.0 */ @@ -589,8 +548,6 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, case SQL_STATIC_SENSITIVITY: /* ODBC 2.0 */ len = 4; value = 0; - if (0 != ci->updatable_cursors) - value |= (SQL_SS_ADDITIONS | SQL_SS_DELETIONS | SQL_SS_UPDATES); break; case SQL_STRING_FUNCTIONS: /* ODBC 1.0 */ @@ -669,47 +626,17 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, break; case SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2: len = 4; - value = SQL_CA2_READ_ONLY_CONCURRENCY; - if (!ci->drivers.use_declarefetch || ci->drivers.lie) - value |= SQL_CA2_CRC_EXACT; + value = SQL_CA2_READ_ONLY_CONCURRENCY | SQL_CA2_CRC_EXACT; break; case SQL_KEYSET_CURSOR_ATTRIBUTES1: len = 4; value = SQL_CA1_NEXT | SQL_CA1_ABSOLUTE | SQL_CA1_RELATIVE | SQL_CA1_BOOKMARK | SQL_CA1_LOCK_NO_CHANGE | SQL_CA1_POS_POSITION | SQL_CA1_POS_REFRESH; - if (0 != (ci->updatable_cursors & ALLOW_KEYSET_DRIVEN_CURSORS)) - value |= (SQL_CA1_POS_UPDATE | SQL_CA1_POS_DELETE - | SQL_CA1_BULK_ADD | SQL_CA1_BULK_UPDATE_BY_BOOKMARK - | SQL_CA1_BULK_DELETE_BY_BOOKMARK - | SQL_CA1_BULK_FETCH_BY_BOOKMARK); - if (ci->drivers.lie) - value |= - (SQL_CA1_LOCK_EXCLUSIVE | SQL_CA1_LOCK_UNLOCK - | SQL_CA1_POSITIONED_UPDATE | SQL_CA1_POSITIONED_DELETE - | SQL_CA1_SELECT_FOR_UPDATE); break; case SQL_KEYSET_CURSOR_ATTRIBUTES2: len = 4; - value = SQL_CA2_READ_ONLY_CONCURRENCY; - if (0 != (ci->updatable_cursors & ALLOW_KEYSET_DRIVEN_CURSORS)) - value |= (SQL_CA2_OPT_ROWVER_CONCURRENCY - /*| SQL_CA2_CRC_APPROXIMATE*/ - ); - if (0 != (ci->updatable_cursors & SENSE_SELF_OPERATIONS)) - value |= - (SQL_CA2_SENSITIVITY_DELETIONS | SQL_CA2_SENSITIVITY_UPDATES - | SQL_CA2_SENSITIVITY_ADDITIONS); - if (!ci->drivers.use_declarefetch || ci->drivers.lie) - value |= SQL_CA2_CRC_EXACT; - if (ci->drivers.lie) - value |= - (SQL_CA2_LOCK_CONCURRENCY | SQL_CA2_OPT_VALUES_CONCURRENCY - | SQL_CA2_MAX_ROWS_SELECT | SQL_CA2_MAX_ROWS_INSERT - | SQL_CA2_MAX_ROWS_DELETE | SQL_CA2_MAX_ROWS_UPDATE - | SQL_CA2_MAX_ROWS_CATALOG | SQL_CA2_MAX_ROWS_AFFECTS_ALL - | SQL_CA2_SIMULATE_NON_UNIQUE | SQL_CA2_SIMULATE_TRY_UNIQUE - | SQL_CA2_SIMULATE_UNIQUE); + value = SQL_CA2_READ_ONLY_CONCURRENCY | SQL_CA2_CRC_EXACT; break; case SQL_STATIC_CURSOR_ATTRIBUTES1: @@ -717,31 +644,15 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, value = SQL_CA1_NEXT | SQL_CA1_ABSOLUTE | SQL_CA1_RELATIVE | SQL_CA1_BOOKMARK | SQL_CA1_LOCK_NO_CHANGE | SQL_CA1_POS_POSITION | SQL_CA1_POS_REFRESH; - if (0 != (ci->updatable_cursors & ALLOW_STATIC_CURSORS)) - value |= (SQL_CA1_POS_UPDATE | SQL_CA1_POS_DELETE); - if (0 != (ci->updatable_cursors & ALLOW_BULK_OPERATIONS)) - value |= (SQL_CA1_BULK_ADD | SQL_CA1_BULK_UPDATE_BY_BOOKMARK - | SQL_CA1_BULK_DELETE_BY_BOOKMARK - | SQL_CA1_BULK_FETCH_BY_BOOKMARK); break; case SQL_STATIC_CURSOR_ATTRIBUTES2: len = 4; - value = SQL_CA2_READ_ONLY_CONCURRENCY; - if (0 != (ci->updatable_cursors & ALLOW_STATIC_CURSORS)) - value |= (SQL_CA2_OPT_ROWVER_CONCURRENCY); - if (0 != (ci->updatable_cursors & SENSE_SELF_OPERATIONS)) - value |= - (SQL_CA2_SENSITIVITY_DELETIONS | SQL_CA2_SENSITIVITY_UPDATES - | SQL_CA2_SENSITIVITY_ADDITIONS); - if (!ci->drivers.use_declarefetch || ci->drivers.lie) - value |= (SQL_CA2_CRC_EXACT); + value = SQL_CA2_READ_ONLY_CONCURRENCY | SQL_CA2_CRC_EXACT; break; case SQL_ODBC_INTERFACE_CONFORMANCE: len = 4; value = SQL_OIC_CORE; - if (ci->drivers.lie) - value = SQL_OIC_LEVEL2; break; case SQL_ACTIVE_ENVIRONMENTS: len = 2; @@ -1050,9 +961,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, RETCODE SQL_API ESAPI_GetFunctions(HDBC hdbc, SQLUSMALLINT fFunction, SQLUSMALLINT *pfExists) { - ConnectionClass *conn = (ConnectionClass *)hdbc; - ConnInfo *ci = &(conn->connInfo); - + UNUSED(hdbc); MYLOG(0, "entering...%u\n", fFunction); if (fFunction == SQL_API_ALL_FUNCTIONS) { @@ -1125,176 +1034,169 @@ RETCODE SQL_API ESAPI_GetFunctions(HDBC hdbc, SQLUSMALLINT fFunction, pfExists[SQL_API_SQLSETPOS] = TRUE; pfExists[SQL_API_SQLSETSCROLLOPTIONS] = TRUE; /* odbc 1.0 */ pfExists[SQL_API_SQLTABLEPRIVILEGES] = TRUE; - if (0 == ci->updatable_cursors) - pfExists[SQL_API_SQLBULKOPERATIONS] = FALSE; - else - pfExists[SQL_API_SQLBULKOPERATIONS] = TRUE; + pfExists[SQL_API_SQLBULKOPERATIONS] = FALSE; } else { - if (ci->drivers.lie) - *pfExists = TRUE; - else { - switch (fFunction) { - case SQL_API_SQLBINDCOL: - *pfExists = TRUE; - break; - case SQL_API_SQLCANCEL: - *pfExists = TRUE; - break; - case SQL_API_SQLCOLATTRIBUTE: - *pfExists = TRUE; - break; - case SQL_API_SQLCONNECT: - *pfExists = TRUE; - break; - case SQL_API_SQLDESCRIBECOL: - *pfExists = TRUE; - break; /* partial */ - case SQL_API_SQLDISCONNECT: - *pfExists = TRUE; - break; - case SQL_API_SQLEXECDIRECT: - *pfExists = TRUE; - break; - case SQL_API_SQLEXECUTE: - *pfExists = TRUE; - break; - case SQL_API_SQLFETCH: - *pfExists = TRUE; - break; - case SQL_API_SQLFREESTMT: - *pfExists = TRUE; - break; - case SQL_API_SQLGETCURSORNAME: - *pfExists = TRUE; - break; - case SQL_API_SQLNUMRESULTCOLS: - *pfExists = TRUE; - break; - case SQL_API_SQLPREPARE: - *pfExists = TRUE; - break; - case SQL_API_SQLROWCOUNT: + switch (fFunction) { + case SQL_API_SQLBINDCOL: + *pfExists = TRUE; + break; + case SQL_API_SQLCANCEL: + *pfExists = TRUE; + break; + case SQL_API_SQLCOLATTRIBUTE: + *pfExists = TRUE; + break; + case SQL_API_SQLCONNECT: + *pfExists = TRUE; + break; + case SQL_API_SQLDESCRIBECOL: + *pfExists = TRUE; + break; /* partial */ + case SQL_API_SQLDISCONNECT: + *pfExists = TRUE; + break; + case SQL_API_SQLEXECDIRECT: + *pfExists = TRUE; + break; + case SQL_API_SQLEXECUTE: + *pfExists = TRUE; + break; + case SQL_API_SQLFETCH: + *pfExists = TRUE; + break; + case SQL_API_SQLFREESTMT: + *pfExists = TRUE; + break; + case SQL_API_SQLGETCURSORNAME: + *pfExists = TRUE; + break; + case SQL_API_SQLNUMRESULTCOLS: + *pfExists = TRUE; + break; + case SQL_API_SQLPREPARE: + *pfExists = TRUE; + break; + case SQL_API_SQLROWCOUNT: + *pfExists = TRUE; + break; + case SQL_API_SQLSETCURSORNAME: + *pfExists = TRUE; + break; + + /* ODBC level 1 functions */ + case SQL_API_SQLBINDPARAMETER: + *pfExists = TRUE; + break; + case SQL_API_SQLCOLUMNS: + *pfExists = TRUE; + break; + case SQL_API_SQLDRIVERCONNECT: + *pfExists = TRUE; + break; + case SQL_API_SQLGETDATA: + *pfExists = TRUE; + break; + case SQL_API_SQLGETFUNCTIONS: + *pfExists = TRUE; + break; + case SQL_API_SQLGETINFO: + *pfExists = TRUE; + break; + case SQL_API_SQLGETTYPEINFO: + *pfExists = TRUE; + break; + case SQL_API_SQLPARAMDATA: + *pfExists = TRUE; + break; + case SQL_API_SQLPUTDATA: + *pfExists = TRUE; + break; + case SQL_API_SQLSPECIALCOLUMNS: + *pfExists = TRUE; + break; + case SQL_API_SQLSTATISTICS: + *pfExists = TRUE; + break; + case SQL_API_SQLTABLES: + *pfExists = TRUE; + break; + + /* ODBC level 2 functions */ + case SQL_API_SQLBROWSECONNECT: + *pfExists = FALSE; + break; + case SQL_API_SQLCOLUMNPRIVILEGES: + *pfExists = FALSE; + break; + case SQL_API_SQLDATASOURCES: + *pfExists = FALSE; + break; /* only implemented by DM */ + case SQL_API_SQLDESCRIBEPARAM: + if (SUPPORT_DESCRIBE_PARAM(ci)) *pfExists = TRUE; - break; - case SQL_API_SQLSETCURSORNAME: - *pfExists = TRUE; - break; - - /* ODBC level 1 functions */ - case SQL_API_SQLBINDPARAMETER: - *pfExists = TRUE; - break; - case SQL_API_SQLCOLUMNS: - *pfExists = TRUE; - break; - case SQL_API_SQLDRIVERCONNECT: - *pfExists = TRUE; - break; - case SQL_API_SQLGETDATA: - *pfExists = TRUE; - break; - case SQL_API_SQLGETFUNCTIONS: - *pfExists = TRUE; - break; - case SQL_API_SQLGETINFO: - *pfExists = TRUE; - break; - case SQL_API_SQLGETTYPEINFO: - *pfExists = TRUE; - break; - case SQL_API_SQLPARAMDATA: - *pfExists = TRUE; - break; - case SQL_API_SQLPUTDATA: - *pfExists = TRUE; - break; - case SQL_API_SQLSPECIALCOLUMNS: - *pfExists = TRUE; - break; - case SQL_API_SQLSTATISTICS: - *pfExists = TRUE; - break; - case SQL_API_SQLTABLES: - *pfExists = TRUE; - break; - - /* ODBC level 2 functions */ - case SQL_API_SQLBROWSECONNECT: - *pfExists = FALSE; - break; - case SQL_API_SQLCOLUMNPRIVILEGES: + else *pfExists = FALSE; - break; - case SQL_API_SQLDATASOURCES: - *pfExists = FALSE; - break; /* only implemented by DM */ - case SQL_API_SQLDESCRIBEPARAM: - if (SUPPORT_DESCRIBE_PARAM(ci)) - *pfExists = TRUE; - else - *pfExists = FALSE; - break; /* not properly implemented */ - case SQL_API_SQLDRIVERS: - *pfExists = FALSE; - break; /* only implemented by DM */ - case SQL_API_SQLEXTENDEDFETCH: - *pfExists = TRUE; - break; - case SQL_API_SQLFOREIGNKEYS: - *pfExists = TRUE; - break; - case SQL_API_SQLMORERESULTS: - *pfExists = TRUE; - break; - case SQL_API_SQLNATIVESQL: - *pfExists = TRUE; - break; - case SQL_API_SQLNUMPARAMS: - *pfExists = TRUE; - break; - case SQL_API_SQLPRIMARYKEYS: - *pfExists = TRUE; - break; - case SQL_API_SQLPROCEDURECOLUMNS: - *pfExists = TRUE; - break; - case SQL_API_SQLPROCEDURES: - *pfExists = TRUE; - break; - case SQL_API_SQLSETPOS: - *pfExists = TRUE; - break; - case SQL_API_SQLTABLEPRIVILEGES: - *pfExists = TRUE; - break; - case SQL_API_SQLBULKOPERATIONS: /* 24 */ - case SQL_API_SQLALLOCHANDLE: /* 1001 */ - case SQL_API_SQLBINDPARAM: /* 1002 */ - case SQL_API_SQLCLOSECURSOR: /* 1003 */ - case SQL_API_SQLENDTRAN: /* 1005 */ - case SQL_API_SQLFETCHSCROLL: /* 1021 */ - case SQL_API_SQLFREEHANDLE: /* 1006 */ - case SQL_API_SQLGETCONNECTATTR: /* 1007 */ - case SQL_API_SQLGETDESCFIELD: /* 1008 */ - case SQL_API_SQLGETDIAGFIELD: /* 1010 */ - case SQL_API_SQLGETDIAGREC: /* 1011 */ - case SQL_API_SQLGETENVATTR: /* 1012 */ - case SQL_API_SQLGETSTMTATTR: /* 1014 */ - case SQL_API_SQLSETCONNECTATTR: /* 1016 */ - case SQL_API_SQLSETDESCFIELD: /* 1017 */ - case SQL_API_SQLSETENVATTR: /* 1019 */ - case SQL_API_SQLSETSTMTATTR: /* 1020 */ - *pfExists = TRUE; - break; - case SQL_API_SQLGETDESCREC: /* 1009 */ - case SQL_API_SQLSETDESCREC: /* 1018 */ - case SQL_API_SQLCOPYDESC: /* 1004 */ - *pfExists = FALSE; - break; - default: - *pfExists = FALSE; - break; - } + break; /* not properly implemented */ + case SQL_API_SQLDRIVERS: + *pfExists = FALSE; + break; /* only implemented by DM */ + case SQL_API_SQLEXTENDEDFETCH: + *pfExists = TRUE; + break; + case SQL_API_SQLFOREIGNKEYS: + *pfExists = TRUE; + break; + case SQL_API_SQLMORERESULTS: + *pfExists = TRUE; + break; + case SQL_API_SQLNATIVESQL: + *pfExists = TRUE; + break; + case SQL_API_SQLNUMPARAMS: + *pfExists = TRUE; + break; + case SQL_API_SQLPRIMARYKEYS: + *pfExists = TRUE; + break; + case SQL_API_SQLPROCEDURECOLUMNS: + *pfExists = TRUE; + break; + case SQL_API_SQLPROCEDURES: + *pfExists = TRUE; + break; + case SQL_API_SQLSETPOS: + *pfExists = TRUE; + break; + case SQL_API_SQLTABLEPRIVILEGES: + *pfExists = TRUE; + break; + case SQL_API_SQLBULKOPERATIONS: /* 24 */ + case SQL_API_SQLALLOCHANDLE: /* 1001 */ + case SQL_API_SQLBINDPARAM: /* 1002 */ + case SQL_API_SQLCLOSECURSOR: /* 1003 */ + case SQL_API_SQLENDTRAN: /* 1005 */ + case SQL_API_SQLFETCHSCROLL: /* 1021 */ + case SQL_API_SQLFREEHANDLE: /* 1006 */ + case SQL_API_SQLGETCONNECTATTR: /* 1007 */ + case SQL_API_SQLGETDESCFIELD: /* 1008 */ + case SQL_API_SQLGETDIAGFIELD: /* 1010 */ + case SQL_API_SQLGETDIAGREC: /* 1011 */ + case SQL_API_SQLGETENVATTR: /* 1012 */ + case SQL_API_SQLGETSTMTATTR: /* 1014 */ + case SQL_API_SQLSETCONNECTATTR: /* 1016 */ + case SQL_API_SQLSETDESCFIELD: /* 1017 */ + case SQL_API_SQLSETENVATTR: /* 1019 */ + case SQL_API_SQLSETSTMTATTR: /* 1020 */ + *pfExists = TRUE; + break; + case SQL_API_SQLGETDESCREC: /* 1009 */ + case SQL_API_SQLSETDESCREC: /* 1018 */ + case SQL_API_SQLCOPYDESC: /* 1004 */ + *pfExists = FALSE; + break; + default: + *pfExists = FALSE; + break; } } return SQL_SUCCESS; diff --git a/src/elasticodbc/mylog.c b/src/elasticodbc/mylog.c index 6be08a25..69dc508c 100644 --- a/src/elasticodbc/mylog.c +++ b/src/elasticodbc/mylog.c @@ -435,12 +435,12 @@ int getGlobalDebug() { if (globalDebug >= 0) return globalDebug; /* Debug is stored in the driver section */ - SQLGetPrivateProfileString(DBMS_NAME, INI_DEBUG, "", temp, sizeof(temp), + SQLGetPrivateProfileString(DBMS_NAME, INI_LOG_LEVEL, "", temp, sizeof(temp), ODBCINST_INI); if (temp[0]) globalDebug = atoi(temp); else - globalDebug = DEFAULT_DEBUG; + globalDebug = DEFAULT_LOGLEVEL; return globalDebug; } @@ -456,12 +456,12 @@ int getGlobalCommlog() { if (globalCommlog >= 0) return globalCommlog; /* Commlog is stored in the driver section */ - SQLGetPrivateProfileString(DBMS_NAME, INI_COMMLOG, "", temp, sizeof(temp), + SQLGetPrivateProfileString(DBMS_NAME, INI_LOG_LEVEL, "", temp, sizeof(temp), ODBCINST_INI); if (temp[0]) globalCommlog = atoi(temp); else - globalCommlog = DEFAULT_COMMLOG; + globalCommlog = DEFAULT_LOGLEVEL; return globalCommlog; } @@ -474,19 +474,19 @@ int writeGlobalLogs() { char temp[10]; ITOA_FIXED(temp, globalDebug); - SQLWritePrivateProfileString(DBMS_NAME, INI_DEBUG, temp, ODBCINST_INI); + SQLWritePrivateProfileString(DBMS_NAME, INI_LOG_LEVEL, temp, ODBCINST_INI); ITOA_FIXED(temp, globalCommlog); - SQLWritePrivateProfileString(DBMS_NAME, INI_COMMLOG, temp, ODBCINST_INI); + SQLWritePrivateProfileString(DBMS_NAME, INI_LOG_LEVEL, temp, ODBCINST_INI); return 0; } int getLogDir(char *dir, int dirmax) { - return SQLGetPrivateProfileString(DBMS_NAME, INI_LOGDIR, "", dir, dirmax, + return SQLGetPrivateProfileString(DBMS_NAME, INI_LOG_OUTPUT, "", dir, dirmax, ODBCINST_INI); } int setLogDir(const char *dir) { - return SQLWritePrivateProfileString(DBMS_NAME, INI_LOGDIR, dir, + return SQLWritePrivateProfileString(DBMS_NAME, INI_LOG_OUTPUT, dir, ODBCINST_INI); } diff --git a/src/elasticodbc/odbcapi.c b/src/elasticodbc/odbcapi.c index 2c461fa9..7c8ab84b 100644 --- a/src/elasticodbc/odbcapi.c +++ b/src/elasticodbc/odbcapi.c @@ -84,7 +84,6 @@ RETCODE SQL_API SQLColumns(HSTMT StatementHandle, SQLCHAR *CatalogName, StatementClass *stmt = (StatementClass *)StatementHandle; SQLCHAR *ctName = CatalogName, *scName = SchemaName, *tbName = TableName, *clName = ColumnName; - ConnInfo *ci = &(SC_get_conn(stmt)->connInfo); UWORD flag = PODBC_SEARCH_PUBLIC_SCHEMA; MYLOG(0, "Entering\n"); @@ -95,10 +94,6 @@ RETCODE SQL_API SQLColumns(HSTMT StatementHandle, SQLCHAR *CatalogName, SC_clear_error(stmt); if (stmt->options.metadata_id) flag |= PODBC_NOT_SEARCH_PATTERN; - if (atoi(ci->show_oid_column)) - flag |= PODBC_SHOW_OID_COLUMN; - if (atoi(ci->row_versioning)) - flag |= PODBC_ROW_VERSIONING; if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else @@ -110,8 +105,6 @@ RETCODE SQL_API SQLColumns(HSTMT StatementHandle, SQLCHAR *CatalogName, SQLCHAR *newCt = NULL, *newSc = NULL, *newTb = NULL, *newCl = NULL; ConnectionClass *conn = SC_get_conn(stmt); - if (SC_is_lower_case(stmt, conn)) /* case-insensitive identifier */ - ifallupper = FALSE; if (newCt = make_lstring_ifneeded(conn, CatalogName, NameLength1, ifallupper), NULL != newCt) { @@ -589,8 +582,6 @@ RETCODE SQL_API SQLSpecialColumns(HSTMT StatementHandle, SQLCHAR *newCt = NULL, *newSc = NULL, *newTb = NULL; ConnectionClass *conn = SC_get_conn(stmt); - if (SC_is_lower_case(stmt, conn)) /* case-insensitive identifier */ - ifallupper = FALSE; if (newCt = make_lstring_ifneeded(conn, CatalogName, NameLength1, ifallupper), NULL != newCt) { @@ -652,8 +643,6 @@ RETCODE SQL_API SQLStatistics(HSTMT StatementHandle, SQLCHAR *CatalogName, SQLCHAR *newCt = NULL, *newSc = NULL, *newTb = NULL; ConnectionClass *conn = SC_get_conn(stmt); - if (SC_is_lower_case(stmt, conn)) /* case-insensitive identifier */ - ifallupper = FALSE; if (newCt = make_lstring_ifneeded(conn, CatalogName, NameLength1, ifallupper), NULL != newCt) { @@ -718,8 +707,6 @@ RETCODE SQL_API SQLTables(HSTMT StatementHandle, SQLCHAR *CatalogName, SQLCHAR *newCt = NULL, *newSc = NULL, *newTb = NULL; ConnectionClass *conn = SC_get_conn(stmt); - if (SC_is_lower_case(stmt, conn)) /* case-insensitive identifier */ - ifallupper = FALSE; if (newCt = make_lstring_ifneeded(conn, CatalogName, NameLength1, ifallupper), NULL != newCt) { @@ -784,8 +771,6 @@ RETCODE SQL_API SQLColumnPrivileges( SQLCHAR *newCt = NULL, *newSc = NULL, *newTb = NULL, *newCl = NULL; ConnectionClass *conn = SC_get_conn(stmt); - if (SC_is_lower_case(stmt, conn)) /* case-insensitive identifier */ - ifallupper = FALSE; if (newCt = make_lstring_ifneeded(conn, szCatalogName, cbCatalogName, ifallupper), NULL != newCt) { @@ -913,8 +898,6 @@ RETCODE SQL_API SQLForeignKeys( *newFkct = NULL, *newFksc = NULL, *newFktb = NULL; ConnectionClass *conn = SC_get_conn(stmt); - if (SC_is_lower_case(stmt, conn)) /* case-insensitive identifier */ - ifallupper = FALSE; if (newPkct = make_lstring_ifneeded(conn, szPkCatalogName, cbPkCatalogName, ifallupper), NULL != newPkct) { @@ -1047,8 +1030,6 @@ RETCODE SQL_API SQLPrimaryKeys(HSTMT hstmt, SQLCHAR *szCatalogName, SQLCHAR *newCt = NULL, *newSc = NULL, *newTb = NULL; ConnectionClass *conn = SC_get_conn(stmt); - if (SC_is_lower_case(stmt, conn)) /* case-insensitive identifier */ - ifallupper = FALSE; if (newCt = make_lstring_ifneeded(conn, szCatalogName, cbCatalogName, ifallupper), NULL != newCt) { @@ -1112,8 +1093,6 @@ RETCODE SQL_API SQLProcedureColumns( SQLCHAR *newCt = NULL, *newSc = NULL, *newPr = NULL, *newCl = NULL; ConnectionClass *conn = SC_get_conn(stmt); - if (SC_is_lower_case(stmt, conn)) /* case-insensitive identifier */ - ifallupper = FALSE; if (newCt = make_lstring_ifneeded(conn, szCatalogName, cbCatalogName, ifallupper), NULL != newCt) { @@ -1185,8 +1164,6 @@ RETCODE SQL_API SQLProcedures(HSTMT hstmt, SQLCHAR *szCatalogName, SQLCHAR *newCt = NULL, *newSc = NULL, *newPr = NULL; ConnectionClass *conn = SC_get_conn(stmt); - if (SC_is_lower_case(stmt, conn)) /* case-insensitive identifier */ - ifallupper = FALSE; if (newCt = make_lstring_ifneeded(conn, szCatalogName, cbCatalogName, ifallupper), NULL != newCt) { @@ -1265,8 +1242,6 @@ RETCODE SQL_API SQLTablePrivileges(HSTMT hstmt, SQLCHAR *szCatalogName, SQLCHAR *newCt = NULL, *newSc = NULL, *newTb = NULL; ConnectionClass *conn = SC_get_conn(stmt); - if (SC_is_lower_case(stmt, conn)) /* case-insensitive identifier */ - ifallupper = FALSE; if (newCt = make_lstring_ifneeded(conn, szCatalogName, cbCatalogName, ifallupper), NULL != newCt) { diff --git a/src/elasticodbc/odbcapi30.c b/src/elasticodbc/odbcapi30.c index 4da8b76a..aa576fa8 100644 --- a/src/elasticodbc/odbcapi30.c +++ b/src/elasticodbc/odbcapi30.c @@ -490,9 +490,6 @@ RETCODE SQL_API SQLSetStmtAttr(HSTMT StatementHandle, SQLINTEGER Attribute, RETCODE SQL_API ESAPI_GetFunctions30(HDBC hdbc, SQLUSMALLINT fFunction, SQLUSMALLINT FAR *pfExists) { ConnectionClass *conn = (ConnectionClass *)hdbc; - ConnInfo *ci = &(conn->connInfo); - - MYLOG(DETAIL_LOG_LEVEL, "lie=%d\n", ci->drivers.lie); CC_clear_error(conn); if (fFunction != SQL_API_ODBC3_ALL_FUNCTIONS) return SQL_ERROR; @@ -547,13 +544,8 @@ RETCODE SQL_API ESAPI_GetFunctions30(HDBC hdbc, SQLUSMALLINT fFunction, SQL_FUNC_ESET(pfExists, SQL_API_SQLSPECIALCOLUMNS); /* 52 */ SQL_FUNC_ESET(pfExists, SQL_API_SQLSTATISTICS); /* 53 */ SQL_FUNC_ESET(pfExists, SQL_API_SQLTABLES); /* 54 */ - if (ci->drivers.lie) - SQL_FUNC_ESET(pfExists, SQL_API_SQLBROWSECONNECT); /* 55 */ - if (ci->drivers.lie) - SQL_FUNC_ESET(pfExists, SQL_API_SQLCOLUMNPRIVILEGES); /* 56 */ SQL_FUNC_ESET(pfExists, SQL_API_SQLDATASOURCES); /* 57 */ - if (SUPPORT_DESCRIBE_PARAM(ci) || ci->drivers.lie) - SQL_FUNC_ESET(pfExists, SQL_API_SQLDESCRIBEPARAM); /* 58 */ + SQL_FUNC_ESET(pfExists, SQL_API_SQLDESCRIBEPARAM); /* 58 */ SQL_FUNC_ESET(pfExists, SQL_API_SQLEXTENDEDFETCH); /* 59 deprecated ? */ /* @@ -582,10 +574,6 @@ RETCODE SQL_API ESAPI_GetFunctions30(HDBC hdbc, SQLUSMALLINT fFunction, SQL_FUNC_ESET(pfExists, SQL_API_SQLFREEHANDLE); /* 1006 */ SQL_FUNC_ESET(pfExists, SQL_API_SQLGETCONNECTATTR); /* 1007 */ SQL_FUNC_ESET(pfExists, SQL_API_SQLGETDESCFIELD); /* 1008 */ - if (ci->drivers.lie) { - SQL_FUNC_ESET(pfExists, - SQL_API_SQLGETDESCREC); /* 1009 not implemented yet */ - } SQL_FUNC_ESET(pfExists, SQL_API_SQLGETDIAGFIELD); /* 1010 minimal implementation */ SQL_FUNC_ESET(pfExists, SQL_API_SQLGETDIAGREC); /* 1011 */ @@ -593,16 +581,9 @@ RETCODE SQL_API ESAPI_GetFunctions30(HDBC hdbc, SQLUSMALLINT fFunction, SQL_FUNC_ESET(pfExists, SQL_API_SQLGETSTMTATTR); /* 1014 */ SQL_FUNC_ESET(pfExists, SQL_API_SQLSETCONNECTATTR); /* 1016 */ SQL_FUNC_ESET(pfExists, SQL_API_SQLSETDESCFIELD); /* 1017 */ - if (ci->drivers.lie) { - SQL_FUNC_ESET(pfExists, - SQL_API_SQLSETDESCREC); /* 1018 not implemented yet */ - } SQL_FUNC_ESET(pfExists, SQL_API_SQLSETENVATTR); /* 1019 */ SQL_FUNC_ESET(pfExists, SQL_API_SQLSETSTMTATTR); /* 1020 */ SQL_FUNC_ESET(pfExists, SQL_API_SQLFETCHSCROLL); /* 1021 */ - if (0 != (ALLOW_BULK_OPERATIONS & ci->updatable_cursors)) - SQL_FUNC_ESET(pfExists, SQL_API_SQLBULKOPERATIONS); /* 24 */ - return SQL_SUCCESS; } diff --git a/src/elasticodbc/odbcapiw.c b/src/elasticodbc/odbcapiw.c index b9ca050b..6979f5e2 100644 --- a/src/elasticodbc/odbcapiw.c +++ b/src/elasticodbc/odbcapiw.c @@ -46,7 +46,7 @@ RETCODE SQL_API SQLColumnsW(HSTMT StatementHandle, SQLWCHAR *CatalogName, conn = SC_get_conn(stmt); ci = &(conn->connInfo); - lower_id = SC_is_lower_case(stmt, conn); + lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(CatalogName, NameLength1, &nmlen1, lower_id); scName = ucs2_to_utf8(SchemaName, NameLength2, &nmlen2, lower_id); tbName = ucs2_to_utf8(TableName, NameLength3, &nmlen3, lower_id); @@ -55,10 +55,6 @@ RETCODE SQL_API SQLColumnsW(HSTMT StatementHandle, SQLWCHAR *CatalogName, SC_clear_error(stmt); if (stmt->options.metadata_id) flag |= PODBC_NOT_SEARCH_PATTERN; - if (atoi(ci->show_oid_column)) - flag |= PODBC_SHOW_OID_COLUMN; - if (atoi(ci->row_versioning)) - flag |= PODBC_ROW_VERSIONING; if (SC_opencheck(stmt, func)) ret = SQL_ERROR; else @@ -452,7 +448,7 @@ RETCODE SQL_API SQLSpecialColumnsW( return SQL_ERROR; conn = SC_get_conn(stmt); - lower_id = SC_is_lower_case(stmt, conn); + lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(CatalogName, NameLength1, &nmlen1, lower_id); scName = ucs2_to_utf8(SchemaName, NameLength2, &nmlen2, lower_id); tbName = ucs2_to_utf8(TableName, NameLength3, &nmlen3, lower_id); @@ -493,7 +489,7 @@ RETCODE SQL_API SQLStatisticsW(HSTMT StatementHandle, SQLWCHAR *CatalogName, return SQL_ERROR; conn = SC_get_conn(stmt); - lower_id = SC_is_lower_case(stmt, conn); + lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(CatalogName, NameLength1, &nmlen1, lower_id); scName = ucs2_to_utf8(SchemaName, NameLength2, &nmlen2, lower_id); tbName = ucs2_to_utf8(TableName, NameLength3, &nmlen3, lower_id); @@ -535,7 +531,7 @@ RETCODE SQL_API SQLTablesW(HSTMT StatementHandle, SQLWCHAR *CatalogName, return SQL_ERROR; conn = SC_get_conn(stmt); - lower_id = SC_is_lower_case(stmt, conn); + lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(CatalogName, NameLength1, &nmlen1, lower_id); scName = ucs2_to_utf8(SchemaName, NameLength2, &nmlen2, lower_id); tbName = ucs2_to_utf8(TableName, NameLength3, &nmlen3, lower_id); @@ -581,7 +577,7 @@ RETCODE SQL_API SQLColumnPrivilegesW( return SQL_ERROR; conn = SC_get_conn(stmt); - lower_id = SC_is_lower_case(stmt, conn); + lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id); tbName = ucs2_to_utf8(szTableName, cbTableName, &nmlen3, lower_id); @@ -629,7 +625,7 @@ RETCODE SQL_API SQLForeignKeysW( return SQL_ERROR; conn = SC_get_conn(stmt); - lower_id = SC_is_lower_case(stmt, conn); + lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szPkCatalogName, cbPkCatalogName, &nmlen1, lower_id); scName = ucs2_to_utf8(szPkSchemaName, cbPkSchemaName, &nmlen2, lower_id); tbName = ucs2_to_utf8(szPkTableName, cbPkTableName, &nmlen3, lower_id); @@ -731,7 +727,7 @@ RETCODE SQL_API SQLPrimaryKeysW(HSTMT hstmt, SQLWCHAR *szCatalogName, return SQL_ERROR; conn = SC_get_conn(stmt); - lower_id = SC_is_lower_case(stmt, conn); + lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id); tbName = ucs2_to_utf8(szTableName, cbTableName, &nmlen3, lower_id); @@ -768,7 +764,7 @@ RETCODE SQL_API SQLProcedureColumnsW( MYLOG(0, "Entering\n"); conn = SC_get_conn(stmt); - lower_id = SC_is_lower_case(stmt, conn); + lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id); prName = ucs2_to_utf8(szProcName, cbProcName, &nmlen3, lower_id); @@ -814,7 +810,7 @@ RETCODE SQL_API SQLProceduresW(HSTMT hstmt, SQLWCHAR *szCatalogName, return SQL_ERROR; conn = SC_get_conn(stmt); - lower_id = SC_is_lower_case(stmt, conn); + lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id); prName = ucs2_to_utf8(szProcName, cbProcName, &nmlen3, lower_id); @@ -858,7 +854,7 @@ RETCODE SQL_API SQLTablePrivilegesW(HSTMT hstmt, SQLWCHAR *szCatalogName, return SQL_ERROR; conn = SC_get_conn(stmt); - lower_id = SC_is_lower_case(stmt, conn); + lower_id = DEFAULT_LOWERCASEIDENTIFIER; ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id); scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id); tbName = ucs2_to_utf8(szTableName, cbTableName, &nmlen3, lower_id); diff --git a/src/elasticodbc/options.c b/src/elasticodbc/options.c index a113ac96..54d75a93 100644 --- a/src/elasticodbc/options.c +++ b/src/elasticodbc/options.c @@ -55,12 +55,6 @@ static RETCODE set_statement_option(ConnectionClass *conn, StatementClass *stmt, */ MYLOG(0, "SQL_CONCURRENCY = " FORMAT_LEN " ", vParam); setval = SQL_CONCUR_READ_ONLY; - if (SQL_CONCUR_READ_ONLY == vParam) - ; - else if (ci->drivers.lie) - setval = vParam; - else if (0 != ci->updatable_cursors) - setval = SQL_CONCUR_ROWVER; if (conn) conn->stmtOptions.scroll_concurrency = (SQLUINTEGER)setval; else if (stmt) { @@ -86,24 +80,12 @@ static RETCODE set_statement_option(ConnectionClass *conn, StatementClass *stmt, */ MYLOG(0, "SQL_CURSOR_TYPE = " FORMAT_LEN " ", vParam); setval = SQL_CURSOR_FORWARD_ONLY; - if (ci->drivers.lie) - setval = vParam; - else if (SQL_CURSOR_STATIC == vParam) + if (SQL_CURSOR_STATIC == vParam) setval = vParam; else if (SQL_CURSOR_KEYSET_DRIVEN == vParam) { - if (0 != (ci->updatable_cursors & ALLOW_KEYSET_DRIVEN_CURSORS)) - setval = vParam; - else - setval = SQL_CURSOR_STATIC; /* at least scrollable */ + setval = SQL_CURSOR_STATIC; /* at least scrollable */ } else if (SQL_CURSOR_DYNAMIC == vParam) { - if (0 != (ci->updatable_cursors & ALLOW_DYNAMIC_CURSORS)) - setval = vParam; - else if (0 - != (ci->updatable_cursors - & ALLOW_KEYSET_DRIVEN_CURSORS)) - setval = SQL_CURSOR_KEYSET_DRIVEN; - else - setval = SQL_CURSOR_STATIC; /* at least scrollable */ + setval = SQL_CURSOR_STATIC; /* at least scrollable */ } if (conn) conn->stmtOptions.cursor_type = (SQLUINTEGER)setval; diff --git a/src/elasticodbc/results.c b/src/elasticodbc/results.c index 537cdfda..11c4283d 100644 --- a/src/elasticodbc/results.c +++ b/src/elasticodbc/results.c @@ -156,7 +156,7 @@ RETCODE SQL_API ESAPI_DescribeCol(HSTMT hstmt, SQLUSMALLINT icol, conn = SC_get_conn(stmt); ci = &(conn->connInfo); - unknown_sizes = ci->drivers.unknown_sizes; + unknown_sizes = DEFAULT_UNKNOWNSIZES; SC_clear_error(stmt); @@ -405,7 +405,7 @@ RETCODE SQL_API ESAPI_ColAttributes(HSTMT hstmt, SQLUSMALLINT icol, col_idx = icol - 1; - unknown_sizes = ci->drivers.unknown_sizes; + unknown_sizes = DEFAULT_UNKNOWNSIZES; /* not appropriate for SQLColAttributes() */ if (stmt->catalog_result) diff --git a/src/elasticodbc/setup.c b/src/elasticodbc/setup.c index 1dc1697e..a23fe836 100644 --- a/src/elasticodbc/setup.c +++ b/src/elasticodbc/setup.c @@ -320,11 +320,9 @@ LRESULT CALLBACK ConfigDlgProc(HWND hdlg, UINT wMsg, WPARAM wParam, sizeof(lpsetupdlg->ci.dsn)); /* Get Dialog Values */ - UINT log_button_checked = - (IsDlgButtonChecked(hdlg, IDC_CHECK1) ? 1 : 0); + UINT log_button_checked = (IsDlgButtonChecked(hdlg, IDC_CHECK1) ? 1 : 0); setGlobalCommlog(log_button_checked); - lpsetupdlg->ci.drivers.commlog = (char)log_button_checked; - lpsetupdlg->ci.drivers.debug = (char)log_button_checked; + lpsetupdlg->ci.drivers.loglevel = (char)log_button_checked; GetDlgStuff(hdlg, &lpsetupdlg->ci); /* Update ODBC.INI */ SetDSNAttributes(hdlg, lpsetupdlg, NULL); @@ -442,10 +440,6 @@ void test_connection(HANDLE hwnd, ConnInfo *ci, BOOL withDTC) { dsn_1st = ci->dsn[0]; ci->dsn[0] = '\0'; - if (NAME_IS_VALID(ci->conn_settings)) - ci->conn_settings_in_str = TRUE; - if (NAME_IS_VALID(ci->esopt)) - ci->esopt_in_str = TRUE; makeConnectString(out_conn, ci, sizeof(out_conn)); MYLOG(0, "conn_string=%s\n", out_conn); #ifdef UNICODE_SUPPORT diff --git a/src/elasticodbc/statement.c b/src/elasticodbc/statement.c index 5e4167df..38ce41df 100644 --- a/src/elasticodbc/statement.c +++ b/src/elasticodbc/statement.c @@ -246,8 +246,6 @@ static void SC_init_discard_output_params(StatementClass *self) { if (!conn) return; self->discard_output_params = 0; - if (!conn->connInfo.use_server_side_prepare) - self->discard_output_params = 1; } static void SC_init_parse_method(StatementClass *self) { @@ -260,8 +258,6 @@ static void SC_init_parse_method(StatementClass *self) { return; if (self->catalog_result) return; - if (conn->connInfo.drivers.parse) - SC_set_parse_forced(self); } StatementClass *SC_Constructor(ConnectionClass *conn) {