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
16 #include "mock.h"
17
18 #include "relational_store_client.h"
19
20 namespace OHOS {
PathToRealPath(const std::string & path,std::string & realPath)21 __attribute__((visibility("default"))) bool PathToRealPath(const std::string &path, std::string &realPath)
22 {
23 realPath = path;
24 return true;
25 }
26
ExtractFilePath(const std::string & fileFullName)27 __attribute__((visibility("default"))) std::string ExtractFilePath(const std::string &fileFullName)
28 {
29 return std::string(fileFullName).substr(0, fileFullName.rfind("/") + 1);
30 }
31
32 namespace NativeRdb {
33 struct SharedBlockInfo;
34 struct sqlite3_stmt;
gettid()35 __attribute__((visibility("default"))) int gettid()
36 {
37 return 0;
38 }
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
FillSharedBlockOpt(SharedBlockInfo * info,sqlite3_stmt * stmt)42 __attribute__((visibility("default"))) int FillSharedBlockOpt(SharedBlockInfo *info, sqlite3_stmt *stmt)
43 {
44 (void)info;
45 (void)stmt;
46 return 0;
47 }
48
FillSharedBlock(SharedBlockInfo * info,sqlite3_stmt * stmt)49 __attribute__((visibility("default"))) int FillSharedBlock(SharedBlockInfo *info, sqlite3_stmt *stmt)
50 {
51 (void)info;
52 (void)stmt;
53 return 0;
54 }
55
ResetStatement(SharedBlockInfo * info,sqlite3_stmt * stmt)56 __attribute__((visibility("default"))) bool ResetStatement(SharedBlockInfo *info, sqlite3_stmt *stmt)
57 {
58 (void)info;
59 (void)stmt;
60 return true;
61 }
62
63 #ifdef __cplusplus
64 }
65 #endif
66 } // namespace NativeRdb
67 } // namespace OHOS
68
69 using namespace DistributedDB;
UnRegisterClientObserver(sqlite3 * db)70 __attribute__((visibility("default"))) DBStatus UnRegisterClientObserver(sqlite3 *db)
71 {
72 return DBStatus::OK;
73 }
74
RegisterStoreObserver(sqlite3 * db,const std::shared_ptr<StoreObserver> & storeObserver)75 __attribute__((visibility("default"))) DBStatus RegisterStoreObserver(
76 sqlite3 *db, const std::shared_ptr<StoreObserver> &storeObserver)
77 {
78 return DBStatus::OK;
79 }
80
UnregisterStoreObserver(sqlite3 * db,const std::shared_ptr<StoreObserver> & storeObserver)81 __attribute__((visibility("default"))) DBStatus UnregisterStoreObserver(
82 sqlite3 *db, const std::shared_ptr<StoreObserver> &storeObserver)
83 {
84 return DBStatus::OK;
85 }
86
UnregisterStoreObserver(sqlite3 * db)87 __attribute__((visibility("default"))) DBStatus UnregisterStoreObserver(sqlite3 *db)
88 {
89 return DBStatus::OK;
90 }
91
Lock(const std::string & tableName,const std::vector<std::vector<uint8_t>> & hashKey,sqlite3 * db)92 __attribute__((visibility("default"))) DBStatus Lock(
93 const std::string &tableName, const std::vector<std::vector<uint8_t>> &hashKey, sqlite3 *db)
94 {
95 return DBStatus::OK;
96 }
97
UnLock(const std::string & tableName,const std::vector<std::vector<uint8_t>> & hashKey,sqlite3 * db)98 __attribute__((visibility("default"))) DBStatus UnLock(
99 const std::string &tableName, const std::vector<std::vector<uint8_t>> &hashKey, sqlite3 *db)
100 {
101 return DBStatus::OK;
102 }
103
DropLogicDeletedData(sqlite3 * db,const std::string & tableName,uint64_t cursor)104 __attribute__((visibility("default"))) DBStatus DropLogicDeletedData(
105 sqlite3 *db, const std::string &tableName, uint64_t cursor)
106 {
107 (void)db;
108 (void)tableName;
109 (void)cursor;
110 return DBStatus::OK;
111 }
112
RegisterDbHook(sqlite3 * db)113 __attribute__((visibility("default"))) void RegisterDbHook(sqlite3 *db)
114 {
115 (void)db;
116 }
117
UnregisterDbHook(sqlite3 * db)118 __attribute__((visibility("default"))) void UnregisterDbHook(sqlite3 *db)
119 {
120 (void)db;
121 }
122
CreateDataChangeTempTrigger(sqlite3 * db)123 __attribute__((visibility("default"))) DBStatus CreateDataChangeTempTrigger(sqlite3 *db)
124 {
125 (void)db;
126 return DBStatus::OK;
127 }
128
GetDistributedLogTableName(const std::string & tableName)129 __attribute__((visibility("default"))) std::string DistributedDB::RelationalStoreManager::GetDistributedLogTableName(
130 const std::string &tableName)
131 {
132 return "";
133 }