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