1 /*
2  * Copyright (c) 2023 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 #ifndef OHOS_DP_IRDB_ADAPTER_H
17 #define OHOS_DP_IRDB_ADAPTER_H
18 
19 #include <string>
20 #include <cstdint>
21 #include <vector>
22 #include <memory>
23 #include "rdb_helper.h"
24 #include "rdb_store.h"
25 #include "result_set.h"
26 
27 namespace OHOS {
28 namespace DistributedDeviceProfile {
29 using namespace OHOS::NativeRdb;
30 
31 class IRdbAdapter {
32 public:
33     IRdbAdapter() = default;
34     virtual ~IRdbAdapter() = default;
35     virtual int32_t Init() = 0;
36     virtual int32_t UnInit() = 0;
37     virtual int32_t Put(int64_t& outRowId, const std::string& table, const ValuesBucket& Values) = 0;
38     virtual int32_t Delete(int32_t& deleteRows, const std::string& table, const std::string& whereClause = "",
39         const std::vector<ValueObject>& bindArgs = {}) = 0;
40     virtual int32_t Update(int32_t& changedRows, const std::string& table,
41         const ValuesBucket& values, const std::string& whereClause = "",
42         const std::vector<ValueObject>& bindArgs = {}) = 0;
43     virtual int32_t CreateTable(const std::string& sql) = 0;
44     virtual std::shared_ptr<ResultSet> Get(const std::string& sql,
45         const std::vector<ValueObject>& args = {}) = 0;
46 };
47 } // namespace DistributedDeviceProfile
48 } // namespace OHOS
49 #endif // OHOS_DP_IRDB_ADAPTER_H
50