1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 #include "general_store_mock.h"
16 namespace OHOS {
17 namespace DistributedData {
Bind(Database & database,const std::map<uint32_t,BindInfo> & bindInfos,const CloudConfig & config)18 int32_t GeneralStoreMock::Bind(Database &database, const std::map<uint32_t, BindInfo> &bindInfos,
19 const CloudConfig &config)
20 {
21 return 0;
22 }
23
IsBound()24 bool GeneralStoreMock::IsBound()
25 {
26 return false;
27 }
28
Execute(const std::string & table,const std::string & sql)29 int32_t GeneralStoreMock::Execute(const std::string &table, const std::string &sql)
30 {
31 return 0;
32 }
33
SetDistributedTables(const std::vector<std::string> & tables,int32_t type,const std::vector<Reference> & references)34 int32_t GeneralStoreMock::SetDistributedTables(
35 const std::vector<std::string> &tables, int32_t type, const std::vector<Reference> &references)
36 {
37 return 0;
38 }
39
SetTrackerTable(const std::string & tableName,const std::set<std::string> & trackerColNames,const std::string & extendColName,bool isForceUpgrade)40 int32_t GeneralStoreMock::SetTrackerTable(const std::string &tableName,
41 const std::set<std::string> &trackerColNames, const std::string &extendColName, bool isForceUpgrade)
42 {
43 return 0;
44 }
45
Insert(const std::string & table,VBuckets && values)46 int32_t GeneralStoreMock::Insert(const std::string &table, VBuckets &&values)
47 {
48 return 0;
49 }
50
Update(const std::string & table,const std::string & setSql,Values && values,const std::string & whereSql,Values && conditions)51 int32_t GeneralStoreMock::Update(const std::string &table, const std::string &setSql, Values &&values,
52 const std::string &whereSql, Values &&conditions)
53 {
54 return 0;
55 }
56
Replace(const std::string & table,VBucket && value)57 int32_t GeneralStoreMock::Replace(const std::string &table, VBucket &&value)
58 {
59 return 0;
60 }
61
Delete(const std::string & table,const std::string & sql,Values && args)62 int32_t GeneralStoreMock::Delete(const std::string &table, const std::string &sql, Values &&args)
63 {
64 return 0;
65 }
66
Query(const std::string & table,GenQuery & query)67 std::pair<int32_t, std::shared_ptr<Cursor>> GeneralStoreMock::Query(const std::string &table, GenQuery &query)
68 {
69 return {GeneralError::E_NOT_SUPPORT, nullptr};
70 }
71
Sync(const Devices & devices,GenQuery & query,DetailAsync async,const SyncParam & syncParm)72 std::pair<int32_t, int32_t> GeneralStoreMock::Sync(const Devices &devices, GenQuery &query, DetailAsync async,
73 const SyncParam &syncParm)
74 {
75 return { GeneralError::E_OK, 0 };
76 }
77
PreSharing(GenQuery & query)78 std::pair<int32_t, std::shared_ptr<Cursor>> GeneralStoreMock::PreSharing(GenQuery &query)
79 {
80 return {GeneralError::E_NOT_SUPPORT, nullptr};
81 }
82
Clean(const std::vector<std::string> & devices,int32_t mode,const std::string & tableName)83 int32_t GeneralStoreMock::Clean(const std::vector<std::string> &devices, int32_t mode, const std::string &tableName)
84 {
85 return 0;
86 }
87
Watch(int32_t origin,Watcher & watcher)88 int32_t GeneralStoreMock::Watch(int32_t origin, Watcher &watcher)
89 {
90 return 0;
91 }
92
Unwatch(int32_t origin,Watcher & watcher)93 int32_t GeneralStoreMock::Unwatch(int32_t origin, Watcher &watcher)
94 {
95 return 0;
96 }
97
RegisterDetailProgressObserver(DetailAsync async)98 int32_t GeneralStoreMock::RegisterDetailProgressObserver(DetailAsync async)
99 {
100 return 0;
101 }
102
UnregisterDetailProgressObserver()103 int32_t GeneralStoreMock::UnregisterDetailProgressObserver()
104 {
105 return 0;
106 }
107
Close(bool isForce)108 int32_t GeneralStoreMock::Close(bool isForce)
109 {
110 return 0;
111 }
112
AddRef()113 int32_t GeneralStoreMock::AddRef()
114 {
115 return 0;
116 }
117
Release()118 int32_t GeneralStoreMock::Release()
119 {
120 return 0;
121 }
122
BindSnapshots(std::shared_ptr<std::map<std::string,std::shared_ptr<Snapshot>>> bindAssets)123 int32_t GeneralStoreMock::BindSnapshots(std::shared_ptr<std::map<std::string, std::shared_ptr<Snapshot>>> bindAssets)
124 {
125 return 0;
126 }
127
MergeMigratedData(const std::string & tableName,VBuckets && values)128 int32_t GeneralStoreMock::MergeMigratedData(const std::string &tableName, VBuckets &&values)
129 {
130 return 0;
131 }
132
CleanTrackerData(const std::string & tableName,int64_t cursor)133 int32_t GeneralStoreMock::CleanTrackerData(const std::string &tableName, int64_t cursor)
134 {
135 return 0;
136 }
137
Query(const std::string & table,const std::string & sql,Values && args)138 std::pair<int32_t, std::shared_ptr<Cursor>> GeneralStoreMock::Query(const std::string &table, const std::string &sql,
139 Values &&args)
140 {
141 return {GeneralError::E_OK, cursor_};
142 }
143
GetWaterVersion(const std::string & deviceId)144 std::vector<std::string> GeneralStoreMock::GetWaterVersion(const std::string &deviceId)
145 {
146 return std::vector<std::string>();
147 }
148
MakeCursor(const std::map<std::string,Value> & entry)149 void GeneralStoreMock::MakeCursor(const std::map<std::string, Value> &entry)
150 {
151 auto resultSet = std::make_shared<CursorMock::ResultSet>(1, entry);
152 cursor_ = std::make_shared<CursorMock>(resultSet);
153 }
154
LockCloudDB()155 std::pair<int32_t, uint32_t> GeneralStoreMock::LockCloudDB()
156 {
157 return { E_OK, 0 };
158 }
159
UnLockCloudDB()160 int32_t GeneralStoreMock::UnLockCloudDB()
161 {
162 return E_OK;
163 }
164
SetExecutor(std::shared_ptr<Executor> executor)165 void GeneralStoreMock::SetExecutor(std::shared_ptr<Executor> executor)
166 {
167 return;
168 }
169 } // namespace DistributedData
170 } // namespace OHOS