From 321a65ccd481a46e7f5d26693319415fd7ae61fe Mon Sep 17 00:00:00 2001 From: Jordan Wilson Date: Fri, 10 Jul 2020 15:50:03 -0700 Subject: [PATCH 1/4] return error when catalog/schema list is queried - test & info call fixes --- .../ITODBCCatalog/test_odbc_catalog.cpp | 29 +++--- .../ITODBCInfo/test_odbc_info.cpp | 33 +++--- .../ITODBCResults/test_odbc_results.cpp | 2 +- .../odfe_sql_odbc/connection-dialog.tcd | 2 + .../odfe_sql_odbc/odfe_sql_odbc.taco | Bin 3613 -> 3650 bytes .../odfe_sql_odbc_dev/connection-dialog.tcd | 2 + .../odfe_sql_odbc_dev/odfe_sql_odbc_dev.taco | Bin 0 -> 2718 bytes sql-odbc/src/odfesqlodbc/connection.c | 24 ++--- sql-odbc/src/odfesqlodbc/es_communication.cpp | 61 ------------ sql-odbc/src/odfesqlodbc/es_communication.h | 1 - sql-odbc/src/odfesqlodbc/es_helper.cpp | 6 -- sql-odbc/src/odfesqlodbc/es_helper.h | 2 - sql-odbc/src/odfesqlodbc/es_info.cpp | 94 ++++++++++-------- sql-odbc/src/odfesqlodbc/info.c | 21 +--- 14 files changed, 107 insertions(+), 170 deletions(-) create mode 100644 sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/odfe_sql_odbc_dev.taco diff --git a/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp b/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp index 9210a3c056..623a82ebfb 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp @@ -71,7 +71,7 @@ typedef struct bind_info { // Column test constants and macro const std::vector< std::string > flights_column_name = { - "FlightNum", "Origin", + "FlightNum", "Origin", "OriginLocation", "DestLocation", "FlightDelay", "DistanceMiles", "FlightTimeMin", "OriginWeather", "dayOfWeek", "AvgTicketPrice", "Carrier", "FlightDelayMin", "OriginRegion", "DestAirportID", "FlightDelayType", "timestamp", @@ -79,7 +79,7 @@ const std::vector< std::string > flights_column_name = { "OriginCityName", "DestWeather", "OriginCountry", "DestCountry", "DestRegion", "DestCityName", "OriginAirportID"}; const std::vector< std::string > flights_data_type = { - "keyword", "keyword", "boolean", "float", + "keyword", "keyword", "geo_point", "geo_point", "boolean", "float", "float", "keyword", "integer", "float", "keyword", "integer", "keyword", "keyword", "keyword", "date", "keyword", "keyword", "boolean", "float", "keyword", "keyword", "keyword", "keyword", @@ -157,9 +157,6 @@ const std::vector< table_data > excel_table_data_all{ }; const std::vector< table_data > table_data_types{ {"", "", "", "BASE TABLE", ""}}; -const std::vector< table_data > table_data_schemas{{"", "", "", "", ""}}; -const std::vector< table_data > table_data_catalogs{ - {"odfe-cluster", "", "", "", ""}}; class TestSQLTables : public testing::Test { public: @@ -280,13 +277,21 @@ class TestSQLCatalogKeys : public testing::Test { // NULL test TEST_SQL_TABLES(Null, NULL, NULL, NULL, NULL, table_data_all, true, false); -// Catalog tests -TEST_SQL_TABLES(WildCatalogs, (SQLTCHAR*)L"%", (SQLTCHAR*)L"", (SQLTCHAR*)L"", - NULL, table_data_catalogs, false, false) +// Catalog tests (error: catalogs not supported) +TEST_F(TestSQLTables, WildCatalogs) { + SQLRETURN ret = SQLTables(m_hstmt, (SQLTCHAR*)L"%", SQL_NTS, (SQLTCHAR*)L"", + SQL_NTS, (SQLTCHAR*)L"", SQL_NTS, NULL, SQL_NTS); + EXPECT_EQ(ret, SQL_ERROR); + LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); +} -// Schema tests -TEST_SQL_TABLES(WildSchema, (SQLTCHAR*)L"", (SQLTCHAR*)L"%", (SQLTCHAR*)L"", - NULL, table_data_schemas, false, false) +// Schema tests (error: schemas not supported) +TEST_F(TestSQLTables, WildSchema) { + SQLRETURN ret = SQLTables(m_hstmt, (SQLTCHAR*)L"", SQL_NTS, (SQLTCHAR*)L"%", + SQL_NTS, (SQLTCHAR*)L"", SQL_NTS, NULL, SQL_NTS); + EXPECT_EQ(ret, SQL_ERROR); + LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); +} // Table tests TEST_SQL_TABLES(ValidTable, NULL, NULL, (SQLTCHAR*)L"kibana_sample_data%", NULL, @@ -404,7 +409,7 @@ TEST_F(TestSQLColumns, FlightsValidation) { } column_idx++; } - EXPECT_EQ(column_idx, static_cast< size_t >(25)); + EXPECT_EQ(column_idx, static_cast< size_t >(27)); } // We expect an empty result set for PrimaryKeys and ForeignKeys diff --git a/sql-odbc/src/IntegrationTests/ITODBCInfo/test_odbc_info.cpp b/sql-odbc/src/IntegrationTests/ITODBCInfo/test_odbc_info.cpp index c194d2a24c..a5ec6bcefd 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCInfo/test_odbc_info.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCInfo/test_odbc_info.cpp @@ -140,14 +140,16 @@ int Ver1GEVer2(std::wstring ver_1_str, std::wstring ver_2_str) { TEST_SQL_GET_INFO_STRING(SQLDriverName, SQL_DRIVER_NAME, L"odfesqlodbc.dll"); TEST_SQL_GET_INFO_STRING(SQLDriverODBCVer, SQL_DRIVER_ODBC_VER, L"03.51"); -std::wstring version = std::wstring_convert< std::codecvt_utf8_utf16< wchar_t >, wchar_t >{} +std::wstring version = + std::wstring_convert< std::codecvt_utf8_utf16< wchar_t >, wchar_t >{} .from_bytes(ELASTICSEARCHDRIVERVERSION); TEST_SQL_GET_INFO_STRING(SQLDriverVer, SQL_DRIVER_VER, version); TEST_SQL_GET_INFO_UINT16(SQLGetDataExtensions, SQL_GETDATA_EXTENSIONS, (SQL_GD_ANY_COLUMN | SQL_GD_ANY_ORDER | SQL_GD_BOUND | SQL_GD_BLOCK)); -TEST_SQL_GET_INFO_STRING(SQLSearchPatternEscape, SQL_SEARCH_PATTERN_ESCAPE, L""); +TEST_SQL_GET_INFO_STRING(SQLSearchPatternEscape, SQL_SEARCH_PATTERN_ESCAPE, + L""); ////////////////////// // Data Source Info // @@ -158,8 +160,8 @@ TEST_SQL_GET_INFO_UINT16(SQLCursorCommitBehavior, SQL_CURSOR_COMMIT_BEHAVIOR, TEST_SQL_GET_INFO_UINT16(SQLTxnCapable, SQL_TXN_CAPABLE, SQL_TC_NONE); TEST_SQL_GET_INFO_UINT16(SQLConcatNullBehavior, SQL_CONCAT_NULL_BEHAVIOR, SQL_CB_NULL); -TEST_SQL_GET_INFO_STRING(SQLSchemaTerm, SQL_SCHEMA_TERM, L"schema"); -TEST_SQL_GET_INFO_STRING(SQLCatalogTerm, SQL_CATALOG_TERM, L"catalog"); +TEST_SQL_GET_INFO_STRING(SQLSchemaTerm, SQL_SCHEMA_TERM, L""); +TEST_SQL_GET_INFO_STRING(SQLCatalogTerm, SQL_CATALOG_TERM, L""); /////////////// // DBMS Info // @@ -173,7 +175,8 @@ TEST_SQL_GET_INFO_VERSION_GE(SQLDBMSVer, SQL_DBMS_VER, L"7.1.1"); /////////////////// TEST_SQL_GET_INFO_STRING(SQLColumnAlias, SQL_COLUMN_ALIAS, L"Y"); -TEST_SQL_GET_INFO_UINT16(SQLGroupBy, SQL_GROUP_BY, SQL_GB_GROUP_BY_EQUALS_SELECT); +TEST_SQL_GET_INFO_UINT16(SQLGroupBy, SQL_GROUP_BY, + SQL_GB_GROUP_BY_EQUALS_SELECT); TEST_SQL_GET_INFO_STRING(SQLIdentifierQuoteChar, SQL_IDENTIFIER_QUOTE_CHAR, L"`"); TEST_SQL_GET_INFO_UINT_MASK(SQLOJCapabilities, SQL_OJ_CAPABILITIES, @@ -187,11 +190,10 @@ TEST_SQL_GET_INFO_UINT_MASK(SQLODBCInterfaceConformance, SQL_ODBC_INTERFACE_CONFORMANCE, SQL_OIC_CORE); TEST_SQL_GET_INFO_UINT_MASK(SQLSQLConformance, SQL_SQL_CONFORMANCE, SQL_SC_SQL92_ENTRY); -TEST_SQL_GET_INFO_UINT_MASK(SQLCatalogUsage, SQL_CATALOG_USAGE, - SQL_CU_DML_STATEMENTS); -TEST_SQL_GET_INFO_UINT16(SQLCatalogLocation, SQL_CATALOG_LOCATION, SQL_QL_START); +TEST_SQL_GET_INFO_UINT_MASK(SQLCatalogUsage, SQL_CATALOG_USAGE, 0); +TEST_SQL_GET_INFO_UINT16(SQLCatalogLocation, SQL_CATALOG_LOCATION, 0); TEST_SQL_GET_INFO_STRING(SQLCatalogNameSeparator, SQL_CATALOG_NAME_SEPARATOR, - L"."); + L""); TEST_SQL_GET_INFO_UINT_MASK(SQLSQL92Predicates, SQL_SQL92_PREDICATES, SQL_SP_BETWEEN | SQL_SP_COMPARISON | SQL_SP_IN | SQL_SP_ISNULL | SQL_SP_LIKE); @@ -204,7 +206,8 @@ TEST_SQL_GET_INFO_UINT_MASK(SQLSQL92ValueExpressions, SQL_SQL92_VALUE_EXPRESSIONS, SQL_SVE_CASE | SQL_SVE_CAST); TEST_SQL_GET_INFO_UINT_MASK(SQLDatetimeLiterals, SQL_DATETIME_LITERALS, 0); -TEST_SQL_GET_INFO_STRING(SQLOrderByColumnsInSelect, SQL_ORDER_BY_COLUMNS_IN_SELECT, L"Y"); +TEST_SQL_GET_INFO_STRING(SQLOrderByColumnsInSelect, + SQL_ORDER_BY_COLUMNS_IN_SELECT, L"Y"); TEST_SQL_GET_INFO_STRING(SQLCatalogName, SQL_CATALOG_NAME, L"N"); //////////////// @@ -232,11 +235,11 @@ TEST_SQL_GET_INFO_UINT_MASK(SQLConvertVarbinary, SQL_CONVERT_VARBINARY, 0); TEST_SQL_GET_INFO_UINT_MASK(SQLConvertChar, SQL_CONVERT_CHAR, 0); TEST_SQL_GET_INFO_UINT_MASK(SQLConvertLongVarchar, SQL_CONVERT_LONGVARCHAR, 0); TEST_SQL_GET_INFO_UINT_MASK(SQLConvertWChar, SQL_CONVERT_WCHAR, 0); -TEST_SQL_GET_INFO_UINT_MASK(SQLConvertWLongVarchar, SQL_CONVERT_WLONGVARCHAR, 0); +TEST_SQL_GET_INFO_UINT_MASK(SQLConvertWLongVarchar, SQL_CONVERT_WLONGVARCHAR, + 0); TEST_SQL_GET_INFO_UINT_MASK(SQLConvertWVarchar, SQL_CONVERT_WVARCHAR, 0); TEST_SQL_GET_INFO_UINT_MASK(SQLConvertGuid, SQL_CONVERT_GUID, 0); - ////////////////////// // Scalar Functions // ////////////////////// @@ -278,8 +281,10 @@ TEST_SQL_GET_INFO_UINT_MASK(SQLSQL92StringFunctions, SQL_SQL92_STRING_FUNCTIONS, //////////// TEST_SQL_GET_INFO_UINT16(SQLMaxIdentifierLen, SQL_MAX_IDENTIFIER_LEN, SHRT_MAX); -TEST_SQL_GET_INFO_UINT16(SQLMaxColumnsInGroupBy, SQL_MAX_COLUMNS_IN_GROUP_BY, 0); -TEST_SQL_GET_INFO_UINT16(SQLMaxColumnsInOrderBy, SQL_MAX_COLUMNS_IN_ORDER_BY, 0); +TEST_SQL_GET_INFO_UINT16(SQLMaxColumnsInGroupBy, SQL_MAX_COLUMNS_IN_GROUP_BY, + 0); +TEST_SQL_GET_INFO_UINT16(SQLMaxColumnsInOrderBy, SQL_MAX_COLUMNS_IN_ORDER_BY, + 0); TEST_SQL_GET_INFO_UINT16(SQLMaxColumnsInSelect, SQL_MAX_COLUMNS_IN_SELECT, 0); int main(int argc, char** argv) { diff --git a/sql-odbc/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp b/sql-odbc/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp index f46e160343..1945736de2 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCResults/test_odbc_results.cpp @@ -100,7 +100,7 @@ const int delay_offset_3_1 = 0; const int delay_offset_3_2 = 180; const SQLSMALLINT single_col_name_length = 6; const SQLSMALLINT single_col_data_type = SQL_WVARCHAR; -const SQLULEN single_col_column_size = 25; +const SQLULEN single_col_column_size = 15; const SQLSMALLINT single_col_decimal_digit = 0; const SQLSMALLINT single_col_nullable = 2; const std::wstring single_row = L"1"; diff --git a/sql-odbc/src/TableauConnector/odfe_sql_odbc/connection-dialog.tcd b/sql-odbc/src/TableauConnector/odfe_sql_odbc/connection-dialog.tcd index 24c364c615..2ac573f598 100644 --- a/sql-odbc/src/TableauConnector/odfe_sql_odbc/connection-dialog.tcd +++ b/sql-odbc/src/TableauConnector/odfe_sql_odbc/connection-dialog.tcd @@ -10,5 +10,7 @@ + + diff --git a/sql-odbc/src/TableauConnector/odfe_sql_odbc/odfe_sql_odbc.taco b/sql-odbc/src/TableauConnector/odfe_sql_odbc/odfe_sql_odbc.taco index 2f3e1edfa2be3239eb7c2cac9f186da21106112e..a006dcb2a302ce6bc6de795cf790d5689757ab3b 100644 GIT binary patch literal 3650 zcmaJ^2T)V%5)Qpf3nB;?9=%KGh>@nDgaFbJL4hDGp@iO4ib!ulqzWo1QX+yNA}w?& zf{N5g3rGn?L_k2`CC-~myfgRhnKSdxoPYQH=R5m-yK4%iq6Px!>FELdHY=t8GGhQx z17Mdev}Fy9A?J>I0RSq1DU^<$w1e`0+f4t}8A#mmw=+!J*Z^|b+(Hfp*@E@=89`;` zKCnP#rQY`s)|kl;E6yySvk2s}$XQf@!FMa342rPLO=x#qb=(Eu*b z@2E`_#qTrpe>>vTA-;ih|N9x3iBFM^UhX$t{QTvDk%(F})H_d$t$QPDpWo_QIOU`z ztGkQ%)%ILLNAxNtZ~m3g9e#`ch6^8`7B)x2syH7G+Cv z!=_g%@r}x#h3$e4m$@f~)D&sEv~+E&61sU?P|B|qAM)t3R0bY}^59B*O_OWSMbE0@ z%W2;TDuu??(3=@l-|e;5W=P4~+>bP}CJ2The){vf_82B8SkvdT&+@Kp7wigP9 zRTq}_etH>r9Zi@EYiTj+Jy>}UxO$yJctX%$YYCKTE#}Bh7ZN;uZ(!po>9WDj<Lv0_#j1q{V=s-~RW0CpW@mIu)i9mrkt?mV-115kzbbFaU8X-!Y9Zwa&_61``An0+an{ARPSIZf}e)@=5SJDUxb zvr@@P2%lckhB*!JsJE&g#ndopF+?kRDXLC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(KaWpnO z^E~NOzHyEV*!jDCWwP=($!JQa+Oi<7M0_S0Wx95Z_5w*lWh+>Oa4wh?WGK`Jz}A_| zFFJ!91bnyoOc!q@f;yiy#93`aPVDNKeAtNhoUXVck)nx0Q@gRzgRxvky1^<1^obrC zki_|`ZYr+!62Lq%n4yB7!a3^Tnj(E=8LUH^&^(kC#NS_e1+hGQ9Mn!md?$CH*V>9d z0DR6IHxBa#y7U-s@6ncIjP1!uJNg>~eAzA+K~IK;ofh zgdk8nns2S%TKEexxFvVE&k4Em9zXA%&?-=#mi>|K+UTeiBYi+Idl+d`_og2C&~+5$ zS;3pB<<{+0MAKYphh!!$Bqc}TRRxAy$G8nV?FFv0rG_=9)X z<}jT`?F!}zA{F+q+nTML4$UTk=dAh)O`=u^<9~CsSe-+aUqskmit16^zM`9igXhHo}6md3d*yU|r_lQr3*;a~&F~ z%NtLb6~h)Q ze&*iUU_d$~e$A}$&Xm#P#ft)vike3|2__}M&=*8IZ&cK4i~IAlCwFWj?!$KiGmYlv zM*<`2z|E=sS+c7tr7P9fgeHE#8U8HeoVda@6C?Dnb@PC%@$krsAaHzuQxGWe-BXDd z`MFeN(y~~A$0wT1G_0?cf(ehWJCoh^NOrneT^JX$dcWbBs01Dt<9!#<68 zP|eO#n>DZ}$6onc5FO$Qqmu(WsdSE+I&fjKKg0$Y=HQBmZgJ-Va+O9~#U7qy!OsXM zHnLjXEp_&8WXmOeD*qz>9E&)x9uK*?KR;gigYC#il|6b}@`troT>Z#LEUX~FKcSkC z0yN-1Ox37=!ZM*7s0%(i`87KL4k t{u|~5;U2&8Pt31Q2mOX26DIhT + + diff --git a/sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/odfe_sql_odbc_dev.taco b/sql-odbc/src/TableauConnector/odfe_sql_odbc_dev/odfe_sql_odbc_dev.taco new file mode 100644 index 0000000000000000000000000000000000000000..4c7c2f27a02be627683ac918087038ee32e004ed GIT binary patch literal 2718 zcmaJ@2T)U46b%}dE-Z##M2ZkfX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|jODjf7IX7`1=bnGG$Z>#V=P&%32P>EhOufb zbB66lC*y1Oo1JB%v6f(pGOKnlMR`AT7%=RYV3p|aYp}B9AOvOXtTpyE=lcq*|Axt? d{W#2Uk}TXp!`T^B1OPY~S2IKM2EQ83e*innE-?TA literal 0 HcmV?d00001 diff --git a/sql-odbc/src/odfesqlodbc/connection.c b/sql-odbc/src/odfesqlodbc/connection.c index f42c0786b0..4c151ac3b6 100644 --- a/sql-odbc/src/odfesqlodbc/connection.c +++ b/sql-odbc/src/odfesqlodbc/connection.c @@ -636,36 +636,26 @@ void CC_log_error(const char *func, const char *desc, #define NULLCHECK(a) (a ? a : "(NULL)") if (self) { - MYLOG(ES_ERROR, "CONN ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", - func, desc, self->__error_number, - NULLCHECK(self->__error_message)); + MYLOG(ES_ERROR, + "CONN ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, + desc, self->__error_number, NULLCHECK(self->__error_message)); MYLOG(ES_ERROR, " " "------------------------------------------------------------\n"); MYLOG(ES_ERROR, " henv=%p, conn=%p, status=%u, num_stmts=%d\n", self->henv, self, self->status, self->num_stmts); - MYLOG(ES_ERROR, - " esconn=%p, stmts=%p, lobj_type=%d\n", self->esconn, - self->stmts, self->lobj_type); + MYLOG(ES_ERROR, " esconn=%p, stmts=%p, lobj_type=%d\n", + self->esconn, self->stmts, self->lobj_type); } else { - MYLOG(ES_ERROR, "INVALID CONNECTION HANDLE ERROR: func=%s, desc='%s'\n", func, - desc); + MYLOG(ES_ERROR, "INVALID CONNECTION HANDLE ERROR: func=%s, desc='%s'\n", + func, desc); } } const char *CurrCat(const ConnectionClass *conn) { - // Keeping this NULL since it's required for getting list of tables in - // Microsoft Excel with ODBC Connection mode. This causes error in Data - // Connection wizard mode but data connection wizard sends query with - // catalog.table_name which fails. So setting this to NULL will enable more - // functionality UNUSED(conn); return NULL; - - // Change this to following return value when found a solution which works - // with ODBC and Data Connection wizard in Microsoft Excel return - // conn->cluster_name; } const char *CurrCatString(const ConnectionClass *conn) { diff --git a/sql-odbc/src/odfesqlodbc/es_communication.cpp b/sql-odbc/src/odfesqlodbc/es_communication.cpp index 24ad4600c1..cf25b070a7 100644 --- a/sql-odbc/src/odfesqlodbc/es_communication.cpp +++ b/sql-odbc/src/odfesqlodbc/es_communication.cpp @@ -407,67 +407,6 @@ bool ESCommunication::EstablishConnection() { return false; } -std::vector< std::string > ESCommunication::GetColumnsWithSelectQuery( - const std::string table_name) { - std::vector< std::string > list_of_column; - if (table_name.empty()) { - m_error_message = "Query is NULL"; - LogMsg(ES_ERROR, m_error_message.c_str()); - return list_of_column; - } - - // Prepare query - std::string query = "SELECT * FROM " + table_name + " LIMIT 0"; - std::string msg = "Attempting to execute a query \"" + query + "\""; - LogMsg(ES_DEBUG, msg.c_str()); - - // Issue request - std::shared_ptr< Aws::Http::HttpResponse > response = - IssueRequest(SQL_ENDPOINT_FORMAT_JDBC, Aws::Http::HttpMethod::HTTP_POST, - ctype, query); - - // Validate response - if (response == nullptr) { - m_error_message = - "Failed to receive response from query. " - "Received NULL response."; - LogMsg(ES_ERROR, m_error_message.c_str()); - return list_of_column; - } - - // Convert body from Aws IOStream to string - std::unique_ptr< ESResult > result = std::make_unique< ESResult >(); - AwsHttpResponseToString(response, result->result_json); - - // If response was not valid, set error - if (response->GetResponseCode() != Aws::Http::HttpResponseCode::OK) { - m_error_message = - "Http response code was not OK. Code received: " - + std::to_string(static_cast< long >(response->GetResponseCode())) - + "."; - if (response->HasClientError()) - m_error_message += - " Client error: '" + response->GetClientErrorMessage() + "'."; - if (!result->result_json.empty()) { - m_error_message += - " Response error: '" + result->result_json + "'."; - } - LogMsg(ES_ERROR, m_error_message.c_str()); - return list_of_column; - } - - GetJsonSchema(*result); - - rabbit::array schema_array = result->es_result_doc["schema"]; - for (rabbit::array::iterator it = schema_array.begin(); - it != schema_array.end(); ++it) { - std::string column_name = it->at("name").as_string(); - list_of_column.push_back(column_name); - } - - return list_of_column; -} - int ESCommunication::ExecDirect(const char* query, const char* fetch_size_) { if (!query) { m_error_message = "Query is NULL"; diff --git a/sql-odbc/src/odfesqlodbc/es_communication.h b/sql-odbc/src/odfesqlodbc/es_communication.h index f1ed8f33d4..38ca25b1de 100644 --- a/sql-odbc/src/odfesqlodbc/es_communication.h +++ b/sql-odbc/src/odfesqlodbc/es_communication.h @@ -74,7 +74,6 @@ class ESCommunication { std::string& output); void SendCloseCursorRequest(const std::string& cursor); void StopResultRetrieval(); - std::vector< std::string > GetColumnsWithSelectQuery(const std::string table_name); private: void InitializeConnection(); diff --git a/sql-odbc/src/odfesqlodbc/es_helper.cpp b/sql-odbc/src/odfesqlodbc/es_helper.cpp index a540bfc4fb..cf243137ce 100644 --- a/sql-odbc/src/odfesqlodbc/es_helper.cpp +++ b/sql-odbc/src/odfesqlodbc/es_helper.cpp @@ -114,12 +114,6 @@ void ESStopRetrieval(void* es_conn) { static_cast< ESCommunication* >(es_conn)->StopResultRetrieval(); } -std::vector< std::string > ESGetColumnsWithSelectQuery( - void* es_conn, const std::string table_name) { - return static_cast< ESCommunication* >(es_conn)->GetColumnsWithSelectQuery( - table_name); -} - // This class provides a cross platform way of entering critical sections class CriticalSectionHelper { public: diff --git a/sql-odbc/src/odfesqlodbc/es_helper.h b/sql-odbc/src/odfesqlodbc/es_helper.h index 61d26fb7e3..2328b07d7a 100644 --- a/sql-odbc/src/odfesqlodbc/es_helper.h +++ b/sql-odbc/src/odfesqlodbc/es_helper.h @@ -30,8 +30,6 @@ void* ESConnectDBParams(runtime_options& rt_opts, int expand_dbname, std::string GetServerVersion(void* es_conn); std::string GetClusterName(void* es_conn); std::string GetErrorMsg(void* es_conn); -std::vector< std::string > ESGetColumnsWithSelectQuery( - void* es_conn, const std::string table_name); // C Interface extern "C" { diff --git a/sql-odbc/src/odfesqlodbc/es_info.cpp b/sql-odbc/src/odfesqlodbc/es_info.cpp index 639b965368..8bdf470b11 100644 --- a/sql-odbc/src/odfesqlodbc/es_info.cpp +++ b/sql-odbc/src/odfesqlodbc/es_info.cpp @@ -157,6 +157,7 @@ class BindTemplate { BindTemplate &operator=(const BindTemplate &) = default; virtual std::string AsString() = 0; virtual void UpdateData(SQLPOINTER new_data, size_t size) = 0; + // virtual void UpdateDataNull() = 0; private: SQLLEN m_len; @@ -187,6 +188,9 @@ class BindTemplateInt4 : public BindTemplate { (void)size; m_data = *(Int4 *)new_data; } + // void UpdateDataNull() { + // m_data = NULL; + // } private: Int4 m_data; @@ -222,6 +226,9 @@ class BindTemplateInt2 : public BindTemplate { (void)size; m_data = *(Int2 *)new_data; } + // void UpdateDataNull() { + // m_data = NULL; + // } private: Int2 m_data; @@ -268,12 +275,16 @@ class BindTemplateSQLCHAR : public BindTemplate { } m_data.push_back(0); } + // void UpdateDataNull() { + // m_data.clear(); + // } private: std::vector< SQLCHAR > m_data; protected: SQLPOINTER GetDataForBind() { + // return m_data.size() == 0 ? NULL : m_data.data(); return m_data.data(); } SQLSMALLINT GetType() { @@ -306,8 +317,8 @@ void GetCatalogData(const std::string &query, StatementClass *stmt, StatementClass *sub_stmt, const TableResultSet res_type, std::string &table_type, void (*populate_binds)(bind_vector &), - void (*setup_qres_info)(QResultClass *, EnvironmentClass *), - std::vector< std::string > *list_of_columns = NULL); + void (*setup_qres_info)(QResultClass *, + EnvironmentClass *)); // Common function declarations void ConvertToString(std::string &out, bool &valid, const SQLCHAR *sql_char, @@ -394,8 +405,7 @@ void AssignTableBindTemplates(bind_vector &tabs); void SetupTableQResInfo(QResultClass *res, EnvironmentClass *env); void SetTableTuples(QResultClass *res, const TableResultSet res_type, const bind_vector &bind_tbl, std::string &table_type, - StatementClass *stmt, StatementClass *tbl_stmt, - std::vector< std::string > *list_of_columns = NULL); + StatementClass *stmt, StatementClass *tbl_stmt); // Table specific function declarations void split(const std::string &input, const std::string &delim, @@ -458,8 +468,7 @@ void SetupTableQResInfo(QResultClass *res, EnvironmentClass *env) { void SetTableTuples(QResultClass *res, const TableResultSet res_type, const bind_vector &bind_tbl, std::string &table_type, - StatementClass *stmt, StatementClass *tbl_stmt, - std::vector< std::string > *list_of_columns) { + StatementClass *stmt, StatementClass *tbl_stmt) { auto CheckResult = [&](const auto &res) { if (res != SQL_NO_DATA_FOUND) { SC_full_error_copy(stmt, tbl_stmt, FALSE); @@ -478,24 +487,15 @@ void SetTableTuples(QResultClass *res, const TableResultSet res_type, // General case if (res_type == TableResultSet::All) { RETCODE result = SQL_NO_DATA_FOUND; - int ordinal_position = 0; while (SQL_SUCCEEDED(result = ESAPI_Fetch(tbl_stmt))) { if (bind_tbl[TABLES_TABLE_TYPE]->AsString() == "BASE TABLE") { std::string table("TABLE"); bind_tbl[TABLES_TABLE_TYPE]->UpdateData(&table, table.size()); } - if (list_of_columns != NULL && !list_of_columns->empty()) { - if (std::find(list_of_columns->begin(), list_of_columns->end(), - bind_tbl[COLUMNS_COLUMN_NAME]->AsString()) - != list_of_columns->end()) { - ordinal_position++; - bind_tbl[COLUMNS_ORDINAL_POSITION]->UpdateData( - &ordinal_position, 0); - AssignData(res, bind_tbl); - } - } else { - AssignData(res, bind_tbl); - } + // if (bind_tbl[TABLES_CATALOG_NAME]->AsString() != "") { + // bind_tbl[TABLES_CATALOG_NAME]->UpdateDataNull(); + // } + AssignData(res, bind_tbl); } CheckResult(result); } else if (res_type == TableResultSet::TableLookUp) { @@ -514,6 +514,10 @@ void SetTableTuples(QResultClass *res, const TableResultSet res_type, std::string table("TABLE"); bind_tbl[TABLES_TABLE_TYPE]->UpdateData(&table, table.size()); } + if (bind_tbl[TABLES_CATALOG_NAME]->AsString() != "") { + std::string table(""); + bind_tbl[TABLES_CATALOG_NAME]->UpdateData(&table, table.size()); + } if (std::find(table_types.begin(), table_types.end(), bind_tbl[TABLES_TABLE_TYPE]->AsString()) != table_types.end()) { @@ -539,12 +543,17 @@ void SetTableTuples(QResultClass *res, const TableResultSet res_type, size_t idx = NUM_OF_TABLES_FIELDS; switch (res_type) { case TableResultSet::Catalog: + MYLOG(ES_WARNING, "TRS::Catalog\n"); + return; idx = TABLES_CATALOG_NAME; break; case TableResultSet::Schema: + MYLOG(ES_WARNING, "TRS::Schema\n"); + return; idx = TABLES_SCHEMA_NAME; break; case TableResultSet::TableTypes: + MYLOG(ES_WARNING, "TRS::TableTypes\n"); idx = TABLES_TABLE_TYPE; break; default: @@ -553,6 +562,9 @@ void SetTableTuples(QResultClass *res, const TableResultSet res_type, "Result type is not an expected type."); } + // if (bind_tbl[TABLES_CATALOG_NAME]->AsString() != "") { + // bind_tbl[TABLES_CATALOG_NAME]->UpdateDataNull(); + // } // Get new tuple and assign index of interest (NULL others) // TODO #324 (SQL Plugin)- Should these be unique? TupleField *tuple = QR_AddNew(res); @@ -653,8 +665,8 @@ void GetCatalogData(const std::string &query, StatementClass *stmt, StatementClass *sub_stmt, const TableResultSet res_type, std::string &table_type, void (*populate_binds)(bind_vector &), - void (*setup_qres_info)(QResultClass *, EnvironmentClass *), - std::vector< std::string > *list_of_columns) { + void (*setup_qres_info)(QResultClass *, + EnvironmentClass *)) { // Execute query ExecuteQuery(SC_get_conn(stmt), reinterpret_cast< HSTMT * >(&sub_stmt), query); @@ -670,8 +682,7 @@ void GetCatalogData(const std::string &query, StatementClass *stmt, // Setup QResultClass (*setup_qres_info)( res, static_cast< EnvironmentClass * >(CC_get_env(SC_get_conn(stmt)))); - SetTableTuples(res, res_type, binds, table_type, stmt, sub_stmt, - list_of_columns); + SetTableTuples(res, res_type, binds, table_type, stmt, sub_stmt); CleanUp(stmt, sub_stmt, SQL_SUCCESS); } @@ -707,20 +718,32 @@ ESAPI_Tables(HSTMT hstmt, const SQLCHAR *catalog_name_sql, if (catalog_name == SQL_ALL_CATALOGS) { if (schema_valid && table_valid && (table_name == "") - && (schema_name == "")) - result_type = TableResultSet::Catalog; - } + && (schema_name == "")) { + std::string error_msg("Catalogs not supported."); + SC_set_error(stmt, STMT_NOT_IMPLEMENTED_ERROR, + error_msg.c_str(), func); + CleanUp(stmt, tbl_stmt); + return SQL_ERROR; + } + // result_type = TableResultSet::Catalog; + } if (schema_name == SQL_ALL_SCHEMAS) { if (catalog_valid && table_valid && (table_name == "") - && (catalog_name == "")) - result_type = TableResultSet::Schema; - } + && (catalog_name == "")) { + std::string error_msg("Schemas not supported."); + SC_set_error(stmt, STMT_NOT_IMPLEMENTED_ERROR, + error_msg.c_str(), func); + CleanUp(stmt, tbl_stmt); + return SQL_ERROR; + } + // result_type = TableResultSet::Schema; + } if (table_type_valid && (table_type == SQL_ALL_TABLE_TYPES)) { if (catalog_valid && table_valid && schema_valid && (table_name == "") && (catalog_name == "") && (schema_name == "")) result_type = TableResultSet::TableTypes; - } + } if (table_type_valid && (table_type != SQL_ALL_TABLE_TYPES)) { result_type = TableResultSet::TableLookUp; } @@ -785,22 +808,13 @@ ESAPI_Columns(HSTMT hstmt, const SQLCHAR *catalog_name_sql, std::string query; GenerateColumnQuery(query, table_name, column_name, table_valid, column_valid, flag); - - // Get list of columns with SELECT * query since columns doesn't match with DESCRIBE & SELECT * query - std::vector< std::string > list_of_columns; - if (table_valid) { - ConnectionClass *conn = SC_get_conn(stmt); - list_of_columns = - ESGetColumnsWithSelectQuery(conn->esconn, table_name); - } // TODO #324 (SQL Plugin)- evaluate catalog & schema support // Execute query std::string table_type = ""; GetCatalogData(query, stmt, col_stmt, TableResultSet::All, table_type, - AssignColumnBindTemplates, SetupColumnQResInfo, - &list_of_columns); + AssignColumnBindTemplates, SetupColumnQResInfo); return SQL_SUCCESS; } catch (std::bad_alloc &e) { std::string error_msg = std::string("Bad allocation exception: '") diff --git a/sql-odbc/src/odfesqlodbc/info.c b/sql-odbc/src/odfesqlodbc/info.c index efae0d7cbf..a8925d4087 100644 --- a/sql-odbc/src/odfesqlodbc/info.c +++ b/sql-odbc/src/odfesqlodbc/info.c @@ -331,14 +331,6 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, case SQL_MAX_OWNER_NAME_LEN: /* ODBC 1.0 */ len = 2; value = 0; - if (ES_VERSION_GT(conn, 7.4)) - value = CC_get_max_idlen(conn); -#ifdef MAX_SCHEMA_LEN - else - value = MAX_SCHEMA_LEN; -#endif /* MAX_SCHEMA_LEN */ - if (0 == value) - value = NAMEDATALEN_V73 - 1; break; case SQL_MAX_PROCEDURE_NAME_LEN: /* ODBC 1.0 */ @@ -487,20 +479,20 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, case SQL_QUALIFIER_LOCATION: /* ODBC 2.0 */ len = 2; - value = SQL_QL_START; + value = 0; break; case SQL_QUALIFIER_NAME_SEPARATOR: /* ODBC 1.0 */ - p = "."; + p = ""; break; case SQL_QUALIFIER_TERM: /* ODBC 1.0 */ - p = "cluster"; + p = ""; break; case SQL_QUALIFIER_USAGE: /* ODBC 2.0 */ len = 4; - value = SQL_CU_DML_STATEMENTS; + value = 0; break; case SQL_QUOTED_IDENTIFIER_CASE: /* ODBC 2.0 */ @@ -672,10 +664,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType, value = SQL_BS_SELECT_EXPLICIT | SQL_BS_ROW_COUNT_EXPLICIT; break; case SQL_CATALOG_NAME: - if (CurrCat(conn)) - p = "Y"; - else - p = "N"; + p = "N"; break; case SQL_COLLATION_SEQ: p = ""; From b70a4dc88fc3ecc67e5fdfe4c193a6cb3bd4914f Mon Sep 17 00:00:00 2001 From: Jordan Wilson Date: Fri, 10 Jul 2020 16:58:33 -0700 Subject: [PATCH 2/4] cleanup --- .../ITODBCCatalog/test_odbc_catalog.cpp | 32 ++++---- sql-odbc/src/odfesqlodbc/es_communication.cpp | 82 ++++++++++++++++--- sql-odbc/src/odfesqlodbc/es_communication.h | 4 +- sql-odbc/src/odfesqlodbc/es_helper.cpp | 13 ++- sql-odbc/src/odfesqlodbc/es_helper.h | 2 + sql-odbc/src/odfesqlodbc/es_info.cpp | 76 ++++++++--------- 6 files changed, 137 insertions(+), 72 deletions(-) diff --git a/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp b/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp index 623a82ebfb..1bbcdfc3eb 100644 --- a/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp +++ b/sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp @@ -71,19 +71,20 @@ typedef struct bind_info { // Column test constants and macro const std::vector< std::string > flights_column_name = { - "FlightNum", "Origin", "OriginLocation", "DestLocation", - "FlightDelay", "DistanceMiles", "FlightTimeMin", "OriginWeather", - "dayOfWeek", "AvgTicketPrice", "Carrier", "FlightDelayMin", - "OriginRegion", "DestAirportID", "FlightDelayType", "timestamp", - "Dest", "FlightTimeHour", "Cancelled", "DistanceKilometers", - "OriginCityName", "DestWeather", "OriginCountry", "DestCountry", - "DestRegion", "DestCityName", "OriginAirportID"}; + "FlightNum", "Origin", "FlightDelay", + "DistanceMiles", "FlightTimeMin", "OriginWeather", + "dayOfWeek", "AvgTicketPrice", "Carrier", + "FlightDelayMin", "OriginRegion", "DestAirportID", + "FlightDelayType", "timestamp", "Dest", + "FlightTimeHour", "Cancelled", "DistanceKilometers", + "OriginCityName", "DestWeather", "OriginCountry", + "DestCountry", "DestRegion", "DestCityName", + "OriginAirportID"}; const std::vector< std::string > flights_data_type = { - "keyword", "keyword", "geo_point", "geo_point", "boolean", "float", - "float", "keyword", "integer", "float", "keyword", "integer", - "keyword", "keyword", "keyword", "date", "keyword", "keyword", - "boolean", "float", "keyword", "keyword", "keyword", "keyword", - "keyword", "keyword", "keyword"}; + "keyword", "keyword", "boolean", "float", "float", "keyword", "integer", + "float", "keyword", "integer", "keyword", "keyword", "keyword", "date", + "keyword", "keyword", "boolean", "float", "keyword", "keyword", "keyword", + "keyword", "keyword", "keyword", "keyword"}; const std::string flights_catalog_odfe = "odfe-cluster"; const std::string flights_catalog_elas = "elasticsearch"; const std::string flights_table_name = "kibana_sample_data_flights"; @@ -226,9 +227,10 @@ void CheckTableData(SQLHSTMT m_hstmt, TEST_F(TestSQLTables, test_name) { \ EXPECT_EQ(SQL_SUCCESS, SQLSetStmtAttr(m_hstmt, SQL_ATTR_METADATA_ID, \ (void*)(!enable_pattern), 0)); \ - EXPECT_TRUE(SQL_SUCCEEDED(SQLTables(m_hstmt, catalog, SQL_NTS, schema, \ + SQLRETURN ret2 = SQLTables(m_hstmt, catalog, SQL_NTS, schema, \ SQL_NTS, table, SQL_NTS, \ - table_type, SQL_NTS))); \ + table_type, SQL_NTS); \ + LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret2); \ if (empty) { \ size_t result_count = 0; \ SQLRETURN ret; \ @@ -409,7 +411,7 @@ TEST_F(TestSQLColumns, FlightsValidation) { } column_idx++; } - EXPECT_EQ(column_idx, static_cast< size_t >(27)); + EXPECT_EQ(column_idx, static_cast< size_t >(25)); } // We expect an empty result set for PrimaryKeys and ForeignKeys diff --git a/sql-odbc/src/odfesqlodbc/es_communication.cpp b/sql-odbc/src/odfesqlodbc/es_communication.cpp index cf25b070a7..66b3b8103f 100644 --- a/sql-odbc/src/odfesqlodbc/es_communication.cpp +++ b/sql-odbc/src/odfesqlodbc/es_communication.cpp @@ -309,9 +309,9 @@ std::shared_ptr< Aws::Http::HttpResponse > ESCommunication::IssueRequest( request->SetAuthorization("Basic " + hashed_userpw); } else if (m_rt_opts.auth.auth_type == AUTHTYPE_IAM) { std::shared_ptr< Aws::Auth::ProfileConfigFileAWSCredentialsProvider > - credential_provider = - Aws::MakeShared< Aws::Auth::ProfileConfigFileAWSCredentialsProvider >( - ALLOCATION_TAG.c_str(), ESODBC_PROFILE_NAME.c_str()); + credential_provider = Aws::MakeShared< + Aws::Auth::ProfileConfigFileAWSCredentialsProvider >( + ALLOCATION_TAG.c_str(), ESODBC_PROFILE_NAME.c_str()); Aws::Client::AWSAuthV4Signer signer(credential_provider, SERVICE_NAME.c_str(), m_rt_opts.auth.region.c_str()); @@ -407,6 +407,67 @@ bool ESCommunication::EstablishConnection() { return false; } +std::vector< std::string > ESCommunication::GetColumnsWithSelectQuery( + const std::string table_name) { + std::vector< std::string > list_of_column; + if (table_name.empty()) { + m_error_message = "Query is NULL"; + LogMsg(ES_ERROR, m_error_message.c_str()); + return list_of_column; + } + + // Prepare query + std::string query = "SELECT * FROM " + table_name + " LIMIT 0"; + std::string msg = "Attempting to execute a query \"" + query + "\""; + LogMsg(ES_DEBUG, msg.c_str()); + + // Issue request + std::shared_ptr< Aws::Http::HttpResponse > response = + IssueRequest(SQL_ENDPOINT_FORMAT_JDBC, Aws::Http::HttpMethod::HTTP_POST, + ctype, query); + + // Validate response + if (response == nullptr) { + m_error_message = + "Failed to receive response from query. " + "Received NULL response."; + LogMsg(ES_ERROR, m_error_message.c_str()); + return list_of_column; + } + + // Convert body from Aws IOStream to string + std::unique_ptr< ESResult > result = std::make_unique< ESResult >(); + AwsHttpResponseToString(response, result->result_json); + + // If response was not valid, set error + if (response->GetResponseCode() != Aws::Http::HttpResponseCode::OK) { + m_error_message = + "Http response code was not OK. Code received: " + + std::to_string(static_cast< long >(response->GetResponseCode())) + + "."; + if (response->HasClientError()) + m_error_message += + " Client error: '" + response->GetClientErrorMessage() + "'."; + if (!result->result_json.empty()) { + m_error_message += + " Response error: '" + result->result_json + "'."; + } + LogMsg(ES_ERROR, m_error_message.c_str()); + return list_of_column; + } + + GetJsonSchema(*result); + + rabbit::array schema_array = result->es_result_doc["schema"]; + for (rabbit::array::iterator it = schema_array.begin(); + it != schema_array.end(); ++it) { + std::string column_name = it->at("name").as_string(); + list_of_column.push_back(column_name); + } + + return list_of_column; +} + int ESCommunication::ExecDirect(const char* query, const char* fetch_size_) { if (!query) { m_error_message = "Query is NULL"; @@ -463,7 +524,8 @@ int ESCommunication::ExecDirect(const char* query, const char* fetch_size_) { try { ConstructESResult(*result); } catch (std::runtime_error& e) { - m_error_message = "Received runtime exception: " + std::string(e.what()); + m_error_message = + "Received runtime exception: " + std::string(e.what()); if (!result->result_json.empty()) { m_error_message += " Result body: " + result->result_json; } @@ -481,10 +543,9 @@ int ESCommunication::ExecDirect(const char* query, const char* fetch_size_) { result.release(); if (!cursor.empty()) { - // If the response has a cursor, this thread will retrieve more result pages asynchronously. - std::thread([&, cursor]() { - SendCursorQueries(cursor); - }).detach(); + // If the response has a cursor, this thread will retrieve more result + // pages asynchronously. + std::thread([&, cursor]() { SendCursorQueries(cursor); }).detach(); } return 0; @@ -509,7 +570,7 @@ void ESCommunication::SendCursorQueries(std::string cursor) { return; } - std::unique_ptr result = std::make_unique(); + std::unique_ptr< ESResult > result = std::make_unique< ESResult >(); AwsHttpResponseToString(response, result->result_json); PrepareCursorResult(*result); @@ -525,7 +586,8 @@ void ESCommunication::SendCursorQueries(std::string cursor) { && !m_result_queue.push(QUEUE_TIMEOUT, result.get())) { } - // Don't release when attempting to push to the queue as it may take multiple tries. + // Don't release when attempting to push to the queue as it may take + // multiple tries. result.release(); } } catch (std::runtime_error& e) { diff --git a/sql-odbc/src/odfesqlodbc/es_communication.h b/sql-odbc/src/odfesqlodbc/es_communication.h index 38ca25b1de..dd910dc7fe 100644 --- a/sql-odbc/src/odfesqlodbc/es_communication.h +++ b/sql-odbc/src/odfesqlodbc/es_communication.h @@ -74,6 +74,8 @@ class ESCommunication { std::string& output); void SendCloseCursorRequest(const std::string& cursor); void StopResultRetrieval(); + std::vector< std::string > GetColumnsWithSelectQuery( + const std::string table_name); private: void InitializeConnection(); @@ -84,7 +86,7 @@ class ESCommunication { void PrepareCursorResult(ESResult& es_result); // TODO #35 - Go through and add error messages on exit conditions - std::string m_error_message; + std::string m_error_message; const std::vector< std::string > m_supported_client_encodings = {"UTF8"}; ConnStatusType m_status; diff --git a/sql-odbc/src/odfesqlodbc/es_helper.cpp b/sql-odbc/src/odfesqlodbc/es_helper.cpp index cf243137ce..8cb6497eab 100644 --- a/sql-odbc/src/odfesqlodbc/es_helper.cpp +++ b/sql-odbc/src/odfesqlodbc/es_helper.cpp @@ -64,9 +64,8 @@ std::string GetServerVersion(void* es_conn) { } std::string GetClusterName(void* es_conn) { - return es_conn - ? static_cast< ESCommunication* >(es_conn)->GetClusterName() - : ""; + return es_conn ? static_cast< ESCommunication* >(es_conn)->GetClusterName() + : ""; } void* InitializeESConn() { @@ -111,7 +110,13 @@ void ESClearResult(ESResult* es_result) { } void ESStopRetrieval(void* es_conn) { - static_cast< ESCommunication* >(es_conn)->StopResultRetrieval(); + static_cast< ESCommunication* >(es_conn)->StopResultRetrieval(); +} + +std::vector< std::string > ESGetColumnsWithSelectQuery( + void* es_conn, const std::string table_name) { + return static_cast< ESCommunication* >(es_conn)->GetColumnsWithSelectQuery( + table_name); } // This class provides a cross platform way of entering critical sections diff --git a/sql-odbc/src/odfesqlodbc/es_helper.h b/sql-odbc/src/odfesqlodbc/es_helper.h index 2328b07d7a..61d26fb7e3 100644 --- a/sql-odbc/src/odfesqlodbc/es_helper.h +++ b/sql-odbc/src/odfesqlodbc/es_helper.h @@ -30,6 +30,8 @@ void* ESConnectDBParams(runtime_options& rt_opts, int expand_dbname, std::string GetServerVersion(void* es_conn); std::string GetClusterName(void* es_conn); std::string GetErrorMsg(void* es_conn); +std::vector< std::string > ESGetColumnsWithSelectQuery( + void* es_conn, const std::string table_name); // C Interface extern "C" { diff --git a/sql-odbc/src/odfesqlodbc/es_info.cpp b/sql-odbc/src/odfesqlodbc/es_info.cpp index 8bdf470b11..8c319ecaf4 100644 --- a/sql-odbc/src/odfesqlodbc/es_info.cpp +++ b/sql-odbc/src/odfesqlodbc/es_info.cpp @@ -157,7 +157,6 @@ class BindTemplate { BindTemplate &operator=(const BindTemplate &) = default; virtual std::string AsString() = 0; virtual void UpdateData(SQLPOINTER new_data, size_t size) = 0; - // virtual void UpdateDataNull() = 0; private: SQLLEN m_len; @@ -188,9 +187,6 @@ class BindTemplateInt4 : public BindTemplate { (void)size; m_data = *(Int4 *)new_data; } - // void UpdateDataNull() { - // m_data = NULL; - // } private: Int4 m_data; @@ -226,9 +222,6 @@ class BindTemplateInt2 : public BindTemplate { (void)size; m_data = *(Int2 *)new_data; } - // void UpdateDataNull() { - // m_data = NULL; - // } private: Int2 m_data; @@ -275,16 +268,12 @@ class BindTemplateSQLCHAR : public BindTemplate { } m_data.push_back(0); } - // void UpdateDataNull() { - // m_data.clear(); - // } private: std::vector< SQLCHAR > m_data; protected: SQLPOINTER GetDataForBind() { - // return m_data.size() == 0 ? NULL : m_data.data(); return m_data.data(); } SQLSMALLINT GetType() { @@ -317,8 +306,8 @@ void GetCatalogData(const std::string &query, StatementClass *stmt, StatementClass *sub_stmt, const TableResultSet res_type, std::string &table_type, void (*populate_binds)(bind_vector &), - void (*setup_qres_info)(QResultClass *, - EnvironmentClass *)); + void (*setup_qres_info)(QResultClass *, EnvironmentClass *), + std::vector< std::string > *list_of_columns = NULL); // Common function declarations void ConvertToString(std::string &out, bool &valid, const SQLCHAR *sql_char, @@ -405,7 +394,8 @@ void AssignTableBindTemplates(bind_vector &tabs); void SetupTableQResInfo(QResultClass *res, EnvironmentClass *env); void SetTableTuples(QResultClass *res, const TableResultSet res_type, const bind_vector &bind_tbl, std::string &table_type, - StatementClass *stmt, StatementClass *tbl_stmt); + StatementClass *stmt, StatementClass *tbl_stmt, + std::vector< std::string > *list_of_columns = NULL); // Table specific function declarations void split(const std::string &input, const std::string &delim, @@ -468,7 +458,8 @@ void SetupTableQResInfo(QResultClass *res, EnvironmentClass *env) { void SetTableTuples(QResultClass *res, const TableResultSet res_type, const bind_vector &bind_tbl, std::string &table_type, - StatementClass *stmt, StatementClass *tbl_stmt) { + StatementClass *stmt, StatementClass *tbl_stmt, + std::vector< std::string > *list_of_columns) { auto CheckResult = [&](const auto &res) { if (res != SQL_NO_DATA_FOUND) { SC_full_error_copy(stmt, tbl_stmt, FALSE); @@ -487,15 +478,24 @@ void SetTableTuples(QResultClass *res, const TableResultSet res_type, // General case if (res_type == TableResultSet::All) { RETCODE result = SQL_NO_DATA_FOUND; + int ordinal_position = 0; while (SQL_SUCCEEDED(result = ESAPI_Fetch(tbl_stmt))) { if (bind_tbl[TABLES_TABLE_TYPE]->AsString() == "BASE TABLE") { std::string table("TABLE"); bind_tbl[TABLES_TABLE_TYPE]->UpdateData(&table, table.size()); } - // if (bind_tbl[TABLES_CATALOG_NAME]->AsString() != "") { - // bind_tbl[TABLES_CATALOG_NAME]->UpdateDataNull(); - // } - AssignData(res, bind_tbl); + if (list_of_columns != NULL && !list_of_columns->empty()) { + if (std::find(list_of_columns->begin(), list_of_columns->end(), + bind_tbl[COLUMNS_COLUMN_NAME]->AsString()) + != list_of_columns->end()) { + ordinal_position++; + bind_tbl[COLUMNS_ORDINAL_POSITION]->UpdateData( + &ordinal_position, 0); + AssignData(res, bind_tbl); + } + } else { + AssignData(res, bind_tbl); + } } CheckResult(result); } else if (res_type == TableResultSet::TableLookUp) { @@ -514,10 +514,6 @@ void SetTableTuples(QResultClass *res, const TableResultSet res_type, std::string table("TABLE"); bind_tbl[TABLES_TABLE_TYPE]->UpdateData(&table, table.size()); } - if (bind_tbl[TABLES_CATALOG_NAME]->AsString() != "") { - std::string table(""); - bind_tbl[TABLES_CATALOG_NAME]->UpdateData(&table, table.size()); - } if (std::find(table_types.begin(), table_types.end(), bind_tbl[TABLES_TABLE_TYPE]->AsString()) != table_types.end()) { @@ -542,18 +538,7 @@ void SetTableTuples(QResultClass *res, const TableResultSet res_type, // Get index of result type of interest size_t idx = NUM_OF_TABLES_FIELDS; switch (res_type) { - case TableResultSet::Catalog: - MYLOG(ES_WARNING, "TRS::Catalog\n"); - return; - idx = TABLES_CATALOG_NAME; - break; - case TableResultSet::Schema: - MYLOG(ES_WARNING, "TRS::Schema\n"); - return; - idx = TABLES_SCHEMA_NAME; - break; case TableResultSet::TableTypes: - MYLOG(ES_WARNING, "TRS::TableTypes\n"); idx = TABLES_TABLE_TYPE; break; default: @@ -562,9 +547,6 @@ void SetTableTuples(QResultClass *res, const TableResultSet res_type, "Result type is not an expected type."); } - // if (bind_tbl[TABLES_CATALOG_NAME]->AsString() != "") { - // bind_tbl[TABLES_CATALOG_NAME]->UpdateDataNull(); - // } // Get new tuple and assign index of interest (NULL others) // TODO #324 (SQL Plugin)- Should these be unique? TupleField *tuple = QR_AddNew(res); @@ -665,8 +647,8 @@ void GetCatalogData(const std::string &query, StatementClass *stmt, StatementClass *sub_stmt, const TableResultSet res_type, std::string &table_type, void (*populate_binds)(bind_vector &), - void (*setup_qres_info)(QResultClass *, - EnvironmentClass *)) { + void (*setup_qres_info)(QResultClass *, EnvironmentClass *), + std::vector< std::string > *list_of_columns) { // Execute query ExecuteQuery(SC_get_conn(stmt), reinterpret_cast< HSTMT * >(&sub_stmt), query); @@ -682,8 +664,8 @@ void GetCatalogData(const std::string &query, StatementClass *stmt, // Setup QResultClass (*setup_qres_info)( res, static_cast< EnvironmentClass * >(CC_get_env(SC_get_conn(stmt)))); - SetTableTuples(res, res_type, binds, table_type, stmt, sub_stmt); - + SetTableTuples(res, res_type, binds, table_type, stmt, sub_stmt, + list_of_columns); CleanUp(stmt, sub_stmt, SQL_SUCCESS); } @@ -752,9 +734,19 @@ ESAPI_Tables(HSTMT hstmt, const SQLCHAR *catalog_name_sql, std::string query; GenerateTableQuery(query, flag, table_name, result_type, table_valid); + // Get list of columns with SELECT * query since columns doesn't match + // with DESCRIBE & SELECT * query + std::vector< std::string > list_of_columns; + if (table_valid) { + ConnectionClass *conn = SC_get_conn(stmt); + list_of_columns = + ESGetColumnsWithSelectQuery(conn->esconn, table_name); + } + // TODO #324 (SQL Plugin)- evaluate catalog & schema support GetCatalogData(query, stmt, tbl_stmt, result_type, table_type, - AssignTableBindTemplates, SetupTableQResInfo); + AssignColumnBindTemplates, SetupColumnQResInfo, + &list_of_columns); return SQL_SUCCESS; } catch (std::bad_alloc &e) { std::string error_msg = std::string("Bad allocation exception: '") From fe625802ac51cd091867d323d744c47bc47a71a8 Mon Sep 17 00:00:00 2001 From: Jordan Wilson Date: Fri, 10 Jul 2020 17:06:38 -0700 Subject: [PATCH 3/4] fix --- sql-odbc/src/odfesqlodbc/es_info.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/sql-odbc/src/odfesqlodbc/es_info.cpp b/sql-odbc/src/odfesqlodbc/es_info.cpp index 8c319ecaf4..a38a473d0b 100644 --- a/sql-odbc/src/odfesqlodbc/es_info.cpp +++ b/sql-odbc/src/odfesqlodbc/es_info.cpp @@ -745,8 +745,7 @@ ESAPI_Tables(HSTMT hstmt, const SQLCHAR *catalog_name_sql, // TODO #324 (SQL Plugin)- evaluate catalog & schema support GetCatalogData(query, stmt, tbl_stmt, result_type, table_type, - AssignColumnBindTemplates, SetupColumnQResInfo, - &list_of_columns); + AssignTableBindTemplates, SetupTableQResInfo); return SQL_SUCCESS; } catch (std::bad_alloc &e) { std::string error_msg = std::string("Bad allocation exception: '") @@ -803,10 +802,22 @@ ESAPI_Columns(HSTMT hstmt, const SQLCHAR *catalog_name_sql, // TODO #324 (SQL Plugin)- evaluate catalog & schema support + // Get list of columns with SELECT * query since columns doesn't match + // with DESCRIBE & SELECT * query + std::vector< std::string > list_of_columns; + if (table_valid) { + ConnectionClass *conn = SC_get_conn(stmt); + list_of_columns = + ESGetColumnsWithSelectQuery(conn->esconn, table_name); + } + + // TODO #324 (SQL Plugin)- evaluate catalog & schema support + // Execute query std::string table_type = ""; GetCatalogData(query, stmt, col_stmt, TableResultSet::All, table_type, - AssignColumnBindTemplates, SetupColumnQResInfo); + AssignColumnBindTemplates, SetupColumnQResInfo, + &list_of_columns); return SQL_SUCCESS; } catch (std::bad_alloc &e) { std::string error_msg = std::string("Bad allocation exception: '") From 030fa689512a8b03998c3818cc5a915cb053f34a Mon Sep 17 00:00:00 2001 From: Jordan Wilson Date: Mon, 13 Jul 2020 10:23:18 -0700 Subject: [PATCH 4/4] remove misplaced changes --- sql-odbc/src/odfesqlodbc/es_info.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/sql-odbc/src/odfesqlodbc/es_info.cpp b/sql-odbc/src/odfesqlodbc/es_info.cpp index a38a473d0b..3852efb238 100644 --- a/sql-odbc/src/odfesqlodbc/es_info.cpp +++ b/sql-odbc/src/odfesqlodbc/es_info.cpp @@ -734,15 +734,6 @@ ESAPI_Tables(HSTMT hstmt, const SQLCHAR *catalog_name_sql, std::string query; GenerateTableQuery(query, flag, table_name, result_type, table_valid); - // Get list of columns with SELECT * query since columns doesn't match - // with DESCRIBE & SELECT * query - std::vector< std::string > list_of_columns; - if (table_valid) { - ConnectionClass *conn = SC_get_conn(stmt); - list_of_columns = - ESGetColumnsWithSelectQuery(conn->esconn, table_name); - } - // TODO #324 (SQL Plugin)- evaluate catalog & schema support GetCatalogData(query, stmt, tbl_stmt, result_type, table_type, AssignTableBindTemplates, SetupTableQResInfo); @@ -800,8 +791,6 @@ ESAPI_Columns(HSTMT hstmt, const SQLCHAR *catalog_name_sql, GenerateColumnQuery(query, table_name, column_name, table_valid, column_valid, flag); - // TODO #324 (SQL Plugin)- evaluate catalog & schema support - // Get list of columns with SELECT * query since columns doesn't match // with DESCRIBE & SELECT * query std::vector< std::string > list_of_columns;