• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 CONTACT_H
17 #define CONTACT_H
18 
19 #include "datashare_predicates.h"
20 #include "rdb_errno.h"
21 #include "rdb_helper.h"
22 #include "rdb_store.h"
23 
24 namespace OHOS {
25 namespace Contacts {
26 class Contacts {
27 public:
28     Contacts();
29     ~Contacts();
30     int InsertContact(std::shared_ptr<OHOS::NativeRdb::RdbStore> rdbStore, const int64_t &outRawContactId,
31         OHOS::NativeRdb::ValuesBucket rawContactValues, int64_t &contactId);
32     OHOS::NativeRdb::ValuesBucket StructureContactDataValueBucket(OHOS::NativeRdb::ValuesBucket rawContactValues);
33     int UpdateContact(const int &rawContactId, std::shared_ptr<OHOS::NativeRdb::RdbStore> rdbStore,
34         OHOS::NativeRdb::ValuesBucket linkDataDataValues);
35     int DeleteContactById(std::shared_ptr<OHOS::NativeRdb::RdbStore> rdbStore, int needDeleteContactId);
36 
37 private:
38     int ContactValueBucketGetInt(OHOS::NativeRdb::ValuesBucket rawContactValues, std::string ColumnName);
39     std::string ContactValueBucketGetString(OHOS::NativeRdb::ValuesBucket rawContactValues, std::string ColumnName);
40 };
41 } // namespace Contacts
42 } // namespace OHOS
43 #endif // CONTACT_H
44