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,SyncParam & syncParm)72 int32_t GeneralStoreMock::Sync(const Devices &devices, GenQuery &query, DetailAsync async, SyncParam &syncParm)
73 {
74 return 0;
75 }
76
PreSharing(GenQuery & query)77 std::pair<int32_t, std::shared_ptr<Cursor>> GeneralStoreMock::PreSharing(GenQuery &query)
78 {
79 return {GeneralError::E_NOT_SUPPORT, nullptr};
80 }
81
Clean(const std::vector<std::string> & devices,int32_t mode,const std::string & tableName)82 int32_t GeneralStoreMock::Clean(const std::vector<std::string> &devices, int32_t mode, const std::string &tableName)
83 {
84 return 0;
85 }
86
Watch(int32_t origin,Watcher & watcher)87 int32_t GeneralStoreMock::Watch(int32_t origin, Watcher &watcher)
88 {
89 return 0;
90 }
91
Unwatch(int32_t origin,Watcher & watcher)92 int32_t GeneralStoreMock::Unwatch(int32_t origin, Watcher &watcher)
93 {
94 return 0;
95 }
96
RegisterDetailProgressObserver(DetailAsync async)97 int32_t GeneralStoreMock::RegisterDetailProgressObserver(DetailAsync async)
98 {
99 return 0;
100 }
101
UnregisterDetailProgressObserver()102 int32_t GeneralStoreMock::UnregisterDetailProgressObserver()
103 {
104 return 0;
105 }
106
Close(bool isForce)107 int32_t GeneralStoreMock::Close(bool isForce)
108 {
109 return 0;
110 }
111
AddRef()112 int32_t GeneralStoreMock::AddRef()
113 {
114 return 0;
115 }
116
Release()117 int32_t GeneralStoreMock::Release()
118 {
119 return 0;
120 }
121
BindSnapshots(std::shared_ptr<std::map<std::string,std::shared_ptr<Snapshot>>> bindAssets)122 int32_t GeneralStoreMock::BindSnapshots(std::shared_ptr<std::map<std::string, std::shared_ptr<Snapshot>>> bindAssets)
123 {
124 return 0;
125 }
126
MergeMigratedData(const std::string & tableName,VBuckets && values)127 int32_t GeneralStoreMock::MergeMigratedData(const std::string &tableName, VBuckets &&values)
128 {
129 return 0;
130 }
131
CleanTrackerData(const std::string & tableName,int64_t cursor)132 int32_t GeneralStoreMock::CleanTrackerData(const std::string &tableName, int64_t cursor)
133 {
134 return 0;
135 }
136
Query(const std::string & table,const std::string & sql,Values && args)137 std::pair<int32_t, std::shared_ptr<Cursor>> GeneralStoreMock::Query(const std::string &table, const std::string &sql,
138 Values &&args)
139 {
140 return {GeneralError::E_OK, cursor_};
141 }
142
GetWaterVersion(const std::string & deviceId)143 std::vector<std::string> GeneralStoreMock::GetWaterVersion(const std::string &deviceId)
144 {
145 return std::vector<std::string>();
146 }
147
MakeCursor(const std::map<std::string,Value> & entry)148 void GeneralStoreMock::MakeCursor(const std::map<std::string, Value> &entry)
149 {
150 auto resultSet = std::make_shared<CursorMock::ResultSet>(1, entry);
151 cursor_ = std::make_shared<CursorMock>(resultSet);
152 }
153
LockCloudDB()154 std::pair<int32_t, uint32_t> GeneralStoreMock::LockCloudDB()
155 {
156 return { E_OK, 0 };
157 }
158
UnLockCloudDB()159 int32_t GeneralStoreMock::UnLockCloudDB()
160 {
161 return E_OK;
162 }
163
SetExecutor(std::shared_ptr<Executor> executor)164 void GeneralStoreMock::SetExecutor(std::shared_ptr<Executor> executor)
165 {
166 return;
167 }
168 } // namespace DistributedData
169 } // namespace OHOS