You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by is...@apache.org on 2022/04/04 10:09:02 UTC

[ignite] branch master updated: IGNITE-16745 Fix SQLGetStmtAttr(SQL_ATTR_ROW_ARRAY_SIZE)

This is an automated email from the ASF dual-hosted git repository.

isapego pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new d0159174373 IGNITE-16745 Fix SQLGetStmtAttr(SQL_ATTR_ROW_ARRAY_SIZE)
d0159174373 is described below

commit d015917437365c8e515c27fbeb142ec713dcf4b2
Author: Alina (Xi) Li <al...@bitquilltech.com>
AuthorDate: Mon Apr 4 14:07:32 2022 +0400

    IGNITE-16745 Fix SQLGetStmtAttr(SQL_ATTR_ROW_ARRAY_SIZE)
    
    This closes #9908
---
 .../cpp/odbc-test/src/api_robustness_test.cpp      | 25 ++++++++++++++++++++++
 modules/platforms/cpp/odbc/src/statement.cpp       |  2 +-
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp b/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
index 21b4e15c758..0fa28e3b2b2 100644
--- a/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
@@ -795,6 +795,31 @@ BOOST_AUTO_TEST_CASE(TestSQLSetStmtAttr)
     SQLSetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, 0, 0);
 }
 
+BOOST_AUTO_TEST_CASE(TestSQLSetStmtAttrGetStmtAttr)
+{
+    // check that statement array size is set correctly 
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache");
+
+    SQLINTEGER actual_row_array_size;
+    SQLINTEGER resLen = 0;
+
+    // repeat test for different values
+    SQLULEN valList[5] = {10, 52, 81, 103, 304};
+    for (int i = 0; i < 5; i++) {
+        SQLULEN val = valList[i];
+        SQLRETURN ret = SQLSetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, reinterpret_cast<SQLPOINTER>(val), sizeof(val));
+    
+        ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+        ret = SQLGetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, &actual_row_array_size, sizeof(actual_row_array_size), &resLen);
+
+        ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+        BOOST_CHECK_EQUAL(actual_row_array_size, val);
+    }
+}
+
 BOOST_AUTO_TEST_CASE(TestSQLPrimaryKeys)
 {
     // There are no checks because we do not really care what is the result of these
diff --git a/modules/platforms/cpp/odbc/src/statement.cpp b/modules/platforms/cpp/odbc/src/statement.cpp
index cc508e3d704..f9f93ea8a0a 100644
--- a/modules/platforms/cpp/odbc/src/statement.cpp
+++ b/modules/platforms/cpp/odbc/src/statement.cpp
@@ -414,7 +414,7 @@ namespace ignite
                 {
                     SQLINTEGER *val = reinterpret_cast<SQLINTEGER*>(buf);
 
-                    *val = static_cast<SQLINTEGER>(1);
+                    *val = static_cast<SQLINTEGER>(rowArraySize);
 
                     if (valueLen)
                         *valueLen = SQL_IS_INTEGER;