• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 DISTRIBUTEDDATAFWK_IDATA_SHARE_SERVICE_H
17 #define DISTRIBUTEDDATAFWK_IDATA_SHARE_SERVICE_H
18 
19 #include <iremote_broker.h>
20 #include <string>
21 
22 #include "datashare_predicates.h"
23 #include "datashare_result_set.h"
24 #include "datashare_values_bucket.h"
25 
26 namespace OHOS::DataShare {
27 class IDataShareService {
28 public:
29     enum {
30         DATA_SHARE_SERVICE_CMD_INSERT,
31         DATA_SHARE_SERVICE_CMD_DELETE,
32         DATA_SHARE_SERVICE_CMD_UPDATE,
33         DATA_SHARE_SERVICE_CMD_QUERY,
34         DATA_SHARE_SERVICE_CMD_MAX
35     };
36 
37     enum { DATA_SHARE_ERROR = -1, DATA_SHARE_OK = 0 };
38     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DataShare.IDataShareService");
39 
40     virtual int32_t Insert(const std::string &uri, const DataShareValuesBucket &valuesBucket) = 0;
41     virtual int32_t Update(
42         const std::string &uri, const DataSharePredicates &predicate, const DataShareValuesBucket &valuesBucket) = 0;
43     virtual int32_t Delete(const std::string &uri, const DataSharePredicates &predicate) = 0;
44     virtual std::shared_ptr<DataShareResultSet> Query(
45         const std::string &uri, const DataSharePredicates &predicates, const std::vector<std::string> &columns) = 0;
46 };
47 } // namespace OHOS::DataShare
48 #endif
49