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 "datashare_helper.h"
17 #include "datashare_result_set.h"
18
19 namespace OHOS {
20 namespace DataShare {
21 std::shared_ptr<DataShareHelper> DataShareHelper::instance_;
EqualTo(const std::string & field,const std::string & value)22 DataSharePredicates *DataSharePredicates::EqualTo(const std::string &field, const std::string &value)
23 {
24 return this;
25 }
26
Creator(const std::string & strUri,const CreateOptions & options,const std::string & bundleName)27 std::shared_ptr<DataShareHelper> DataShareHelper::Creator(
28 const std::string &strUri, const CreateOptions &options, const std::string &bundleName)
29 {
30 if (instance_ != nullptr) {
31 return instance_;
32 }
33 instance_ = std::make_shared<DataShareHelper>();
34 return instance_;
35 }
36
Query(Uri & uri,const DataSharePredicates & predicates,std::vector<std::string> & columns,DatashareBusinessError * businessError)37 std::shared_ptr<DataShareResultSet> DataShareHelper::Query(Uri &uri, const DataSharePredicates &predicates,
38 std::vector<std::string> &columns, DatashareBusinessError *businessError)
39 {
40 if (resultSet_ != nullptr) {
41 return resultSet_;
42 }
43 resultSet_ = std::make_shared<DataShareResultSet>();
44 return resultSet_;
45 }
46
RegisterObserver(const Uri & uri,const sptr<AAFwk::IDataAbilityObserver> & dataObserver)47 void DataShareHelper::RegisterObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver)
48 {
49 return;
50 }
51
UnregisterObserver(const Uri & uri,const sptr<AAFwk::IDataAbilityObserver> & dataObserver)52 void DataShareHelper::UnregisterObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver)
53 {
54 return;
55 }
56
Release()57 bool DataShareHelper::Release()
58 {
59 return true;
60 }
61 } // namespace OHOS
62 } // namespace DataShare