ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [52/68] [abbrv] ignite git commit: Merge branch 'ignite-1.6.9' into ignite-1.7.2
Date Tue, 27 Sep 2016 15:26:42 GMT
Merge branch 'ignite-1.6.9' into ignite-1.7.2


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bbc97580
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bbc97580
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bbc97580

Branch: refs/heads/ignite-comm-opts2
Commit: bbc97580492609e2e4fc3d92b08b4740b984d78f
Parents: 4f9ac81 350e846
Author: isapego <isapego@gridgain.com>
Authored: Mon Sep 26 20:17:43 2016 +0300
Committer: isapego <isapego@gridgain.com>
Committed: Mon Sep 26 20:17:43 2016 +0300

----------------------------------------------------------------------
 .../src/application_data_buffer_test.cpp        | 129 ++++---
 .../platforms/cpp/odbc-test/src/column_test.cpp |  10 +-
 .../cpp/odbc-test/src/queries_test.cpp          | 143 +++++++-
 .../platforms/cpp/odbc-test/src/row_test.cpp    |   4 +-
 modules/platforms/cpp/odbc/Makefile.am          |   3 +-
 .../platforms/cpp/odbc/include/ignite/odbc.h    |   6 +-
 .../ignite/odbc/app/application_data_buffer.h   |  58 +++-
 .../odbc/include/ignite/odbc/app/parameter.h    |  27 +-
 .../cpp/odbc/include/ignite/odbc/common_types.h |  18 +-
 .../include/ignite/odbc/config/configuration.h  |  17 +-
 .../cpp/odbc/include/ignite/odbc/statement.h    |  58 +++-
 .../platforms/cpp/odbc/project/vs/module.def    |   1 -
 .../platforms/cpp/odbc/project/vs/odbc.vcxproj  |   2 +-
 .../odbc/src/app/application_data_buffer.cpp    | 343 ++++++++++++++-----
 .../platforms/cpp/odbc/src/app/parameter.cpp    | 126 ++++++-
 modules/platforms/cpp/odbc/src/common_types.cpp |   3 +
 .../cpp/odbc/src/config/configuration.cpp       |  27 ++
 .../cpp/odbc/src/config/connection_info.cpp     |  35 +-
 modules/platforms/cpp/odbc/src/connection.cpp   |   2 +-
 .../odbc/src/diagnostic/diagnostic_record.cpp   |  18 +
 modules/platforms/cpp/odbc/src/entry_points.cpp |  30 +-
 modules/platforms/cpp/odbc/src/odbc.cpp         |  45 ++-
 modules/platforms/cpp/odbc/src/statement.cpp    | 150 +++++++-
 .../NuGet/LINQPad/PutGetExample.linq            |   2 +-
 .../NuGet/LINQPad/QueryExample.linq             |   6 +-
 .../NuGet/LINQPad/QueryExample.linq             |   4 +-
 26 files changed, 1000 insertions(+), 267 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bbc97580/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/odbc-test/src/queries_test.cpp
index a82ab7e,f0168bd..73d57c9
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@@ -562,131 -543,128 +570,254 @@@ BOOST_AUTO_TEST_CASE(TestOneRowStringLe
      BOOST_CHECK(ret == SQL_NO_DATA);
  }
  
