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 "app_details_rdb_item.h"
17 #include "app_details_rdb_const_define.h"
18 #include "rdb_errno.h"
19 namespace OHOS {
20 namespace AppDomainVerify {
21
GetRdbItem(std::shared_ptr<AbsSharedResultSet> & retSet)22 bool AppDetailsRdbItem::GetRdbItem(std::shared_ptr<AbsSharedResultSet> &retSet)
23 {
24 int errCode = NativeRdb::E_OK;
25 errCode = retSet->GetString(DETAILS_ID_INDEX, id);
26 if (errCode != NativeRdb::E_OK) {
27 return false;
28 }
29 errCode = retSet->GetString(DETAILS_SCHEME_INDEX, scheme);
30 if (errCode != NativeRdb::E_OK) {
31 return false;
32 }
33 errCode = retSet->GetString(DETAILS_DOMAIN_INDEX, domain);
34 if (errCode != NativeRdb::E_OK) {
35 return false;
36 }
37 errCode = retSet->GetString(DETAILS_PATH_TYPE_INDEX, pathType);
38 if (errCode != NativeRdb::E_OK) {
39 return false;
40 }
41 errCode = retSet->GetString(DETAILS_PATH_INDEX, path);
42 if (errCode != NativeRdb::E_OK) {
43 return false;
44 }
45 errCode = retSet->GetString(DETAILS_BUNDLE_NAME_INDEX, bundleName);
46 if (errCode != NativeRdb::E_OK) {
47 return false;
48 }
49 return true;
50 };
51
AddRdbItemToBucket(NativeRdb::ValuesBucket & bucket)52 void AppDetailsRdbItem::AddRdbItemToBucket(NativeRdb::ValuesBucket &bucket)
53 {
54 bucket.PutString(DETAILS_ID, id);
55 bucket.PutString(DETAILS_SCHEME, scheme);
56 bucket.PutString(DETAILS_DOMAIN, domain);
57 bucket.PutString(DETAILS_PATH_TYPE, pathType);
58 bucket.PutString(DETAILS_PATH, path);
59 bucket.PutString(DETAILS_BUNDLE_NAME, bundleName);
60 }
61 }
62 }