http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp index bba806c..4c0f892 100644 --- a/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp @@ -25,6 +25,7 @@ #include "test_utils.h" using namespace ignite; +using namespace ignite_test; using namespace boost::unit_test; @@ -192,7 +193,7 @@ BOOST_AUTO_TEST_CASE(TestTimestampSelect) { TestType in1; in1.i32Field = 1; - in1.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2017, 1, 13, 19, 54, 01, 987654321); + in1.timestampField = common::MakeTimestampGmt(2017, 1, 13, 19, 54, 01, 987654321); testCache.Put(1, in1); @@ -230,7 +231,7 @@ BOOST_AUTO_TEST_CASE(TestTimestampInsert) data.fraction = 987654321; using ignite::impl::binary::BinaryUtils; - Timestamp expected = BinaryUtils::MakeTimestampGmt(data.year, data.month, data.day, data.hour, + Timestamp expected = common::MakeTimestampGmt(data.year, data.month, data.day, data.hour, data.minute, data.second, data.fraction); SQLLEN lenInd = sizeof(data); @@ -259,7 +260,7 @@ BOOST_AUTO_TEST_CASE(TestTimeSelect) TestType in1; in1.i32Field = 1; - in1.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2017, 1, 13, ts.hour, ts.minute, ts.second); + in1.timestampField = common::MakeTimestampGmt(2017, 1, 13, ts.hour, ts.minute, ts.second); testCache.Put(1, in1); @@ -293,8 +294,7 @@ BOOST_AUTO_TEST_CASE(TestTimeInsertToTimestamp) data.second = 1; using ignite::impl::binary::BinaryUtils; - Timestamp expected = BinaryUtils::MakeTimestampGmt(1970, 1, 1, data.hour, - data.minute, data.second, 0); + Timestamp expected = common::MakeTimestampGmt(1970, 1, 1, data.hour, data.minute, data.second, 0); SQLLEN lenInd = sizeof(data); ret = SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_TIME, SQL_TIMESTAMP, sizeof(data), 0, &data, sizeof(data), &lenInd);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/test_utils.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/test_utils.cpp b/modules/platforms/cpp/odbc-test/src/test_utils.cpp index 48f409b..89d50ef 100644 --- a/modules/platforms/cpp/odbc-test/src/test_utils.cpp +++ b/modules/platforms/cpp/odbc-test/src/test_utils.cpp @@ -15,11 +15,12 @@ * limitations under the License. */ +#include <cassert> + #include "test_utils.h" -namespace ignite +namespace ignite_test { - std::string GetOdbcErrorMessage(SQLSMALLINT handleType, SQLHANDLE handle) { SQLCHAR sqlstate[7] = {}; @@ -33,4 +34,59 @@ namespace ignite return std::string(reinterpret_cast<char*>(sqlstate)) + ": " + std::string(reinterpret_cast<char*>(message), reallen); } + + void InitConfig(ignite::IgniteConfiguration& cfg, const char* cfgFile) + { + using namespace ignite; + + assert(cfgFile != 0); + + cfg.jvmOpts.push_back("-Xdebug"); + cfg.jvmOpts.push_back("-Xnoagent"); + cfg.jvmOpts.push_back("-Djava.compiler=NONE"); + cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"); + cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError"); + cfg.jvmOpts.push_back("-Duser.timezone=GMT"); + cfg.jvmOpts.push_back("-DIGNITE_QUIET=false"); + cfg.jvmOpts.push_back("-DIGNITE_CONSOLE_APPENDER=false"); + cfg.jvmOpts.push_back("-DIGNITE_UPDATE_NOTIFIER=false"); + +#ifdef IGNITE_TESTS_32 + cfg.jvmInitMem = 256; + cfg.jvmMaxMem = 768; +#else + cfg.jvmInitMem = 1024; + cfg.jvmMaxMem = 4096; +#endif + + char* cfgPath = getenv("IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH"); + + assert(cfgPath != 0); + + cfg.springCfgPath = std::string(cfgPath).append("/").append(cfgFile); + } + + ignite::Ignite StartNode(const char* cfgFile) + { + using namespace ignite; + + IgniteConfiguration cfg; + + InitConfig(cfg, cfgFile); + + return Ignition::Start(cfg); + } + + ignite::Ignite StartNode(const char* cfgFile, const char* name) + { + using namespace ignite; + + assert(name != 0); + + IgniteConfiguration cfg; + + InitConfig(cfg, cfgFile); + + return Ignition::Start(cfg, name); + } } http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp index 85979c8..026cd60 100644 --- a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp +++ b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp @@ -672,7 +672,7 @@ namespace ignite tm tmTime; - BinaryUtils::DateToCTm(value, tmTime); + common::DateToCTm(value, tmTime); SqlLen* resLenPtr = GetResLen(); void* dataPtr = GetData(); @@ -806,7 +806,7 @@ namespace ignite tm tmTime; - BinaryUtils::TimestampToCTm(value, tmTime); + common::TimestampToCTm(value, tmTime); SqlLen* resLenPtr = GetResLen(); void* dataPtr = GetData(); @@ -1306,7 +1306,7 @@ namespace ignite break; } - return BinaryUtils::CTmToDate(tmTime); + return common::CTmToDate(tmTime); } Timestamp ApplicationDataBuffer::GetTimestamp() const @@ -1382,7 +1382,7 @@ namespace ignite break; } - return BinaryUtils::CTmToTimestamp(tmTime, nanos); + return common::CTmToTimestamp(tmTime, nanos); } void ApplicationDataBuffer::GetDecimal(common::Decimal& val) const