+ BOOST_AUTO_TEST_CASE(TestDataAtExecution)
+ {
+     Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache");
+ 
+     SQLRETURN ret;
+ 
+     TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987,
6, 5),
+         BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+ 
+     TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), BinaryUtils::MakeDateGmt(1976,
1, 12),
+         BinaryUtils::MakeTimestampGmt(1978, 8, 21, 23, 13, 45, 999999999));
+ 
+     testCache.Put(1, in1);
+     testCache.Put(2, in2);
+ 
+     const size_t columnsCnt = 11;
+ 
+     SQLLEN columnLens[columnsCnt] = { 0 };
+     SQLCHAR columns[columnsCnt][ODBC_BUFFER_SIZE] = { 0 };
+ 
+     // Binding columns.
+     for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+     {
+         ret = SQLBindCol(stmt, i + 1, SQL_C_CHAR, &columns[i], ODBC_BUFFER_SIZE, &columnLens[i]);
+ 
+         if (!SQL_SUCCEEDED(ret))
+             BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+     }
+ 
+     SQLCHAR request[] = "SELECT i8Field, i16Field, i32Field, i64Field, strField, "
+         "floatField, doubleField, boolField, guidField, dateField, timestampField FROM TestType
"
+         "WHERE i32Field = ? AND strField = ?";
+ 
+     ret = SQLPrepare(stmt, request, SQL_NTS);
+ 
+     SQLLEN ind1 = 1;
+     SQLLEN ind2 = 2;
+ 
+     SQLLEN len1 = SQL_DATA_AT_EXEC;
+     SQLLEN len2 = SQL_LEN_DATA_AT_EXEC(static_cast<SQLLEN>(in1.strField.size()));
+ 
+     ret = SQLBindParam(stmt, 1, SQL_C_SLONG, SQL_INTEGER, 100, 100, &ind1, &len1);
+ 
+     if (!SQL_SUCCEEDED(ret))
+         BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ 
+     ret = SQLBindParam(stmt, 2, SQL_C_CHAR, SQL_VARCHAR, 100, 100, &ind2, &len2);
+ 
+     if (!SQL_SUCCEEDED(ret))
+         BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ 
+     ret = SQLExecute(stmt);
+ 
+     BOOST_REQUIRE_EQUAL(ret, SQL_NEED_DATA);
+ 
+     void* oind;
+ 
+     ret = SQLParamData(stmt, &oind);
+ 
+     BOOST_REQUIRE_EQUAL(ret, SQL_NEED_DATA);
+ 
+     if (oind == &ind1)
+         ret = SQLPutData(stmt, &in1.i32Field, 0);
+     else if (oind == &ind2)
+         ret = SQLPutData(stmt, (SQLPOINTER)in1.strField.c_str(), (SQLLEN)in1.strField.size());
+     else
+         BOOST_FAIL("Unknown indicator value");
+ 
+     if (!SQL_SUCCEEDED(ret))
+         BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ 
+     ret = SQLParamData(stmt, &oind);
+ 
+     BOOST_REQUIRE_EQUAL(ret, SQL_NEED_DATA);
+ 
+     if (oind == &ind1)
+         ret = SQLPutData(stmt, &in1.i32Field, 0);
+     else if (oind == &ind2)
+         ret = SQLPutData(stmt, (SQLPOINTER)in1.strField.c_str(), (SQLLEN)in1.strField.size());
+     else
+         BOOST_FAIL("Unknown indicator value");
+ 
+     if (!SQL_SUCCEEDED(ret))
+         BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ 
+     ret = SQLParamData(stmt, &oind);
+ 
+     if (!SQL_SUCCEEDED(ret))
+         BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ 
+     ret = SQLFetch(stmt);
+     if (!SQL_SUCCEEDED(ret))
+         BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ 
+     BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[0])), "1");
+     BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[1])), "2");
+     BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[2])), "3");
+     BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[3])), "4");
+     BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[4])), "5");
+     BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[5])), "6");
+     BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[6])), "7");
+     BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[7])), "1");
+     BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[8])), "00000000-0000-0008-0000-000000000009");
+     // Such format is used because Date returned as Timestamp.
+     BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[9])), "1987-06-05
00:00:00");
+     BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[10])), "1998-12-27
01:02:03");
+ 
+     BOOST_CHECK_EQUAL(columnLens[0], 1);
+     BOOST_CHECK_EQUAL(columnLens[1], 1);
+     BOOST_CHECK_EQUAL(columnLens[2], 1);
+     BOOST_CHECK_EQUAL(columnLens[3], 1);
+     BOOST_CHECK_EQUAL(columnLens[4], 1);
+     BOOST_CHECK_EQUAL(columnLens[5], 1);
+     BOOST_CHECK_EQUAL(columnLens[6], 1);
+     BOOST_CHECK_EQUAL(columnLens[7], 1);
+     BOOST_CHECK_EQUAL(columnLens[8], 36);
+     BOOST_CHECK_EQUAL(columnLens[9], 19);
+     BOOST_CHECK_EQUAL(columnLens[10], 19);
+ 
+     ret = SQLFetch(stmt);
+     BOOST_CHECK(ret == SQL_NO_DATA);
+ }
+ 
 +BOOST_AUTO_TEST_CASE(TestDistributedJoins)
 +{
 +    // Starting additional node.
 +    Ignite node1 = StartAdditionalNode("Node1");
 +    Ignite node2 = StartAdditionalNode("Node2");
 +
 +    const int entriesNum = 1000;
 +
 +    // Filling cache with data.
 +    for (int i = 0; i < entriesNum; ++i)
 +    {
 +        TestType entry;
 +
 +        entry.i32Field = i;
 +        entry.i64Field = entriesNum - i - 1;
 +
 +        testCache.Put(i, entry);
 +    }
 +
 +    Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache");
 +
 +    SQLRETURN ret;
 +
 +    const size_t columnsCnt = 2;
 +
 +    SQLBIGINT columns[columnsCnt] = { 0 };
 +
 +    // Binding colums.
 +    for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
 +    {
 +        ret = SQLBindCol(stmt, i + 1, SQL_C_SLONG, &columns[i], 0, 0);
 +
 +        if (!SQL_SUCCEEDED(ret))
 +            BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
 +    }
 +
 +    SQLCHAR request[] =
 +        "SELECT T0.i32Field, T1.i64Field FROM TestType AS T0 "
 +        "INNER JOIN TestType AS T1 "
 +        "ON (T0.i32Field = T1.i64Field)";
 +
 +    ret = SQLExecDirect(stmt, request, SQL_NTS);
 +
 +    if (!SQL_SUCCEEDED(ret))
 +        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
 +
 +    int rowsNum = CountRows(stmt);
 +
 +    BOOST_CHECK_GT(rowsNum, 0);
 +    BOOST_CHECK_LT(rowsNum, entriesNum);
 +
 +    Disconnect();
 +
 +    Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache;DISTRIBUTED_JOINS=true;");
 +
 +    // Binding colums.
 +    for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
 +    {
 +        ret = SQLBindCol(stmt, i + 1, SQL_C_SLONG, &columns[i], 0, 0);
 +
 +        if (!SQL_SUCCEEDED(ret))
 +            BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
 +    }
 +
 +    ret = SQLExecDirect(stmt, request, SQL_NTS);
 +
 +    if (!SQL_SUCCEEDED(ret))
 +        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
 +
 +    rowsNum = CountRows(stmt);
 +
 +    BOOST_CHECK_EQUAL(rowsNum, entriesNum);
 +}
 +
 +BOOST_AUTO_TEST_CASE(TestDistributedJoinsWithOldVersion)
 +{
 +    // Starting additional node.
 +    Ignite node1 = StartAdditionalNode("Node1");
 +    Ignite node2 = StartAdditionalNode("Node2");
 +
 +    const int entriesNum = 1000;
 +
 +    // Filling cache with data.
 +    for (int i = 0; i < entriesNum; ++i)
 +    {
 +        TestType entry;
 +
 +        entry.i32Field = i;
 +        entry.i64Field = entriesNum - i - 1;
 +
 +        testCache.Put(i, entry);
 +    }
 +
 +    Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache;DISTRIBUTED_JOINS=true;PROTOCOL_VERSION=1.6.0");
 +
 +    SQLRETURN ret;
 +
 +    const size_t columnsCnt = 2;
 +
 +    SQLBIGINT columns[columnsCnt] = { 0 };
 +
 +    // Binding colums.
 +    for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
 +    {
 +        ret = SQLBindCol(stmt, i + 1, SQL_C_SLONG, &columns[i], 0, 0);
 +
 +        if (!SQL_SUCCEEDED(ret))
 +            BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
 +    }
 +
 +    SQLCHAR request[] =
 +        "SELECT T0.i32Field, T1.i64Field FROM TestType AS T0 "
 +        "INNER JOIN TestType AS T1 "
 +        "ON (T0.i32Field = T1.i64Field)";
 +
 +    ret = SQLExecDirect(stmt, request, SQL_NTS);
 +
 +    if (!SQL_SUCCEEDED(ret))
 +        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
 +
 +    int rowsNum = CountRows(stmt);
 +
 +    BOOST_CHECK_GT(rowsNum, 0);
 +    BOOST_CHECK_LT(rowsNum, entriesNum);
 +}
 +
  
  BOOST_AUTO_TEST_SUITE_END()

