1 /* 2 * Copyright (C) 2021 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 DATA_STORAGE_RDB_PDP_OPERATOR_HELPER_H 17 #define DATA_STORAGE_RDB_PDP_OPERATOR_HELPER_H 18 19 #include "rdb_base_helper.h" 20 #include "pdp_profile_data.h" 21 22 namespace OHOS { 23 namespace Telephony { 24 class RdbPdpProfileHelper : public RdbBaseHelper { 25 public: 26 RdbPdpProfileHelper(); 27 ~RdbPdpProfileHelper() = default; 28 29 /** 30 * Init dataBase 31 * 32 * @return 0 is succeed else failed 33 */ 34 int Init(); 35 36 /** 37 * Update dataBase path 38 * 39 * @param path path 40 */ 41 void UpdateDbPath(const std::string &path); 42 43 /** 44 * Reload pdp_profile table data form config json file 45 * 46 * @return 0 is succeed else failed 47 */ 48 int ResetApn(); 49 50 private: 51 /** 52 * Create pdp_profile table 53 * 54 * @param createTableStr Create table statement 55 * @param tableName tableName 56 */ 57 void CreatePdpProfileTableStr(std::string &createTableStr, const std::string &tableName); 58 59 /** 60 * End the transaction action 61 * 62 * @return 0 is succeed else failed 63 */ 64 int EndTransactionAction(); 65 66 /** 67 * Commit the transaction action 68 * 69 * @return 0 is succeed else failed 70 */ 71 int CommitTransactionAction(); 72 73 private: 74 const std::string DB_NAME = "net.db"; 75 std::string dbPath_ = FOLDER_PATH + DB_NAME; 76 const int VERSION = 1; 77 }; 78 } // namespace Telephony 79 } // namespace OHOS 80 #endif // DATA_STORAGE_RDB_PDP_OPERATOR_HELPER_H 81