• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_meta_item.h"
17 #include "app_details_rdb_const_define.h"
18 
19 namespace OHOS {
20 namespace AppDomainVerify {
21 
GetRdbItem(std::shared_ptr<AbsSharedResultSet> & retSet)22 bool MetaItem::GetRdbItem(std::shared_ptr<AbsSharedResultSet> &retSet)
23 {
24     int errCode = NativeRdb::E_OK;
25     errCode = retSet->GetString(META_TABLE_NAME_INDEX, tableName);
26     if (errCode != NativeRdb::E_OK) {
27         return false;
28     }
29     errCode = retSet->GetString(META_TABLE_VERSION_INDEX, tableVersion);
30     if (errCode != NativeRdb::E_OK) {
31         return false;
32     }
33     errCode = retSet->GetString(META_TABLE_EXT_INFO_INDEX, tableExtInfo);
34     if (errCode != NativeRdb::E_OK) {
35         return false;
36     }
37     errCode = retSet->GetString(META_UPDATE_TIME_INDEX, updateTime);
38     if (errCode != NativeRdb::E_OK) {
39         return false;
40     }
41     return true;
42 };
43 
AddRdbItemToBucket(NativeRdb::ValuesBucket & bucket)44 void MetaItem::AddRdbItemToBucket(NativeRdb::ValuesBucket &bucket)
45 {
46     bucket.PutString(META_TABLE_NAME, tableName);
47     bucket.PutString(META_TABLE_VERSION, tableVersion);
48     bucket.PutString(META_TABLE_EXT_INFO, tableExtInfo);
49     bucket.PutString(META_UPDATE_TIME, updateTime);
50 };
51 }
52 }
53