Skip to content

Commit

Permalink
[AD-637] Workaround error SQLPrimaryKeys ( return stub/empty) (#42)
Browse files Browse the repository at this point in the history
### Summary

[AD-637] Workaround error SQLPrimaryKeys ( return stub/empty)

### Description

Return SQL_NO_DATA in all cases.

### Related Issue

https://bitquill.atlassian.net/browse/AD-637

* [AD-637] [ODBC] Workaround error SQLPrimaryKeys ( return stub/empty)

* [AD-637] * Attempt change to make MacOS test not crash.

* [AD-637] * Attempt change to make MacOS test not crash.

* [AD-637] * Attempt change to make MacOS test not crash.

* [AD-637] * Revert test back to baseline.

* [AD-637] * Attempt change to make MacOS test not crash.
  • Loading branch information
Bruce Irschick authored Mar 17, 2022
1 parent 3205ee6 commit e6429aa
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 54 deletions.
1 change: 1 addition & 0 deletions src/odbc-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ else ()
endif()

set(SOURCES
src/api_robustness_test.cpp
src/configuration_test.cpp
src/connection_test.cpp
src/java_test.cpp
Expand Down
32 changes: 32 additions & 0 deletions src/odbc-test/input/api_robustness_test_001.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"_id":{
"$oid":"62196dcc4d91892191475139"
},
"fieldDecimal128":{
"$numberDecimal":"Infinity"
},
"fieldDouble":1.7976931348623157E308,
"fieldString":"新年快乐",
"fieldObjectId":{
"$oid":"62196dcc4d9189219147513a"
},
"fieldBoolean":true,
"fieldDate":{
"$date":"2020-01-01T00:00:00Z"
},
"fieldInt":2147483647,
"fieldLong":9223372036854775807,
"fieldMaxKey":{
"$maxKey":1
},
"fieldMinKey":{
"$minKey":1
},
"fieldNull":null,
"fieldBinary":{
"$binary":{
"base64":"AAEC",
"subType":"00"
}
}
}
94 changes: 53 additions & 41 deletions src/odbc-test/src/api_robustness_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,11 @@ using ignite::impl::binary::BinaryUtils;
* Test setup fixture.
*/
struct ApiRobustnessTestSuiteFixture : public odbc::OdbcTestSuite {
static Ignite StartAdditionalNode(const char* name) {
return StartPlatformNode("queries-test.xml", name);
}

/**
* Constructor.
*/
ApiRobustnessTestSuiteFixture() : testCache(0) {
grid = StartAdditionalNode("NodeMain");

testCache = grid.GetCache< int64_t, TestType >("cache");
// No-op
}

/**
Expand Down Expand Up @@ -114,9 +108,6 @@ struct ApiRobustnessTestSuiteFixture : public odbc::OdbcTestSuite {
// No-op.
}

/** Node started during the test. */
Ignite grid;

/** Test cache instance. */
Cache< int64_t, TestType > testCache;
};
Expand Down Expand Up @@ -155,7 +146,28 @@ SQLSMALLINT unsupportedSql[] = {SQL_WVARCHAR,

BOOST_FIXTURE_TEST_SUITE(ApiRobustnessTestSuite, ApiRobustnessTestSuiteFixture)

BOOST_AUTO_TEST_CASE(TestSQLDriverConnect) {
BOOST_AUTO_TEST_CASE(TestSQLPrimaryKeysEmpty) {
std::string dsnConnectionString;
std::string databaseName = "odbc-test";
CreateDsnConnectionStringForLocalServer(dsnConnectionString, databaseName);

Connect(dsnConnectionString);

SQLCHAR empty[] = "";
SQLCHAR schema[] = "odbc-test";
SQLCHAR tableName[] = "api_robustness_test_001";

SQLRETURN ret;
ret = SQLPrimaryKeys(stmt, empty, sizeof(empty), schema, sizeof(schema),
tableName, sizeof(tableName));
if (!SQL_SUCCEEDED(ret)) {
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
}
ret = SQLFetch(stmt);
BOOST_CHECK_EQUAL(SQL_NO_DATA, ret);
}

BOOST_AUTO_TEST_CASE(TestSQLDriverConnect, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -201,7 +213,7 @@ BOOST_AUTO_TEST_CASE(TestSQLDriverConnect) {
SQLDisconnect(dbc);
}

BOOST_AUTO_TEST_CASE(TestSQLConnect) {
BOOST_AUTO_TEST_CASE(TestSQLConnect, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -232,7 +244,7 @@ BOOST_AUTO_TEST_CASE(TestSQLConnect) {
SQLGetInfo(dbc, SQL_DRIVER_NAME, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLPrepare) {
BOOST_AUTO_TEST_CASE(TestSQLPrepare, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -263,7 +275,7 @@ BOOST_AUTO_TEST_CASE(TestSQLPrepare) {
SQLCloseCursor(stmt);
}

BOOST_AUTO_TEST_CASE(TestSQLExecDirect) {
BOOST_AUTO_TEST_CASE(TestSQLExecDirect, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -294,7 +306,7 @@ BOOST_AUTO_TEST_CASE(TestSQLExecDirect) {
SQLCloseCursor(stmt);
}

BOOST_AUTO_TEST_CASE(TestSQLExtendedFetch) {
BOOST_AUTO_TEST_CASE(TestSQLExtendedFetch, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -332,7 +344,7 @@ BOOST_AUTO_TEST_CASE(TestSQLExtendedFetch) {
SQLExtendedFetch(stmt, SQL_FETCH_NEXT, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLNumResultCols) {
BOOST_AUTO_TEST_CASE(TestSQLNumResultCols, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -363,7 +375,7 @@ BOOST_AUTO_TEST_CASE(TestSQLNumResultCols) {
SQLNumResultCols(stmt, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLTables) {
BOOST_AUTO_TEST_CASE(TestSQLTables, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -392,7 +404,7 @@ BOOST_AUTO_TEST_CASE(TestSQLTables) {
SQLTables(dbc, 0, 0, 0, 0, 0, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLColumns) {
BOOST_AUTO_TEST_CASE(TestSQLColumns, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -421,7 +433,7 @@ BOOST_AUTO_TEST_CASE(TestSQLColumns) {
SQLColumns(dbc, 0, 0, 0, 0, 0, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLBindCol) {
BOOST_AUTO_TEST_CASE(TestSQLBindCol, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -460,7 +472,7 @@ BOOST_AUTO_TEST_CASE(TestSQLBindCol) {
SQLBindCol(stmt, 4, SQL_C_SLONG, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLBindParameter) {
BOOST_AUTO_TEST_CASE(TestSQLBindParameter, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -514,7 +526,7 @@ BOOST_AUTO_TEST_CASE(TestSQLBindParameter) {
0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLNativeSql) {
BOOST_AUTO_TEST_CASE(TestSQLNativeSql, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -549,7 +561,7 @@ BOOST_AUTO_TEST_CASE(TestSQLNativeSql) {
SQLNativeSql(dbc, sql, 0, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLColAttribute) {
BOOST_AUTO_TEST_CASE(TestSQLColAttribute, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -596,7 +608,7 @@ BOOST_AUTO_TEST_CASE(TestSQLColAttribute) {
SQLColAttribute(stmt, 1, SQL_DESC_COUNT, 0, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLDescribeCol) {
BOOST_AUTO_TEST_CASE(TestSQLDescribeCol, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -638,7 +650,7 @@ BOOST_AUTO_TEST_CASE(TestSQLDescribeCol) {
SQLDescribeCol(stmt, 1, 0, 0, 0, 0, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLRowCount) {
BOOST_AUTO_TEST_CASE(TestSQLRowCount, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand All @@ -660,7 +672,7 @@ BOOST_AUTO_TEST_CASE(TestSQLRowCount) {
SQLRowCount(stmt, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLForeignKeys) {
BOOST_AUTO_TEST_CASE(TestSQLForeignKeys, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -765,7 +777,7 @@ BOOST_AUTO_TEST_CASE(TestSQLForeignKeys) {
SQLCloseCursor(stmt);
}

BOOST_AUTO_TEST_CASE(TestSQLGetStmtAttr) {
BOOST_AUTO_TEST_CASE(TestSQLGetStmtAttr, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand All @@ -786,7 +798,7 @@ BOOST_AUTO_TEST_CASE(TestSQLGetStmtAttr) {
SQLGetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLSetStmtAttr) {
BOOST_AUTO_TEST_CASE(TestSQLSetStmtAttr, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand All @@ -807,7 +819,7 @@ BOOST_AUTO_TEST_CASE(TestSQLSetStmtAttr) {
SQLSetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLPrimaryKeys) {
BOOST_AUTO_TEST_CASE(TestSQLPrimaryKeys, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -839,7 +851,7 @@ BOOST_AUTO_TEST_CASE(TestSQLPrimaryKeys) {
SQLPrimaryKeys(stmt, 0, 0, 0, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLNumParams) {
BOOST_AUTO_TEST_CASE(TestSQLNumParams, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand All @@ -862,7 +874,7 @@ BOOST_AUTO_TEST_CASE(TestSQLNumParams) {
SQLNumParams(stmt, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLNumParamsEscaped) {
BOOST_AUTO_TEST_CASE(TestSQLNumParamsEscaped, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand All @@ -885,7 +897,7 @@ BOOST_AUTO_TEST_CASE(TestSQLNumParamsEscaped) {
SQLNumParams(stmt, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLGetDiagField) {
BOOST_AUTO_TEST_CASE(TestSQLGetDiagField, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -914,7 +926,7 @@ BOOST_AUTO_TEST_CASE(TestSQLGetDiagField) {
SQLGetDiagField(SQL_HANDLE_STMT, stmt, 1, SQL_DIAG_MESSAGE_TEXT, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLGetDiagRec) {
BOOST_AUTO_TEST_CASE(TestSQLGetDiagRec, *disabled()) {
Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache");

SQLCHAR state[ODBC_BUFFER_SIZE];
Expand Down Expand Up @@ -956,7 +968,7 @@ BOOST_AUTO_TEST_CASE(TestSQLGetDiagRec) {
SQLGetDiagRec(SQL_HANDLE_STMT, stmt, 1, 0, 0, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLGetData) {
BOOST_AUTO_TEST_CASE(TestSQLGetData, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -1007,7 +1019,7 @@ BOOST_AUTO_TEST_CASE(TestSQLGetData) {
SQLFetch(stmt);
}

BOOST_AUTO_TEST_CASE(TestSQLGetEnvAttr) {
BOOST_AUTO_TEST_CASE(TestSQLGetEnvAttr, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand All @@ -1028,7 +1040,7 @@ BOOST_AUTO_TEST_CASE(TestSQLGetEnvAttr) {
SQLGetEnvAttr(env, SQL_ATTR_ODBC_VERSION, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLSpecialColumns) {
BOOST_AUTO_TEST_CASE(TestSQLSpecialColumns, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -1090,19 +1102,19 @@ BOOST_AUTO_TEST_CASE(TestSQLSpecialColumns) {
SQLCloseCursor(stmt);
}

BOOST_AUTO_TEST_CASE(TestFetchScrollLast) {
BOOST_AUTO_TEST_CASE(TestFetchScrollLast, *disabled()) {
CheckFetchScrollUnsupportedOrientation(SQL_FETCH_LAST);
}

BOOST_AUTO_TEST_CASE(TestFetchScrollPrior) {
BOOST_AUTO_TEST_CASE(TestFetchScrollPrior, *disabled()) {
CheckFetchScrollUnsupportedOrientation(SQL_FETCH_PRIOR);
}

BOOST_AUTO_TEST_CASE(TestFetchScrollFirst) {
BOOST_AUTO_TEST_CASE(TestFetchScrollFirst, *disabled()) {
CheckFetchScrollUnsupportedOrientation(SQL_FETCH_FIRST);
}

BOOST_AUTO_TEST_CASE(TestSQLError) {
BOOST_AUTO_TEST_CASE(TestSQLError, *disabled()) {
// There are no checks because we do not really care what is the result of
// these calls as long as they do not cause segmentation fault.

Expand Down Expand Up @@ -1149,7 +1161,7 @@ BOOST_AUTO_TEST_CASE(TestSQLError) {
SQLError(0, 0, 0, 0, 0, 0, 0, 0);
}

BOOST_AUTO_TEST_CASE(TestSQLDiagnosticRecords) {
BOOST_AUTO_TEST_CASE(TestSQLDiagnosticRecords, *disabled()) {
Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache");

SQLHANDLE hnd;
Expand All @@ -1163,7 +1175,7 @@ BOOST_AUTO_TEST_CASE(TestSQLDiagnosticRecords) {
CheckSQLStatementDiagnosticError("HY092");
}

BOOST_AUTO_TEST_CASE(TestManyFds) {
BOOST_AUTO_TEST_CASE(TestManyFds, *disabled()) {
enum { FDS_NUM = 2000 };

std::FILE* fds[FDS_NUM];
Expand Down
Loading

0 comments on commit e6429aa

Please sign in to comment.