From e98d7b97ef722f49b4b6504ce39f6e4386edddc0 Mon Sep 17 00:00:00 2001 From: lianhuix Date: Tue, 31 Jan 2023 12:19:19 +0000 Subject: [PATCH] Fix get query return Signed-off-by: lianhuix --- .../libs/distributeddb/syncer/src/single_ver_sync_target.cpp | 2 +- frameworks/libs/distributeddb/syncer/src/sync_operation.cpp | 4 ++-- frameworks/libs/distributeddb/syncer/src/sync_operation.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frameworks/libs/distributeddb/syncer/src/single_ver_sync_target.cpp b/frameworks/libs/distributeddb/syncer/src/single_ver_sync_target.cpp index 1a03df1bd49..b471ae705d8 100644 --- a/frameworks/libs/distributeddb/syncer/src/single_ver_sync_target.cpp +++ b/frameworks/libs/distributeddb/syncer/src/single_ver_sync_target.cpp @@ -35,7 +35,7 @@ void SingleVerSyncTarget::SetSyncOperation(SyncOperation *operation) { SyncTarget::SetSyncOperation(operation); if ((operation != nullptr) && !operation->IsKilled()) { - operation->GetQuery(query_); + query_ = operation->GetQuery(); isQuerySync_ = operation->IsQuerySync(); } } diff --git a/frameworks/libs/distributeddb/syncer/src/sync_operation.cpp b/frameworks/libs/distributeddb/syncer/src/sync_operation.cpp index 812c39c951a..f31faa4c891 100644 --- a/frameworks/libs/distributeddb/syncer/src/sync_operation.cpp +++ b/frameworks/libs/distributeddb/syncer/src/sync_operation.cpp @@ -241,10 +241,10 @@ void SyncOperation::SetQuery(const QuerySyncObject &query) } } -void SyncOperation::GetQuery(QuerySyncObject &targetObject) const +QuerySyncObject SyncOperation::GetQuery() const { std::lock_guard lock(queryMutex_); - targetObject = query_; + return query_; } bool SyncOperation::IsQuerySync() const diff --git a/frameworks/libs/distributeddb/syncer/src/sync_operation.h b/frameworks/libs/distributeddb/syncer/src/sync_operation.h index d1542e89991..fa2ea12c4ba 100644 --- a/frameworks/libs/distributeddb/syncer/src/sync_operation.h +++ b/frameworks/libs/distributeddb/syncer/src/sync_operation.h @@ -121,7 +121,7 @@ public: // For query sync void SetQuery(const QuerySyncObject &query); - void GetQuery(QuerySyncObject &targetObject) const; + QuerySyncObject GetQuery() const; bool IsQuerySync() const; std::string GetQueryId() const; static SyncType GetSyncType(int mode); -- Gitee