IGNITE-3581: Implemented for enums from ODBC
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5c4b7b03 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5c4b7b03 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5c4b7b03 Branch: refs/heads/ignite-3581 Commit: 5c4b7b03d400d511b97865d433c211206df19a0f Parents: 53f9368 Author: Igor Sapego <[email protected]> Authored: Wed Apr 12 17:19:01 2017 +0300 Committer: Igor Sapego <[email protected]> Committed: Thu Apr 13 14:40:02 2017 +0300 ---------------------------------------------------------------------- .../src/application_data_buffer_test.cpp | 94 ++--- .../platforms/cpp/odbc-test/src/column_test.cpp | 56 +-- .../cpp/odbc-test/src/connection_info_test.cpp | 72 ++-- .../platforms/cpp/odbc-test/src/row_test.cpp | 16 +- .../ignite/odbc/app/application_data_buffer.h | 6 +- .../cpp/odbc/include/ignite/odbc/column.h | 2 +- .../cpp/odbc/include/ignite/odbc/common_types.h | 350 +++++++++-------- .../ignite/odbc/config/connection_info.h | 2 +- .../cpp/odbc/include/ignite/odbc/connection.h | 18 +- .../ignite/odbc/diagnostic/diagnosable.h | 4 +- .../odbc/diagnostic/diagnosable_adapter.h | 8 +- .../ignite/odbc/diagnostic/diagnostic_record.h | 4 +- .../odbc/diagnostic/diagnostic_record_storage.h | 8 +- .../cpp/odbc/include/ignite/odbc/environment.h | 10 +- .../cpp/odbc/include/ignite/odbc/message.h | 56 +-- .../ignite/odbc/query/column_metadata_query.h | 10 +- .../odbc/include/ignite/odbc/query/data_query.h | 23 +- .../ignite/odbc/query/foreign_keys_query.h | 8 +- .../ignite/odbc/query/primary_keys_query.h | 8 +- .../cpp/odbc/include/ignite/odbc/query/query.h | 32 +- .../ignite/odbc/query/special_columns_query.h | 8 +- .../ignite/odbc/query/table_metadata_query.h | 10 +- .../include/ignite/odbc/query/type_info_query.h | 8 +- .../cpp/odbc/include/ignite/odbc/row.h | 2 +- .../cpp/odbc/include/ignite/odbc/statement.h | 52 +-- .../odbc/system/ui/dsn_configuration_window.h | 35 +- .../cpp/odbc/include/ignite/odbc/type_traits.h | 91 ++--- .../ignite/odbc/system/ui/custom_window.h | 12 +- .../odbc/os/win/src/system/ui/custom_window.cpp | 4 +- .../src/system/ui/dsn_configuration_window.cpp | 42 +- .../cpp/odbc/os/win/src/system_dsn.cpp | 2 +- .../odbc/src/app/application_data_buffer.cpp | 386 +++++++++---------- .../platforms/cpp/odbc/src/app/parameter.cpp | 6 +- modules/platforms/cpp/odbc/src/column.cpp | 14 +- modules/platforms/cpp/odbc/src/common_types.cpp | 54 +-- .../cpp/odbc/src/config/connection_info.cpp | 12 +- modules/platforms/cpp/odbc/src/connection.cpp | 74 ++-- .../odbc/src/diagnostic/diagnosable_adapter.cpp | 4 +- .../odbc/src/diagnostic/diagnostic_record.cpp | 46 +-- .../diagnostic/diagnostic_record_storage.cpp | 78 ++-- modules/platforms/cpp/odbc/src/environment.cpp | 62 +-- modules/platforms/cpp/odbc/src/odbc.cpp | 20 +- .../odbc/src/query/column_metadata_query.cpp | 123 +++--- .../platforms/cpp/odbc/src/query/data_query.cpp | 102 ++--- .../cpp/odbc/src/query/foreign_keys_query.cpp | 26 +- .../cpp/odbc/src/query/primary_keys_query.cpp | 71 ++-- .../odbc/src/query/special_columns_query.cpp | 26 +- .../cpp/odbc/src/query/table_metadata_query.cpp | 81 ++-- .../cpp/odbc/src/query/type_info_query.cpp | 231 +++++------ modules/platforms/cpp/odbc/src/row.cpp | 4 +- modules/platforms/cpp/odbc/src/statement.cpp | 258 ++++++------- modules/platforms/cpp/odbc/src/type_traits.cpp | 46 +-- 52 files changed, 1410 insertions(+), 1367 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp b/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp index cca1dad..4454066 100644 --- a/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp @@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(TestPutIntToString) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, buffer, sizeof(buffer), &reslen, &offset); appBuf.PutInt8(12); BOOST_CHECK(!strcmp(buffer, "12")); @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(TestPutFloatToString) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, buffer, sizeof(buffer), &reslen, &offset); appBuf.PutFloat(12.42f); BOOST_CHECK(!strcmp(buffer, "12.42")); @@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE(TestPutGuidToString) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, buffer, sizeof(buffer), &reslen, &offset); ignite::Guid guid(0x1da1ef8f39ff4d62ULL, 0x8b72e8e9f3371801ULL); @@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE(TestPutBinaryToString) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, buffer, sizeof(buffer), &reslen, &offset); uint8_t binary[] = { 0x21, 0x84, 0xF4, 0xDC, 0x01, 0x00, 0xFF, 0xF0 }; @@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToString) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, buffer, sizeof(buffer), &reslen, &offset); std::string testString("Test string"); @@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToWstring) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_WCHAR, buffer, sizeof(buffer), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_WCHAR, buffer, sizeof(buffer), &reslen, &offset); std::string testString("Test string"); @@ -166,7 +166,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToLong) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, &offset); appBuf.PutString("424242424"); BOOST_CHECK(numBuf == 424242424L); @@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToTiny) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_TINYINT, &numBuf, sizeof(numBuf), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_SIGNED_TINYINT, &numBuf, sizeof(numBuf), &reslen, &offset); appBuf.PutString("12"); BOOST_CHECK(numBuf == 12); @@ -196,7 +196,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToFloat) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset); appBuf.PutString("12.21"); BOOST_CHECK_CLOSE_FRACTION(numBuf, 12.21, FLOAT_PRECISION); @@ -211,7 +211,7 @@ BOOST_AUTO_TEST_CASE(TestPutIntToFloat) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset); appBuf.PutInt8(5); BOOST_CHECK_CLOSE_FRACTION(numBuf, 5.0, FLOAT_PRECISION); @@ -238,7 +238,7 @@ BOOST_AUTO_TEST_CASE(TestPutFloatToShort) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_SHORT, &numBuf, sizeof(numBuf), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_SIGNED_SHORT, &numBuf, sizeof(numBuf), &reslen, &offset); appBuf.PutDouble(5.42); BOOST_CHECK(numBuf == 5); @@ -258,7 +258,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToDouble) double numBuf; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &numBuf, sizeof(numBuf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_DOUBLE, &numBuf, sizeof(numBuf), &reslen, 0); common::Decimal decimal; @@ -287,7 +287,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToLong) long numBuf; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, 0); common::Decimal decimal; @@ -314,7 +314,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToString) char strBuf[64]; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); common::Decimal decimal; @@ -341,7 +341,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToNumeric) SQL_NUMERIC_STRUCT buf; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_NUMERIC, &buf, sizeof(buf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_NUMERIC, &buf, sizeof(buf), &reslen, 0); common::Decimal decimal; @@ -392,7 +392,7 @@ BOOST_AUTO_TEST_CASE(TestPutDateToString) char strBuf[64] = { 0 }; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); Date date = common::MakeDateGmt(1999, 2, 22); @@ -409,7 +409,7 @@ BOOST_AUTO_TEST_CASE(TestPutDateToDate) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); Date date = common::MakeDateGmt(1984, 5, 27); @@ -429,7 +429,7 @@ BOOST_AUTO_TEST_CASE(TestPutDateToTimestamp) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); Date date = common::MakeDateGmt(1984, 5, 27); @@ -449,7 +449,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimeToString) char strBuf[64] = { 0 }; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); Time time = common::MakeTimeGmt(7, 15, 0); @@ -466,7 +466,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimeToTime) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIME, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIME, &buf, sizeof(buf), &reslen, &offsetPtr); Time time = common::MakeTimeGmt(23, 51, 1); @@ -482,7 +482,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimestampToString) char strBuf[64] = { 0 }; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); Timestamp date = common::MakeTimestampGmt(2018, 11, 1, 17, 45, 59); @@ -499,7 +499,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimestampToDate) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); Timestamp ts = common::MakeTimestampGmt(2004, 8, 14, 6, 34, 51, 573948623); @@ -518,7 +518,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimestampToTime) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIME, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIME, &buf, sizeof(buf), &reslen, &offsetPtr); Timestamp ts = common::MakeTimestampGmt(2004, 8, 14, 6, 34, 51, 573948623); @@ -537,7 +537,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimestampToTimestamp) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); Timestamp ts = common::MakeTimestampGmt(2004, 8, 14, 6, 34, 51, 573948623); @@ -557,7 +557,7 @@ BOOST_AUTO_TEST_CASE(TestGetGuidFromString) char buffer[] = "1da1ef8f-39ff-4d62-8b72-e8e9f3371801"; SqlLen reslen = sizeof(buffer) - 1; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer) - 1, &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, buffer, sizeof(buffer) - 1, &reslen, 0); ignite::Guid guid = appBuf.GetGuid(); @@ -570,7 +570,7 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromLong) SqlLen reslen = sizeof(numBuf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_SIGNED_LONG, &numBuf, reslen, &reslen, &offset); std::string res = appBuf.GetString(32); @@ -589,7 +589,7 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromDouble) SqlLen reslen = sizeof(numBuf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &numBuf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_DOUBLE, &numBuf, reslen, &reslen, &offset); std::string res = appBuf.GetString(32); @@ -608,7 +608,7 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromString) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf, reslen, &reslen, &offset); std::string res = appBuf.GetString(reslen); @@ -621,7 +621,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromUshort) SqlLen reslen = sizeof(numBuf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_UNSIGNED_SHORT, &numBuf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_UNSIGNED_SHORT, &numBuf, reslen, &reslen, &offset); float resFloat = appBuf.GetFloat(); @@ -638,7 +638,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromString) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf, reslen, &reslen, &offset); float resFloat = appBuf.GetFloat(); @@ -655,7 +655,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromFloat) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_FLOAT, &buf, reslen, &reslen, &offset); float resFloat = appBuf.GetFloat(); @@ -672,7 +672,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromDouble) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_DOUBLE, &buf, reslen, &reslen, &offset); float resFloat = appBuf.GetFloat(); @@ -689,7 +689,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromString) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf, reslen, &reslen, &offset); int64_t resInt64 = appBuf.GetInt64(); @@ -714,7 +714,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromFloat) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_FLOAT, &buf, reslen, &reslen, &offset); int64_t resInt64 = appBuf.GetInt64(); @@ -739,7 +739,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromDouble) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_DOUBLE, &buf, reslen, &reslen, &offset); int64_t resInt64 = appBuf.GetInt64(); @@ -764,7 +764,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromBigint) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_UNSIGNED_BIGINT, &buf, reslen, &reslen, &offset); int64_t resInt64 = appBuf.GetInt64(); @@ -799,7 +799,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntWithOffset) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT, &buf[0].val, sizeof(buf[0].val), &buf[0].reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_UNSIGNED_BIGINT, &buf[0].val, sizeof(buf[0].val), &buf[0].reslen, &offsetPtr); int64_t val = appBuf.GetInt64(); @@ -834,7 +834,7 @@ BOOST_AUTO_TEST_CASE(TestSetStringWithOffset) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf[0].val, sizeof(buf[0].val), &buf[0].reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf[0].val, sizeof(buf[0].val), &buf[0].reslen, &offsetPtr); appBuf.PutString("Hello Ignite!"); @@ -869,7 +869,7 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromString) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr); Date date = appBuf.GetDate(); @@ -895,7 +895,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimeFromString) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr); Time time = appBuf.GetTime(); @@ -921,7 +921,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromString) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr); Timestamp date = appBuf.GetTimestamp(); @@ -952,7 +952,7 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromDate) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); Date date = appBuf.GetDate(); @@ -983,7 +983,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromDate) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); Timestamp ts = appBuf.GetTimestamp(); @@ -1014,7 +1014,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromTime) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIME, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIME, &buf, sizeof(buf), &reslen, &offsetPtr); Time time = appBuf.GetTime(); @@ -1049,7 +1049,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromTimestamp) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); Timestamp ts = appBuf.GetTimestamp(); @@ -1085,7 +1085,7 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromTimestamp) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); Date date = appBuf.GetDate(); @@ -1120,7 +1120,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimeFromTimestamp) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); Time time = appBuf.GetTime(); http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc-test/src/column_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/column_test.cpp b/modules/platforms/cpp/odbc-test/src/column_test.cpp index 66d0214..adc40c4 100644 --- a/modules/platforms/cpp/odbc-test/src/column_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/column_test.cpp @@ -68,9 +68,9 @@ BOOST_AUTO_TEST_CASE(TestColumnShort) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_SIGNED_SHORT, &shortBuf, sizeof(shortBuf), &reslen, &offset); + ApplicationDataBuffer appBuf(type_traits::OdbcNativeType::AI_SIGNED_SHORT, &shortBuf, sizeof(shortBuf), &reslen, &offset); - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(column.IsValid()); @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE(TestColumnShort) BOOST_REQUIRE(shortBuf == data); - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); + BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SqlResult::AI_NO_DATA); BOOST_REQUIRE(column.IsValid()); @@ -116,9 +116,9 @@ BOOST_AUTO_TEST_CASE(TestColumnString) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, &offset); + ApplicationDataBuffer appBuf(type_traits::OdbcNativeType::AI_CHAR, &strBuf, sizeof(strBuf), &reslen, &offset); - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(column.IsValid()); @@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE(TestColumnString) BOOST_REQUIRE(std::string(strBuf) == data); - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); + BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SqlResult::AI_NO_DATA); BOOST_REQUIRE(column.IsValid()); @@ -166,9 +166,9 @@ BOOST_AUTO_TEST_CASE(TestColumnStringSeveral) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_CHAR, &strBuf[0], strBuf.size(), &reslen, &offset); + ApplicationDataBuffer appBuf(type_traits::OdbcNativeType::AI_CHAR, &strBuf[0], strBuf.size(), &reslen, &offset); - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(column.IsValid()); @@ -178,7 +178,7 @@ BOOST_AUTO_TEST_CASE(TestColumnStringSeveral) res.append(strBuf.c_str()); - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(column.IsValid()); @@ -188,7 +188,7 @@ BOOST_AUTO_TEST_CASE(TestColumnStringSeveral) res.append(strBuf.c_str()); - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(column.IsValid()); @@ -198,7 +198,7 @@ BOOST_AUTO_TEST_CASE(TestColumnStringSeveral) res.append(strBuf.c_str()); - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); + BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SqlResult::AI_NO_DATA); BOOST_REQUIRE(column.IsValid()); @@ -248,9 +248,9 @@ BOOST_AUTO_TEST_CASE(TestColumnMultiString) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, &offset); + ApplicationDataBuffer appBuf(type_traits::OdbcNativeType::AI_CHAR, &strBuf, sizeof(strBuf), &reslen, &offset); - BOOST_REQUIRE(column1.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(column1.ReadToBuffer(reader, appBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(column1.IsValid()); @@ -260,7 +260,7 @@ BOOST_AUTO_TEST_CASE(TestColumnMultiString) BOOST_REQUIRE(std::string(strBuf) == data1); - BOOST_REQUIRE(column1.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); + BOOST_REQUIRE(column1.ReadToBuffer(reader, appBuf) == SqlResult::AI_NO_DATA); BOOST_REQUIRE(column1.IsValid()); @@ -268,7 +268,7 @@ BOOST_AUTO_TEST_CASE(TestColumnMultiString) BOOST_REQUIRE(column1.GetUnreadDataLength() == 0); - BOOST_REQUIRE(column2.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(column2.ReadToBuffer(reader, appBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(column2.IsValid()); @@ -278,7 +278,7 @@ BOOST_AUTO_TEST_CASE(TestColumnMultiString) BOOST_REQUIRE(std::string(strBuf) == data2); - BOOST_REQUIRE(column2.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); + BOOST_REQUIRE(column2.ReadToBuffer(reader, appBuf) == SqlResult::AI_NO_DATA); BOOST_REQUIRE(column2.IsValid()); @@ -314,9 +314,9 @@ BOOST_AUTO_TEST_CASE(TestColumnByteArray) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_BINARY, &buf[0], buf.size(), &reslen, &offset); + ApplicationDataBuffer appBuf(type_traits::OdbcNativeType::AI_BINARY, &buf[0], buf.size(), &reslen, &offset); - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(column.IsValid()); @@ -326,7 +326,7 @@ BOOST_AUTO_TEST_CASE(TestColumnByteArray) BOOST_REQUIRE_EQUAL_COLLECTIONS(buf.begin(), buf.end(), data.begin(), data.end()); - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); + BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SqlResult::AI_NO_DATA); BOOST_REQUIRE(column.IsValid()); @@ -364,9 +364,9 @@ BOOST_AUTO_TEST_CASE(TestColumnByteArrayHalfBuffer) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_BINARY, &buf[0], buf.size(), &reslen, &offset); + ApplicationDataBuffer appBuf(type_traits::OdbcNativeType::AI_BINARY, &buf[0], buf.size(), &reslen, &offset); - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(column.IsValid()); @@ -378,7 +378,7 @@ BOOST_AUTO_TEST_CASE(TestColumnByteArrayHalfBuffer) result.reserve(data.size()); std::copy(buf.begin(), buf.end(), std::back_inserter(result)); - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(column.IsValid()); @@ -388,7 +388,7 @@ BOOST_AUTO_TEST_CASE(TestColumnByteArrayHalfBuffer) std::copy(buf.begin(), buf.end(), std::back_inserter(result)); - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); + BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SqlResult::AI_NO_DATA); BOOST_REQUIRE(column.IsValid()); @@ -437,9 +437,9 @@ BOOST_AUTO_TEST_CASE(TestColumnByteArrayTwoColumns) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_BINARY, &buf, sizeof(buf), &reslen, &offset); + ApplicationDataBuffer appBuf(type_traits::OdbcNativeType::AI_BINARY, &buf, sizeof(buf), &reslen, &offset); - BOOST_REQUIRE(column1.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(column1.ReadToBuffer(reader, appBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(column1.IsValid()); @@ -449,7 +449,7 @@ BOOST_AUTO_TEST_CASE(TestColumnByteArrayTwoColumns) BOOST_REQUIRE_EQUAL_COLLECTIONS(buf, buf + reslen, data1.begin(), data1.end()); - BOOST_REQUIRE(column1.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); + BOOST_REQUIRE(column1.ReadToBuffer(reader, appBuf) == SqlResult::AI_NO_DATA); BOOST_REQUIRE(column1.IsValid()); @@ -457,7 +457,7 @@ BOOST_AUTO_TEST_CASE(TestColumnByteArrayTwoColumns) BOOST_REQUIRE(column1.GetUnreadDataLength() == 0); - BOOST_REQUIRE(column2.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(column2.ReadToBuffer(reader, appBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(column2.IsValid()); @@ -467,7 +467,7 @@ BOOST_AUTO_TEST_CASE(TestColumnByteArrayTwoColumns) BOOST_REQUIRE_EQUAL_COLLECTIONS(buf, buf + reslen, data2.begin(), data2.end()); - BOOST_REQUIRE(column2.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); + BOOST_REQUIRE(column2.ReadToBuffer(reader, appBuf) == SqlResult::AI_NO_DATA); BOOST_REQUIRE(column2.IsValid()); http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc-test/src/connection_info_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/connection_info_test.cpp b/modules/platforms/cpp/odbc-test/src/connection_info_test.cpp index dd8d1f6..c2fe4f8 100644 --- a/modules/platforms/cpp/odbc-test/src/connection_info_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/connection_info_test.cpp @@ -38,181 +38,181 @@ BOOST_AUTO_TEST_CASE(TestConnectionInfoSupportedInfo) ConnectionInfo info; - SqlResult result; + SqlResult::Type result; #ifdef SQL_DRIVER_NAME result = info.GetInfo(SQL_DRIVER_NAME, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_DRIVER_NAME #ifdef SQL_DBMS_NAME result = info.GetInfo(SQL_DBMS_NAME, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_DBMS_NAME #ifdef SQL_DRIVER_ODBC_VER result = info.GetInfo(SQL_DRIVER_ODBC_VER, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_DRIVER_ODBC_VER #ifdef SQL_DBMS_VER result = info.GetInfo(SQL_DBMS_VER, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_DBMS_VER #ifdef SQL_DRIVER_VER result = info.GetInfo(SQL_DRIVER_VER, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_DRIVER_VER #ifdef SQL_COLUMN_ALIAS result = info.GetInfo(SQL_COLUMN_ALIAS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_COLUMN_ALIAS #ifdef SQL_IDENTIFIER_QUOTE_CHAR result = info.GetInfo(SQL_IDENTIFIER_QUOTE_CHAR, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_IDENTIFIER_QUOTE_CHAR #ifdef SQL_CATALOG_NAME_SEPARATOR result = info.GetInfo(SQL_CATALOG_NAME_SEPARATOR, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_CATALOG_NAME_SEPARATOR #ifdef SQL_SPECIAL_CHARACTERS result = info.GetInfo(SQL_SPECIAL_CHARACTERS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_SPECIAL_CHARACTERS #ifdef SQL_CATALOG_TERM result = info.GetInfo(SQL_CATALOG_TERM, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_CATALOG_TERM #ifdef SQL_TABLE_TERM result = info.GetInfo(SQL_TABLE_TERM, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_TABLE_TERM #ifdef SQL_SCHEMA_TERM result = info.GetInfo(SQL_SCHEMA_TERM, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_SCHEMA_TERM #ifdef SQL_ASYNC_DBC_FUNCTIONS result = info.GetInfo(SQL_ASYNC_DBC_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_ASYNC_DBC_FUNCTIONS #ifdef SQL_GETDATA_EXTENSIONS result = info.GetInfo(SQL_GETDATA_EXTENSIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_GETDATA_EXTENSIONS #ifdef SQL_ODBC_INTERFACE_CONFORMANCE result = info.GetInfo(SQL_ODBC_INTERFACE_CONFORMANCE, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_ODBC_INTERFACE_CONFORMANCE #ifdef SQL_SQL_CONFORMANCE result = info.GetInfo(SQL_SQL_CONFORMANCE, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_SQL_CONFORMANCE #ifdef SQL_CATALOG_USAGE result = info.GetInfo(SQL_CATALOG_USAGE, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_CATALOG_USAGE #ifdef SQL_SCHEMA_USAGE result = info.GetInfo(SQL_SCHEMA_USAGE, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_SCHEMA_USAGE #ifdef SQL_MAX_IDENTIFIER_LEN result = info.GetInfo(SQL_MAX_IDENTIFIER_LEN, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_MAX_IDENTIFIER_LEN #ifdef SQL_AGGREGATE_FUNCTIONS result = info.GetInfo(SQL_AGGREGATE_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_AGGREGATE_FUNCTIONS #ifdef SQL_AGGREGATE_FUNCTIONS result = info.GetInfo(SQL_NUMERIC_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_AGGREGATE_FUNCTIONS #ifdef SQL_STRING_FUNCTIONS result = info.GetInfo(SQL_STRING_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_STRING_FUNCTIONS #ifdef SQL_TIMEDATE_FUNCTIONS result = info.GetInfo(SQL_TIMEDATE_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_TIMEDATE_FUNCTIONS #ifdef SQL_TIMEDATE_ADD_INTERVALS result = info.GetInfo(SQL_TIMEDATE_ADD_INTERVALS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_TIMEDATE_ADD_INTERVALS #ifdef SQL_TIMEDATE_DIFF_INTERVALS result = info.GetInfo(SQL_TIMEDATE_DIFF_INTERVALS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_TIMEDATE_DIFF_INTERVALS #ifdef SQL_DATETIME_LITERALS result = info.GetInfo(SQL_DATETIME_LITERALS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_DATETIME_LITERALS #ifdef SQL_SYSTEM_FUNCTIONS result = info.GetInfo(SQL_SYSTEM_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_SYSTEM_FUNCTIONS #ifdef SQL_CONVERT_FUNCTIONS result = info.GetInfo(SQL_CONVERT_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_CONVERT_FUNCTIONS #ifdef SQL_OJ_CAPABILITIES result = info.GetInfo(SQL_OJ_CAPABILITIES, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_OJ_CAPABILITIES #ifdef SQL_POS_OPERATIONS result = info.GetInfo(SQL_POS_OPERATIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_POS_OPERATIONS #ifdef SQL_MAX_CONCURRENT_ACTIVITIES result = info.GetInfo(SQL_MAX_CONCURRENT_ACTIVITIES, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_MAX_CONCURRENT_ACTIVITIES #ifdef SQL_CURSOR_COMMIT_BEHAVIOR result = info.GetInfo(SQL_CURSOR_COMMIT_BEHAVIOR, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_CURSOR_COMMIT_BEHAVIOR #ifdef SQL_CURSOR_ROLLBACK_BEHAVIOR result = info.GetInfo(SQL_CURSOR_ROLLBACK_BEHAVIOR, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_CURSOR_ROLLBACK_BEHAVIOR #ifdef SQL_TXN_CAPABLE result = info.GetInfo(SQL_TXN_CAPABLE, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_TXN_CAPABLE #ifdef SQL_QUOTED_IDENTIFIER_CASE result = info.GetInfo(SQL_QUOTED_IDENTIFIER_CASE, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(result == SqlResult::AI_SUCCESS); #endif //SQL_QUOTED_IDENTIFIER_CASE } http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc-test/src/row_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/row_test.cpp b/modules/platforms/cpp/odbc-test/src/row_test.cpp index f38e9c5..c692291 100644 --- a/modules/platforms/cpp/odbc-test/src/row_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/row_test.cpp @@ -84,20 +84,20 @@ void CheckRowData(Row& row, size_t rowIdx) char bitBuf; int* offset = 0; - ApplicationDataBuffer appLongBuf(type_traits::IGNITE_ODBC_C_TYPE_SIGNED_LONG, &longBuf, sizeof(longBuf), &reslen, &offset); - ApplicationDataBuffer appStrBuf(type_traits::IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, &offset); - ApplicationDataBuffer appGuidBuf(type_traits::IGNITE_ODBC_C_TYPE_GUID, &guidBuf, sizeof(guidBuf), &reslen, &offset); - ApplicationDataBuffer appBitBuf(type_traits::IGNITE_ODBC_C_TYPE_BIT, &bitBuf, sizeof(bitBuf), &reslen, &offset); + ApplicationDataBuffer appLongBuf(type_traits::OdbcNativeType::AI_SIGNED_LONG, &longBuf, sizeof(longBuf), &reslen, &offset); + ApplicationDataBuffer appStrBuf(type_traits::OdbcNativeType::AI_CHAR, &strBuf, sizeof(strBuf), &reslen, &offset); + ApplicationDataBuffer appGuidBuf(type_traits::OdbcNativeType::AI_GUID, &guidBuf, sizeof(guidBuf), &reslen, &offset); + ApplicationDataBuffer appBitBuf(type_traits::OdbcNativeType::AI_BIT, &bitBuf, sizeof(bitBuf), &reslen, &offset); // Checking size. BOOST_REQUIRE(row.GetSize() == 4); // Checking 1st column. - BOOST_REQUIRE(row.ReadColumnToBuffer(1, appLongBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(row.ReadColumnToBuffer(1, appLongBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(longBuf == rowIdx * 10); // Checking 2nd column. - BOOST_REQUIRE(row.ReadColumnToBuffer(2, appStrBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(row.ReadColumnToBuffer(2, appStrBuf) == SqlResult::AI_SUCCESS); std::string strReal(strBuf, static_cast<size_t>(reslen)); std::string strExpected(GetStrColumnValue(rowIdx)); @@ -105,7 +105,7 @@ void CheckRowData(Row& row, size_t rowIdx) BOOST_REQUIRE(strReal == strExpected); // Checking 3rd column. - BOOST_REQUIRE(row.ReadColumnToBuffer(3, appGuidBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(row.ReadColumnToBuffer(3, appGuidBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(guidBuf.Data1 == 0x2b218f63UL); BOOST_REQUIRE(guidBuf.Data2 == 0x642aU); @@ -121,7 +121,7 @@ void CheckRowData(Row& row, size_t rowIdx) BOOST_REQUIRE(guidBuf.Data4[7] == 0x98 + rowIdx); // Checking 4th column. - BOOST_REQUIRE(row.ReadColumnToBuffer(4, appBitBuf) == SQL_RESULT_SUCCESS); + BOOST_REQUIRE(row.ReadColumnToBuffer(4, appBitBuf) == SqlResult::AI_SUCCESS); BOOST_REQUIRE(bitBuf == rowIdx % 2); } http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h b/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h index 31c2709..24461c2 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h @@ -57,7 +57,7 @@ namespace ignite * @param reslen Resulting data length. * @param offset Pointer to buffer and reslen offset pointer. */ - ApplicationDataBuffer(type_traits::IgniteSqlType type, void* buffer, + ApplicationDataBuffer(type_traits::OdbcNativeType::Type type, void* buffer, SqlLen buflen, SqlLen* reslen, int** offset = 0); /** @@ -341,7 +341,7 @@ namespace ignite * * @return Buffer type. */ - type_traits::IgniteSqlType GetType() const + type_traits::OdbcNativeType::Type GetType() const { return type; } @@ -413,7 +413,7 @@ namespace ignite T* ApplyOffset(T* ptr) const; /** Underlying data type. */ - type_traits::IgniteSqlType type; + type_traits::OdbcNativeType::Type type; /** Buffer pointer. */ void* buffer; http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/column.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/column.h b/modules/platforms/cpp/odbc/include/ignite/odbc/column.h index 1297279..a8b8863 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/column.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/column.h @@ -82,7 +82,7 @@ namespace ignite * @param dataBuf Application data buffer. * @return Operation result. */ - SqlResult ReadToBuffer(ignite::impl::binary::BinaryReaderImpl& reader, + SqlResult::Type ReadToBuffer(ignite::impl::binary::BinaryReaderImpl& reader, app::ApplicationDataBuffer& dataBuf); /** http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h b/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h index 5d8901d..0a3b02f 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h @@ -21,10 +21,6 @@ #include <stdint.h> #include "system/odbc_constants.h" -#include <ignite/odbc/system/odbc_constants.h> - -#include <ignite/odbc/system/odbc_constants.h> - namespace ignite { namespace odbc @@ -35,206 +31,218 @@ namespace ignite /** * SQL result. */ - enum SqlResult + struct SqlResult { - /** Success. */ - SQL_RESULT_SUCCESS, + enum Type + { + /** Success. */ + AI_SUCCESS, - /** Success with info. */ - SQL_RESULT_SUCCESS_WITH_INFO, + /** Success with info. */ + AI_SUCCESS_WITH_INFO, - /** Error. */ - SQL_RESULT_ERROR, + /** Error. */ + AI_ERROR, - /** No more data. */ - SQL_RESULT_NO_DATA, + /** No more data. */ + AI_NO_DATA, - /** No more data. */ - SQL_RESULT_NEED_DATA + /** No more data. */ + AI_NEED_DATA + }; }; /** * Provides detailed information about the cause of a warning or error. */ - enum SqlState + struct SqlState { - /** Undefined state. Internal, should never be exposed to user. */ - SQL_STATE_UNKNOWN, - - /** Output data has been truncated. */ - SQL_STATE_01004_DATA_TRUNCATED, - - /** Invalid connection string attribute. */ - SQL_STATE_01S00_INVALID_CONNECTION_STRING_ATTRIBUTE, - - /** Error in row. */ - SQL_STATE_01S01_ERROR_IN_ROW, - - /** - * The driver did not support the specified value and - * substituted a similar value. - */ - SQL_STATE_01S02_OPTION_VALUE_CHANGED, - - /** String data, length mismatch. */ - SQL_STATE_22026_DATA_LENGTH_MISMATCH, - - /** Invalid cursor state. */ - SQL_STATE_24000_INVALID_CURSOR_STATE, - - /** Invalid descriptor index. */ - SQL_STATE_07009_INVALID_DESCRIPTOR_INDEX, - - /** - * The driver was unable to establish a connection with the data - * source. - */ - SQL_STATE_08001_CANNOT_CONNECT, - - /** - * The specified ConnectionHandle had already been used - * to establish a connection with a data source, and the connection - * was still open. - */ - SQL_STATE_08002_ALREADY_CONNECTED, - - /** The connection specified was not open. */ - SQL_STATE_08003_NOT_CONNECTED, - - /** - * An error occurred for which there was no specific SQLSTATE - * and for which no implementation-specific SQLSTATE was defined. - */ - SQL_STATE_HY000_GENERAL_ERROR, - - /** - * The driver was unable to allocate memory for the specified - * handle. - */ - SQL_STATE_HY001_MEMORY_ALLOCATION, - - /** - * The argument TargetType was neither a valid data type - * nor SQL_C_DEFAULT - */ - SQL_STATE_HY003_INVALID_APPLICATION_BUFFER_TYPE, - - /** Invalid use of null pointer. */ - SQL_STATE_HY009_INVALID_USE_OF_NULL_POINTER, - - /** Function sequence error. */ - SQL_STATE_HY010_SEQUENCE_ERROR, - - /** - * Invalid string or buffer length - */ - SQL_STATE_HY090_INVALID_STRING_OR_BUFFER_LENGTH, - - /** - * Option type was out of range. - */ - SQL_STATE_HY092_OPTION_TYPE_OUT_OF_RANGE, - - /** Column type out of range. */ - SQL_STATE_HY097_COLUMN_TYPE_OUT_OF_RANGE, - - /** The value specified for the argument InputOutputType was invalid. */ - SQL_STATE_HY105_INVALID_PARAMETER_TYPE, - - /** The value specified for the argument FetchOrientation was invalid. */ - SQL_STATE_HY106_FETCH_TYPE_OUT_OF_RANGE, - - /** - * The driver does not support the feature of ODBC behavior that - * the application requested. - */ - SQL_STATE_HYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED, - - /** - * The connection timeout period expired before the data source - * responded to the request. - */ - SQL_STATE_HYT01_CONNECTIOIN_TIMEOUT, - - /** - * Driver does not support this function. - */ - SQL_STATE_IM001_FUNCTION_NOT_SUPPORTED + enum Type + { + /** Undefined state. Internal, should never be exposed to user. */ + UNKNOWN, + + /** Output data has been truncated. */ + S01004_DATA_TRUNCATED, + + /** Invalid connection string attribute. */ + S01S00_INVALID_CONNECTION_STRING_ATTRIBUTE, + + /** Error in row. */ + S01S01_ERROR_IN_ROW, + + /** + * The driver did not support the specified value and + * substituted a similar value. + */ + S01S02_OPTION_VALUE_CHANGED, + + /** String data, length mismatch. */ + S22026_DATA_LENGTH_MISMATCH, + + /** Invalid cursor state. */ + S24000_INVALID_CURSOR_STATE, + + /** Invalid descriptor index. */ + S07009_INVALID_DESCRIPTOR_INDEX, + + /** + * The driver was unable to establish a connection with the data + * source. + */ + S08001_CANNOT_CONNECT, + + /** + * The specified ConnectionHandle had already been used + * to establish a connection with a data source, and the connection + * was still open. + */ + S08002_ALREADY_CONNECTED, + + /** The connection specified was not open. */ + S08003_NOT_CONNECTED, + + /** + * An error occurred for which there was no specific SQLSTATE + * and for which no implementation-specific SQLSTATE was defined. + */ + SHY000_GENERAL_ERROR, + + /** + * The driver was unable to allocate memory for the specified + * handle. + */ + SHY001_MEMORY_ALLOCATION, + + /** + * The argument TargetType was neither a valid data type + * nor SQL_C_DEFAULT + */ + SHY003_INVALID_APPLICATION_BUFFER_TYPE, + + /** Invalid use of null pointer. */ + SHY009_INVALID_USE_OF_NULL_POINTER, + + /** Function sequence error. */ + SHY010_SEQUENCE_ERROR, + + /** + * Invalid string or buffer length + */ + SHY090_INVALID_STRING_OR_BUFFER_LENGTH, + + /** + * Option type was out of range. + */ + SHY092_OPTION_TYPE_OUT_OF_RANGE, + + /** Column type out of range. */ + SHY097_COLUMN_TYPE_OUT_OF_RANGE, + + /** The value specified for the argument InputOutputType was invalid. */ + SHY105_INVALID_PARAMETER_TYPE, + + /** The value specified for the argument FetchOrientation was invalid. */ + SHY106_FETCH_TYPE_OUT_OF_RANGE, + + /** + * The driver does not support the feature of ODBC behavior that + * the application requested. + */ + SHYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED, + + /** + * The connection timeout period expired before the data source + * responded to the request. + */ + SHYT01_CONNECTIOIN_TIMEOUT, + + /** + * Driver does not support this function. + */ + SIM001_FUNCTION_NOT_SUPPORTED + }; }; /** * Diagnostic field type. */ - enum DiagnosticField + struct DiagnosticField { - /** Field type is unknown to the driver. */ - IGNITE_SQL_DIAG_UNKNOWN, + enum Type + { + /** Field type is unknown to the driver. */ + UNKNOWN, - /** Header record field: Count of rows in the cursor. */ - IGNITE_SQL_DIAG_HEADER_CURSOR_ROW_COUNT, + /** Header record field: Count of rows in the cursor. */ + HEADER_CURSOR_ROW_COUNT, - /** - * Header record field: String that describes the SQL statement - * that the underlying function executed. - */ - IGNITE_SQL_DIAG_HEADER_DYNAMIC_FUNCTION, + /** + * Header record field: String that describes the SQL statement + * that the underlying function executed. + */ + HEADER_DYNAMIC_FUNCTION, - /** - * Header record field: Numeric code that describes the SQL - * statement that was executed by the underlying function. - */ - IGNITE_SQL_DIAG_HEADER_DYNAMIC_FUNCTION_CODE, + /** + * Header record field: Numeric code that describes the SQL + * statement that was executed by the underlying function. + */ + HEADER_DYNAMIC_FUNCTION_CODE, - /** Header record field: Number of status records. */ - IGNITE_SQL_DIAG_HEADER_NUMBER, + /** Header record field: Number of status records. */ + HEADER_NUMBER, - /** Header record field: Last operation return code. */ - IGNITE_SQL_DIAG_HEADER_RETURNCODE, + /** Header record field: Last operation return code. */ + HEADER_RETURNCODE, - /** Header record field: Row count. */ - IGNITE_SQL_DIAG_HEADER_ROW_COUNT, + /** Header record field: Row count. */ + HEADER_ROW_COUNT, - /** Status record field: Class origin. */ - IGNITE_SQL_DIAG_STATUS_CLASS_ORIGIN, + /** Status record field: Class origin. */ + STATUS_CLASS_ORIGIN, - /** Status record field: Column number. */ - IGNITE_SQL_DIAG_STATUS_COLUMN_NUMBER, + /** Status record field: Column number. */ + STATUS_COLUMN_NUMBER, - /** Status record field: Connection name. */ - IGNITE_SQL_DIAG_STATUS_CONNECTION_NAME, + /** Status record field: Connection name. */ + STATUS_CONNECTION_NAME, - /** Status record field: Message text. */ - IGNITE_SQL_DIAG_STATUS_MESSAGE_TEXT, + /** Status record field: Message text. */ + STATUS_MESSAGE_TEXT, - /** Status record field: Native result code. */ - IGNITE_SQL_DIAG_STATUS_NATIVE, + /** Status record field: Native result code. */ + STATUS_NATIVE, - /** Status record field: Row number. */ - IGNITE_SQL_DIAG_STATUS_ROW_NUMBER, + /** Status record field: Row number. */ + STATUS_ROW_NUMBER, - /** Status record field: Server name. */ - IGNITE_SQL_DIAG_STATUS_SERVER_NAME, + /** Status record field: Server name. */ + STATUS_SERVER_NAME, - /** Status record field: SQLSTATE. */ - IGNITE_SQL_DIAG_STATUS_SQLSTATE, + /** Status record field: SQLSTATE. */ + STATUS_SQLSTATE, - /** Status record field: Subclass origin. */ - IGNITE_SQL_DIAG_STATUS_SUBCLASS_ORIGIN + /** Status record field: Subclass origin. */ + STATUS_SUBCLASS_ORIGIN + }; }; /** * Environment attribute. */ - enum EnvironmentAttribute + struct EnvironmentAttribute { - /** ODBC attribute is unknown to the driver. */ - IGNITE_SQL_ENV_ATTR_UNKNOWN, + enum Type + { + /** ODBC attribute is unknown to the driver. */ + UNKNOWN, - /** ODBC version. */ - IGNITE_SQL_ENV_ATTR_ODBC_VERSION, + /** ODBC version. */ + ODBC_VERSION, - /** Null-termination of strings. */ - IGNITE_SQL_ENV_ATTR_OUTPUT_NTS + /** Null-termination of strings. */ + OUTPUT_NTS + }; }; /** @@ -243,23 +251,23 @@ namespace ignite * @param result Internal result type. * @return ODBC result type. */ - int SqlResultToReturnCode(SqlResult result); + int SqlResultToReturnCode(SqlResult::Type result); /** - * Convert ODBC field type to internal DiagnosticField type value. + * Convert ODBC field type to internal DiagnosticField::Type type value. * * @param field ODBC field type. - * @return Internal DiagnosticField type value. + * @return Internal DiagnosticField::Type type value. */ - DiagnosticField DiagnosticFieldToInternal(int16_t field); + DiagnosticField::Type DiagnosticFieldToInternal(int16_t field); /** - * Convert environment attribute to internal EnvironmentAttribute type value. + * Convert environment attribute to internal EnvironmentAttribute::Type type value. * * @param attr Environment attribute. - * @return Internal EnvironmentAttribute type value. + * @return Internal EnvironmentAttribute::Type type value. */ - EnvironmentAttribute EnvironmentAttributeToInternal(int32_t attr); + EnvironmentAttribute::Type EnvironmentAttributeToInternal(int32_t attr); } http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/config/connection_info.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/config/connection_info.h b/modules/platforms/cpp/odbc/include/ignite/odbc/config/connection_info.h index d421952..c17d5ec 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/config/connection_info.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/config/connection_info.h @@ -66,7 +66,7 @@ namespace ignite * @param reslen Result value length pointer. * @return True on success. */ - SqlResult GetInfo(InfoType type, void* buf, short buflen, short* reslen) const; + SqlResult::Type GetInfo(InfoType type, void* buf, short buflen, short* reslen) const; private: IGNITE_NO_COPY_ASSIGNMENT(ConnectionInfo); http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/connection.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/connection.h b/modules/platforms/cpp/odbc/include/ignite/odbc/connection.h index acf82ba..c3f27a2 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/connection.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/connection.h @@ -129,7 +129,7 @@ namespace ignite * @param columnNum Associated column number. * @return DiagnosticRecord associated with the instance. */ - static diagnostic::DiagnosticRecord CreateStatusRecord(SqlState sqlState, + static diagnostic::DiagnosticRecord CreateStatusRecord(SqlState::Type sqlState, const std::string& message, int32_t rowNum = 0, int32_t columnNum = 0); /** @@ -172,7 +172,7 @@ namespace ignite * @param connectStr Connection string. * @return Operation result. */ - SqlResult InternalEstablish(const std::string& connectStr); + SqlResult::Type InternalEstablish(const std::string& connectStr); /** * Establish connection to ODBC server. @@ -181,7 +181,7 @@ namespace ignite * @param cfg Configuration. * @return Operation result. */ - SqlResult InternalEstablish(const config::Configuration cfg); + SqlResult::Type InternalEstablish(const config::Configuration cfg); /** * Release established connection. @@ -189,7 +189,7 @@ namespace ignite * * @return Operation result. */ - SqlResult InternalRelease(); + SqlResult::Type InternalRelease(); /** * Get info of any type. @@ -201,7 +201,7 @@ namespace ignite * @param reslen Result value length pointer. * @return Operation result. */ - SqlResult InternalGetInfo(config::ConnectionInfo::InfoType type, void* buf, short buflen, short* reslen); + SqlResult::Type InternalGetInfo(config::ConnectionInfo::InfoType type, void* buf, short buflen, short* reslen); /** * Create statement associated with the connection. @@ -210,7 +210,7 @@ namespace ignite * @param Pointer to valid instance on success and NULL on failure. * @return Operation result. */ - SqlResult InternalCreateStatement(Statement*& statement); + SqlResult::Type InternalCreateStatement(Statement*& statement); /** * Perform transaction commit on all the associated connections. @@ -218,7 +218,7 @@ namespace ignite * * @return Operation result. */ - SqlResult InternalTransactionCommit(); + SqlResult::Type InternalTransactionCommit(); /** * Perform transaction rollback on all the associated connections. @@ -226,7 +226,7 @@ namespace ignite * * @return Operation result. */ - SqlResult InternalTransactionRollback(); + SqlResult::Type InternalTransactionRollback(); /** * Receive specified number of bytes. @@ -251,7 +251,7 @@ namespace ignite * * @return Operation result. */ - SqlResult MakeRequestHandshake(); + SqlResult::Type MakeRequestHandshake(); /** * Constructor. http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable.h b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable.h index 6937fcc..4eb1a38 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable.h @@ -62,7 +62,7 @@ namespace ignite * @param rowNum Associated row number. * @param columnNum Associated column number. */ - virtual void AddStatusRecord(SqlState sqlState, const std::string& message, + virtual void AddStatusRecord(SqlState::Type sqlState, const std::string& message, int32_t rowNum, int32_t columnNum) = 0; /** @@ -71,7 +71,7 @@ namespace ignite * @param sqlState SQL state. * @param message Message. */ - virtual void AddStatusRecord(SqlState sqlState, const std::string& message) = 0; + virtual void AddStatusRecord(SqlState::Type sqlState, const std::string& message) = 0; protected: /** http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable_adapter.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable_adapter.h b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable_adapter.h index 548eecd..45f47f0 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable_adapter.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable_adapter.h @@ -22,12 +22,12 @@ #define IGNITE_ODBC_API_CALL(...) \ diagnosticRecords.Reset(); \ - SqlResult result = (__VA_ARGS__); \ + SqlResult::Type result = (__VA_ARGS__); \ diagnosticRecords.SetHeaderRecord(result) #define IGNITE_ODBC_API_CALL_ALWAYS_SUCCESS \ diagnosticRecords.Reset(); \ - diagnosticRecords.SetHeaderRecord(SQL_RESULT_SUCCESS) + diagnosticRecords.SetHeaderRecord(SqlResult::AI_SUCCESS) namespace ignite { @@ -79,7 +79,7 @@ namespace ignite * @param rowNum Associated row number. * @param columnNum Associated column number. */ - virtual void AddStatusRecord(SqlState sqlState, const std::string& message, + virtual void AddStatusRecord(SqlState::Type sqlState, const std::string& message, int32_t rowNum, int32_t columnNum); /** @@ -88,7 +88,7 @@ namespace ignite * @param sqlState SQL state. * @param message Message. */ - virtual void AddStatusRecord(SqlState sqlState, const std::string& message); + virtual void AddStatusRecord(SqlState::Type sqlState, const std::string& message); protected: /** http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record.h b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record.h index 80d5090..18cc93a 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record.h @@ -53,7 +53,7 @@ namespace ignite * @param rowNum Associated row number. * @param columnNum Associated column number. */ - DiagnosticRecord(SqlState sqlState, const std::string& message, + DiagnosticRecord(SqlState::Type sqlState, const std::string& message, const std::string& connectionName, const std::string& serverName, int32_t rowNum = 0, int32_t columnNum = 0); @@ -142,7 +142,7 @@ namespace ignite private: /** SQL state diagnostic code. */ - SqlState sqlState; + SqlState::Type sqlState; /** An informational message on the error or warning. */ std::string message; http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record_storage.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record_storage.h b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record_storage.h index b45bb7d..9a816da 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record_storage.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record_storage.h @@ -64,7 +64,7 @@ namespace ignite * * @param retCode Operation return code. */ - void SetHeaderRecord(SqlResult result); + void SetHeaderRecord(SqlResult::Type result); /** * Add status record to diagnostic records. @@ -83,7 +83,7 @@ namespace ignite * * @return Result of the last operation. */ - SqlResult GetOperaionResult() const; + SqlResult::Type GetOperaionResult() const; /** * Get return code of the last operation. @@ -169,7 +169,7 @@ namespace ignite * @param buffer Buffer to put data to. * @return Operation result. */ - SqlResult GetField(int32_t recNum, DiagnosticField field, app::ApplicationDataBuffer& buffer) const; + SqlResult::Type GetField(int32_t recNum, DiagnosticField::Type field, app::ApplicationDataBuffer& buffer) const; private: IGNITE_NO_COPY_ASSIGNMENT(DiagnosticRecordStorage); @@ -196,7 +196,7 @@ namespace ignite * Operation result. This field is mapped to "Return code" header * record field. */ - SqlResult result; + SqlResult::Type result; /** * Header record field. The number of rows affected by an insert, http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/environment.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/environment.h b/modules/platforms/cpp/odbc/include/ignite/odbc/environment.h index 0c8af64..3eeade6 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/environment.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/environment.h @@ -86,7 +86,7 @@ namespace ignite * @return Pointer to valid instance on success or NULL on failure. * @return Operation result. */ - SqlResult InternalCreateConnection(Connection*& connection); + SqlResult::Type InternalCreateConnection(Connection*& connection); /** * Perform transaction commit on all the associated connections. @@ -94,7 +94,7 @@ namespace ignite * * @return Operation result. */ - SqlResult InternalTransactionCommit(); + SqlResult::Type InternalTransactionCommit(); /** * Perform transaction rollback on all the associated connections. @@ -102,7 +102,7 @@ namespace ignite * * @return Operation result. */ - SqlResult InternalTransactionRollback(); + SqlResult::Type InternalTransactionRollback(); /** * Set attribute. @@ -113,7 +113,7 @@ namespace ignite * @param len Value length if the attribute is of string type. * @return Operation result. */ - SqlResult InternalSetAttribute(int32_t attr, void* value, int32_t len); + SqlResult::Type InternalSetAttribute(int32_t attr, void* value, int32_t len); /** * Get attribute. @@ -123,7 +123,7 @@ namespace ignite * @param buffer Buffer to put value to. * @return Operation result. */ - SqlResult InternalGetAttribute(int32_t attr, app::ApplicationDataBuffer& buffer); + SqlResult::Type InternalGetAttribute(int32_t attr, app::ApplicationDataBuffer& buffer); /** ODBC version. */ int32_t odbcVersion; http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/message.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/message.h b/modules/platforms/cpp/odbc/include/ignite/odbc/message.h index 7061fc9..60b2d9b 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/message.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/message.h @@ -34,28 +34,34 @@ namespace ignite { namespace odbc { - enum RequestType + struct RequestType { - REQUEST_TYPE_HANDSHAKE = 1, + enum Type + { + HANDSHAKE = 1, - REQUEST_TYPE_EXECUTE_SQL_QUERY = 2, + EXECUTE_SQL_QUERY = 2, - REQUEST_TYPE_FETCH_SQL_QUERY = 3, + FETCH_SQL_QUERY = 3, - REQUEST_TYPE_CLOSE_SQL_QUERY = 4, + CLOSE_SQL_QUERY = 4, - REQUEST_TYPE_GET_COLUMNS_METADATA = 5, + GET_COLUMNS_METADATA = 5, - REQUEST_TYPE_GET_TABLES_METADATA = 6, + GET_TABLES_METADATA = 6, - REQUEST_TYPE_GET_PARAMS_METADATA = 7 + GET_PARAMS_METADATA = 7 + }; }; - enum ResponseStatus + struct ResponseStatus { - RESPONSE_STATUS_SUCCESS = 0, + enum Type + { + SUCCESS = 0, - RESPONSE_STATUS_FAILED = 1 + FAILED = 1 + }; }; /** @@ -93,7 +99,7 @@ namespace ignite */ void Write(ignite::impl::binary::BinaryWriterImpl& writer) const { - writer.WriteInt8(REQUEST_TYPE_HANDSHAKE); + writer.WriteInt8(RequestType::HANDSHAKE); writer.WriteInt64(version); @@ -148,7 +154,7 @@ namespace ignite */ void Write(ignite::impl::binary::BinaryWriterImpl& writer) const { - writer.WriteInt8(REQUEST_TYPE_EXECUTE_SQL_QUERY); + writer.WriteInt8(RequestType::EXECUTE_SQL_QUERY); utility::WriteString(writer, cache); utility::WriteString(writer, sql); @@ -213,7 +219,7 @@ namespace ignite */ void Write(ignite::impl::binary::BinaryWriterImpl& writer) const { - writer.WriteInt8(REQUEST_TYPE_CLOSE_SQL_QUERY); + writer.WriteInt8(RequestType::CLOSE_SQL_QUERY); writer.WriteInt64(queryId); } @@ -255,7 +261,7 @@ namespace ignite */ void Write(ignite::impl::binary::BinaryWriterImpl& writer) const { - writer.WriteInt8(REQUEST_TYPE_FETCH_SQL_QUERY); + writer.WriteInt8(RequestType::FETCH_SQL_QUERY); writer.WriteInt64(queryId); writer.WriteInt32(pageSize); } @@ -303,7 +309,7 @@ namespace ignite */ void Write(ignite::impl::binary::BinaryWriterImpl& writer) const { - writer.WriteInt8(REQUEST_TYPE_GET_COLUMNS_METADATA); + writer.WriteInt8(RequestType::GET_COLUMNS_METADATA); utility::WriteString(writer, schema); utility::WriteString(writer, table); @@ -359,7 +365,7 @@ namespace ignite */ void Write(ignite::impl::binary::BinaryWriterImpl& writer) const { - writer.WriteInt8(REQUEST_TYPE_GET_TABLES_METADATA); + writer.WriteInt8(RequestType::GET_TABLES_METADATA); utility::WriteString(writer, catalog); utility::WriteString(writer, schema); @@ -390,10 +396,8 @@ namespace ignite /** * Constructor. * - * @param catalog Catalog search pattern. - * @param schema Schema search pattern. - * @param table Table search pattern. - * @param tableTypes Table types search pattern. + * @param cacheName Cache name. + * @param sqlQuery SQL query itself. */ QueryGetParamsMetaRequest(const std::string& cacheName, const std::string& sqlQuery) : cacheName(cacheName), @@ -416,7 +420,7 @@ namespace ignite */ void Write(ignite::impl::binary::BinaryWriterImpl& writer) const { - writer.WriteInt8(REQUEST_TYPE_GET_PARAMS_METADATA); + writer.WriteInt8(RequestType::GET_PARAMS_METADATA); utility::WriteString(writer, cacheName); utility::WriteString(writer, sqlQuery); @@ -431,7 +435,7 @@ namespace ignite }; /** - * Query close response. + * General response. */ class Response { @@ -439,7 +443,7 @@ namespace ignite /** * Constructor. */ - Response() : status(RESPONSE_STATUS_FAILED), error() + Response() : status(ResponseStatus::FAILED), error() { // No-op. } @@ -460,7 +464,7 @@ namespace ignite { status = reader.ReadInt8(); - if (status == RESPONSE_STATUS_SUCCESS) + if (status == ResponseStatus::SUCCESS) ReadOnSuccess(reader); else utility::ReadString(reader, error);; @@ -486,7 +490,7 @@ namespace ignite protected: /** - * Read data if response status is RESPONSE_STATUS_SUCCESS. + * Read data if response status is ResponseStatus::SUCCESS. */ virtual void ReadOnSuccess(ignite::impl::binary::BinaryReaderImpl&) { http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/query/column_metadata_query.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/query/column_metadata_query.h b/modules/platforms/cpp/odbc/include/ignite/odbc/query/column_metadata_query.h index 85a9474..878a4be 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/query/column_metadata_query.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/query/column_metadata_query.h @@ -59,7 +59,7 @@ namespace ignite * * @return True on success. */ - virtual SqlResult Execute(); + virtual SqlResult::Type Execute(); /** * Get column metadata. @@ -73,7 +73,7 @@ namespace ignite * * @return Operation result. */ - virtual SqlResult FetchNextRow(app::ColumnBindingMap& columnBindings); + virtual SqlResult::Type FetchNextRow(app::ColumnBindingMap& columnBindings); /** * Get data of the specified column in the result set. @@ -82,14 +82,14 @@ namespace ignite * @param buffer Buffer to put column data to. * @return Operation result. */ - virtual SqlResult GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer); + virtual SqlResult::Type GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer); /** * Close query. * * @return True on success. */ - virtual SqlResult Close(); + virtual SqlResult::Type Close(); /** * Check if data is available. @@ -113,7 +113,7 @@ namespace ignite * * @return Operation result. */ - SqlResult MakeRequestGetColumnsMeta(); + SqlResult::Type MakeRequestGetColumnsMeta(); /** Connection associated with the statement. */ Connection& connection; http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/query/data_query.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/query/data_query.h b/modules/platforms/cpp/odbc/include/ignite/odbc/query/data_query.h index 68bb877..ade8fb0 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/query/data_query.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/query/data_query.h @@ -58,7 +58,7 @@ namespace ignite * * @return True on success. */ - virtual SqlResult Execute(); + virtual SqlResult::Type Execute(); /** * Get column metadata. @@ -73,7 +73,7 @@ namespace ignite * @param columnBindings Application buffers to put data to. * @return Operation result. */ - virtual SqlResult FetchNextRow(app::ColumnBindingMap& columnBindings); + virtual SqlResult::Type FetchNextRow(app::ColumnBindingMap& columnBindings); /** * Get data of the specified column in the result set. @@ -82,14 +82,14 @@ namespace ignite * @param buffer Buffer to put column data to. * @return Operation result. */ - virtual SqlResult GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer); + virtual SqlResult::Type GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer); /** * Close query. * - * @return True on success. + * @return Result. */ - virtual SqlResult Close(); + virtual SqlResult::Type Close(); /** * Check if data is available. @@ -124,21 +124,28 @@ namespace ignite * * @return True on success. */ - SqlResult MakeRequestExecute(); + SqlResult::Type MakeRequestExecute(); /** * Make query close request. * * @return True on success. */ - SqlResult MakeRequestClose(); + SqlResult::Type MakeRequestClose(); /** * Make data fetch request and use response to set internal state. * * @return True on success. */ - SqlResult MakeRequestFetch(); + SqlResult::Type MakeRequestFetch(); + + /** + * Close query. + * + * @return Result. + */ + SqlResult::Type InternalClose(); /** Connection associated with the statement. */ Connection& connection; http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/include/ignite/odbc/query/foreign_keys_query.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/query/foreign_keys_query.h b/modules/platforms/cpp/odbc/include/ignite/odbc/query/foreign_keys_query.h index 0fb1e5f..7d60728 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/query/foreign_keys_query.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/query/foreign_keys_query.h @@ -60,7 +60,7 @@ namespace ignite * * @return True on success. */ - virtual SqlResult Execute(); + virtual SqlResult::Type Execute(); /** * Get column metadata. @@ -74,7 +74,7 @@ namespace ignite * * @return Operation result. */ - virtual SqlResult FetchNextRow(app::ColumnBindingMap& columnBindings); + virtual SqlResult::Type FetchNextRow(app::ColumnBindingMap& columnBindings); /** * Get data of the specified column in the result set. @@ -83,14 +83,14 @@ namespace ignite * @param buffer Buffer to put column data to. * @return Operation result. */ - virtual SqlResult GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer); + virtual SqlResult::Type GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer); /** * Close query. * * @return True on success. */ - virtual SqlResult Close(); + virtual SqlResult::Type Close(); /** * Check if data is available.
