Refactoring to extract duplicate logic as a separate method
[platform/core/dotnet/launcher.git] / NativeLauncher / inc / tac_db.h
1 /*
2  * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __TAC_DB_H__
18 #define __TAC_DB_H__
19
20 #include <functional>
21 #include <string>
22
23 int sqliteCb(void *count, int argc, char **argv, char **colName);
24
25
26 /* TAC related DB functions */
27 int tac_createDB();
28
29 int tac_openDB();
30
31 int tac_insertDB(const std::string& pkgId, const std::string& np, const std::string& tac_name, const std::string& tac_version);
32
33 int tac_countDB(const std::string& pkgId, const std::string& tac_name, const std::string& unp, int& count);
34
35 std::vector<std::string> tac_selectDB(const std::string& pkgId);
36
37 int tac_updateDB(const std::string& pkgId, const std::string& np, const std::string& tac_name, const std::string& tac_version);
38
39 int tac_deleteDB(const std::string& pkgId, const std::string& unp);
40
41 void tac_rollbackDB();
42
43 bool tac_closeDB();
44
45
46 /* TAC related DB functions */
47 int tlc_createDB();
48
49 int tlc_openDB();
50
51 int tlc_insertDB(const std::string& pkgId, const std::string& fileSha);
52
53 int tlc_countDB(const std::string& pkgId, const std::string& ulp, int& count);
54
55 std::vector<std::string> tlc_selectDB(const std::string& pkgId);
56
57 int tlc_deleteDB(const std::string& pkgId);
58
59 void tlc_rollbackDB();
60
61 bool tlc_closeDB();
62
63 #endif /* __TAC_DB_H__ */