1 /*
2 * Copyright (c) 2025 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 "access_token_db_operator.h"
17 #ifdef DYNAMIC_CLOSE_LIBS
18 #include "rdb_dlopen_manager.h"
19 #else
20 #include "access_token_db.h"
21 #endif
22
23 namespace OHOS {
24 namespace Security {
25 namespace AccessToken {
Modify(const AtmDataType type,const GenericValues & modifyValue,const GenericValues & conditionValue)26 int32_t AccessTokenDbOperator::Modify(const AtmDataType type, const GenericValues& modifyValue,
27 const GenericValues& conditionValue)
28 {
29 #ifdef DYNAMIC_CLOSE_LIBS
30 return RdbDlopenManager::GetInstance()->Modify(type, modifyValue, conditionValue);
31 #else
32 return AccessTokenDb::GetInstance()->Modify(type, modifyValue, conditionValue);
33 #endif
34 }
35
Find(AtmDataType type,const GenericValues & conditionValue,std::vector<GenericValues> & results)36 int32_t AccessTokenDbOperator::Find(AtmDataType type, const GenericValues& conditionValue,
37 std::vector<GenericValues>& results)
38 {
39 #ifdef DYNAMIC_CLOSE_LIBS
40 return RdbDlopenManager::GetInstance()->Find(type, conditionValue, results);
41 #else
42 return AccessTokenDb::GetInstance()->Find(type, conditionValue, results);
43 #endif
44 }
45
DeleteAndInsertValues(const std::vector<DelInfo> & delInfoVec,const std::vector<AddInfo> & addInfoVec)46 int32_t AccessTokenDbOperator::DeleteAndInsertValues(const std::vector<DelInfo>& delInfoVec,
47 const std::vector<AddInfo>& addInfoVec)
48 {
49 #ifdef DYNAMIC_CLOSE_LIBS
50 return RdbDlopenManager::GetInstance()->DeleteAndInsertValues(delInfoVec, addInfoVec);
51 #else
52 return AccessTokenDb::GetInstance()->DeleteAndInsertValues(delInfoVec, addInfoVec);
53 #endif
54 }
55 } // namespace AccessToken
56 } // namespace Security
57 } // namespace OHOS
58