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

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


The following commit(s) were added to refs/heads/main by this push:
     new 93bb229567a IGNITE-21556 ODBC Add params-related test (#6769)
93bb229567a is described below

commit 93bb229567a68b85c9430651f40808272ceae67c
Author: Igor Sapego <[email protected]>
AuthorDate: Tue Oct 14 17:54:14 2025 +0200

    IGNITE-21556 ODBC Add params-related test (#6769)
---
 modules/platforms/cpp/ignite/odbc/odbc.cpp         |  4 +++-
 .../cpp/tests/odbc-test/api_robustness_test.cpp    | 28 ++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/modules/platforms/cpp/ignite/odbc/odbc.cpp 
b/modules/platforms/cpp/ignite/odbc/odbc.cpp
index dd7c6d2121f..d49c0464597 100644
--- a/modules/platforms/cpp/ignite/odbc/odbc.cpp
+++ b/modules/platforms/cpp/ignite/odbc/odbc.cpp
@@ -150,7 +150,9 @@ SQLRETURN SQLAllocHandle(SQLSMALLINT type, SQLHANDLE 
parent, SQLHANDLE *result)
             break;
     }
 
-    *result = nullptr;
+    if (result)
+        *result = nullptr;
+
     return SQL_ERROR;
 }
 
diff --git a/modules/platforms/cpp/tests/odbc-test/api_robustness_test.cpp 
b/modules/platforms/cpp/tests/odbc-test/api_robustness_test.cpp
index 8776f73d3aa..652d8a48023 100644
--- a/modules/platforms/cpp/tests/odbc-test/api_robustness_test.cpp
+++ b/modules/platforms/cpp/tests/odbc-test/api_robustness_test.cpp
@@ -880,3 +880,31 @@ TEST_F(api_robustness_test, many_fds) {
             fclose(fd);
     }
 }
+
+TEST_F(api_robustness_test, reusing_connection_with_args) {
+    odbc_connect(get_basic_connection_string());
+
+    std::vector<std::int64_t> mem;
+    // Allocating a bunch of memory so the new page is allocated
+    mem.resize(1024 * 1024);
+    SQLRETURN ret = SQLBindParameter(m_statement, 1, SQL_PARAM_INPUT, 
SQL_C_SBIGINT, SQL_BIGINT, 0, 0, &mem.back(), 8, &mem.back());
+    if (!SQL_SUCCEEDED(ret))
+        FAIL() << get_odbc_error_message(SQL_HANDLE_STMT, m_statement);
+
+    SQLCHAR firstReq[] = "SELECT ?";
+    ret = SQLExecDirect(m_statement, firstReq, SQL_NTS);
+    if (!SQL_SUCCEEDED(ret))
+        FAIL() << get_odbc_error_message(SQL_HANDLE_STMT, m_statement);
+
+    // Un-binding parameter.
+    ret = SQLFreeStmt(m_statement, SQL_RESET_PARAMS);
+    if (!SQL_SUCCEEDED(ret))
+        FAIL() << get_odbc_error_message(SQL_HANDLE_STMT, m_statement);
+
+    // De-allocation happens here
+    mem = std::vector<std::int64_t>();
+    mem.reserve(1);
+
+    SQLCHAR secondReq[] = "SELECT 1";
+    SQLExecDirect(m_statement, secondReq, SQL_NTS);
+}

Reply via email to