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

rong pushed a commit to branch iotdb-1545
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit b9ea626eefaf0274aaeeb89fd9627969e55e9fff
Author: Steve Yurong Su <[email protected]>
AuthorDate: Wed Aug 4 12:07:25 2021 +0800

    fix leak caused by cpp client
---
 client-cpp/src/main/Session.cpp | 3 ++-
 client-cpp/src/main/Session.h   | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/client-cpp/src/main/Session.cpp b/client-cpp/src/main/Session.cpp
index 75713b2..59a7099 100644
--- a/client-cpp/src/main/Session.cpp
+++ b/client-cpp/src/main/Session.cpp
@@ -332,6 +332,7 @@ RowRecord *SessionDataSet::next() {
 void SessionDataSet::closeOperationHandle() {
     shared_ptr <TSCloseOperationReq> closeReq(new TSCloseOperationReq());
     closeReq->__set_sessionId(sessionId);
+    closeReq->__set_statementId(statementId);
     closeReq->__set_queryId(queryId);
     shared_ptr <TSStatus> closeResp(new TSStatus());
     try {
@@ -1073,7 +1074,7 @@ unique_ptr <SessionDataSet> 
Session::executeQueryStatement(string sql) {
     }
     shared_ptr <TSQueryDataSet> queryDataSet(new 
TSQueryDataSet(resp->queryDataSet));
     return unique_ptr<SessionDataSet>(new SessionDataSet(
-            sql, resp->columns, resp->dataTypeList, resp->queryId, client, 
sessionId, queryDataSet));
+            sql, resp->columns, resp->dataTypeList, resp->queryId, 
statementId, client, sessionId, queryDataSet));
 }
 
 void Session::executeNonQueryStatement(string sql) {
diff --git a/client-cpp/src/main/Session.h b/client-cpp/src/main/Session.h
index 620279f..4b0dc7a 100644
--- a/client-cpp/src/main/Session.h
+++ b/client-cpp/src/main/Session.h
@@ -491,6 +491,7 @@ private:
     bool hasCachedRecord = false;
     std::string sql;
     int64_t queryId;
+    int64_t statementId;
     int64_t sessionId;
     std::shared_ptr <TSIServiceIf> client;
     int batchSize = 1024;
@@ -516,12 +517,13 @@ public:
     SessionDataSet() {}
 
     SessionDataSet(std::string sql, std::vector <std::string> &columnNameList,
-                   std::vector <std::string> &columnTypeList, int64_t queryId,
+                   std::vector <std::string> &columnTypeList, int64_t queryId, 
int64_t statementId,
                    std::shared_ptr <TSIServiceIf> client, int64_t sessionId,
                    std::shared_ptr <TSQueryDataSet> queryDataSet) : 
tsQueryDataSetTimeBuffer(queryDataSet->time) {
         this->sessionId = sessionId;
         this->sql = sql;
         this->queryId = queryId;
+        this->statementId = statementId;
         this->client = client;
         this->columnNameList = columnNameList;
         this->currentBitmap = new char[columnNameList.size()];

Reply via email to