tizen 2.3 release
[framework/appfw/pkgmgr-info.git] / parser / pkgmgr_parser_db.h
1 /*
2  * pkgmgr-info
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7  * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23
24 /**
25  * @file                pkgmgr_parser_db.h
26  * @author      Shobhit Srivastava <shobhit.s@samsung.com>
27  * @version     0.1
28  * @brief               This file declares API to store/retrieve manifest data in DB
29  *
30  * @addtogroup APPLICATION_FRAMEWORK
31  * @{
32  *
33   * @defgroup   PackageManagerParserDB
34  * @section     Header Header file to include:
35  * @code
36  * #include <pkgmgr_parser_db.h>
37  * @endcode
38  *
39  * @}
40  */
41
42 #ifndef __PKGMGR_PARSER_DB_H__
43 #define __PKGMGR_PARSER_DB_H__
44
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 #include "pkgmgr_parser.h"
49 #include "pkgmgr_parser_feature.h"
50
51 #define PKGMGR_PARSER_DB_FILE "/opt/dbspace/.pkgmgr_parser.db"
52 #define PKGMGR_CERT_DB_FILE "/opt/dbspace/.pkgmgr_cert.db"
53
54 /**
55  * @fn int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx)
56  * @brief       This API inserts the parsed manifest info in db
57  *
58  * @par         This API is for package-manager installer backends
59  * @par Sync (or) Async : Synchronous API
60  *
61  * @param[in]   mfx     pointer to manifest info
62  * @return      0 if success, error code(<0) if fail
63  * @pre         None
64  * @post                None
65  * @see         pkgmgr_parser_update_manifest_info_in_db()
66  * @see         pkgmgr_parser_delete_manifest_info_from_db()
67  * @code
68 static int insert_manifest_data(manifest_x *mfx)
69 {
70         int ret = 0;
71         ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
72         if (ret < 0)
73                 return -1;
74         return 0;
75 }
76  * @endcode
77  */
78 int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx);
79
80 /**
81  * @fn int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx)
82  * @brief       This API updates the manifest info in db
83  *
84  * @par         This API is for package-manager installer backends
85  * @par Sync (or) Async : Synchronous API
86  *
87  * @param[in]   mfx     pointer to manifest info
88  * @return      0 if success, error code(<0) if fail
89  * @pre         None
90  * @post                None
91  * @see         pkgmgr_parser_insert_manifest_info_in_db()
92  * @see         pkgmgr_parser_delete_manifest_info_from_db()
93  * @code
94 static int update_manifest_data(manifest_x *mfx)
95 {
96         int ret = 0;
97         ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
98         if (ret < 0)
99                 return -1;
100         return 0;
101 }
102  * @endcode
103  */
104 int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx);
105
106 /**
107  * @fn int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx)
108  * @brief       This API deletes the parsed manifest info from db
109  *
110  * @par         This API is for package-manager installer backends
111  * @par Sync (or) Async : Synchronous API
112  *
113  * @param[in]   mfx     pointer to manifest info
114  * @return      0 if success, error code(<0) if fail
115  * @pre         None
116  * @post                None
117  * @see         pkgmgr_parser_update_manifest_info_in_db()
118  * @see         pkgmgr_parser_insert_manifest_info_in_db()
119  * @code
120 static int delete_manifest_data(manifest_x *mfx)
121 {
122         int ret = 0;
123         ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
124         if (ret < 0)
125                 return -1;
126         return 0;
127 }
128  * @endcode
129  */
130 int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx);
131
132 int pkgmgr_parser_update_preload_info_in_db();
133 int pkgmgr_parser_check_and_create_db();
134 int pkgmgr_parser_initialize_db();
135 int pkgmgr_parser_delete_pkgid_info_from_db(const char *pkgid);
136 int pkgmgr_parser_delete_appid_info_from_db(const char *appid);
137
138 int pkgmgr_parser_update_enabled_pkg_info_in_db(const char *pkgid);
139 int pkgmgr_parser_update_disabled_pkg_info_in_db(const char *pkgid);
140 int pkgmgr_parser_insert_app_aliasid_info_in_db(void);
141 int pkgmgr_parser_update_app_aliasid_info_in_db(void);
142
143 /** @} */
144 #ifdef __cplusplus
145 }
146 #endif
147 #endif                          /* __PKGMGR_PARSER_DB_H__ */
148 /**
149  * @}
150  * @}
151  */