http://git-wip-us.apache.org/repos/asf/ignite/blob/bbc97580/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
index 05a9ec3,4fe4f1b..c0d102b
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
@@@ -269,52 -251,9 +263,49 @@@ namespace ignit
                   *
                   * @param address Address.
                   */
-                 void SetAddress(const std::string& address)
-                 {
-                     arguments[Key::address] = address;
-                 }
+                 void SetAddress(const std::string& address);
  
                  /**
 +                 * Check distributed joins flag.
 +                 *
 +                 * @return True if distributed joins are enabled.
 +                 */
 +                bool IsDistributedJoins() const
 +                {
 +                    return GetBoolValue(Key::distributedJoins, DefaultValue::distributedJoins);
 +                }
 +
 +                /**
 +                 * Set distributed joins.
 +                 *
 +                 * @param val Value to set.
 +                 */
 +                void SetDistributedJoins(bool val)
 +                {
 +                    SetBoolValue(Key::distributedJoins, val);
 +                }
 +
 +                /**
 +                 * Check enforce join order flag.
 +                 *
 +                 * @return True if enforcing of join order is enabled.
 +                 */
 +                bool IsEnforceJoinOrder() const
 +                {
 +                    return GetBoolValue(Key::enforceJoinOrder, DefaultValue::enforceJoinOrder);
 +                }
 +
 +                /**
 +                 * Set enforce joins.
 +                 *
 +                 * @param val Value to set.
 +                 */
 +                void SetEnforceJoinOrder(bool val)
 +                {
 +                    SetBoolValue(Key::enforceJoinOrder, val);
 +                }
 +
 +                /**
                   * Get protocol version.
                   *
                   * @return Protocol version.

http://git-wip-us.apache.org/repos/asf/ignite/blob/bbc97580/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/bbc97580/modules/platforms/cpp/odbc/src/config/configuration.cpp
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/bbc97580/modules/platforms/cpp/odbc/src/connection.cpp
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/bbc97580/modules/platforms/cpp/odbc/src/odbc.cpp
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/odbc/src/odbc.cpp
index 74d0f9d,9df64d3..a4c750e
--- a/modules/platforms/cpp/odbc/src/odbc.cpp
+++ b/modules/platforms/cpp/odbc/src/odbc.cpp
@@@ -754,7 -753,7 +753,7 @@@ namespace ignit
          LOG_MSG("columnSizeRes: %lld\n", columnSizeRes);
          LOG_MSG("decimalDigitsRes: %lld\n", decimalDigitsRes);
          LOG_MSG("nullableRes: %lld\n", nullableRes);
--        LOG_MSG("columnNameBuf: %s\n", columnNameBuf ? columnNameBuf : "<null>");
++        LOG_MSG("columnNameBuf: %s\n", columnNameBuf ? reinterpret_cast<const char*>(columnNameBuf)
: "<null>");
          LOG_MSG("columnNameLen: %d\n", columnNameLen ? *columnNameLen : -1);
  
          if (dataType)


Mime
View raw message