For example the CAPI pkgmgrinfo_appinfo_usr_filter_foreach_appinfo with a callback that also
call a CAPI.
Refactoring Database management to allow it.
BUG-Tizen=TC-2221
Signed-off-by: Baptiste DURAND <baptiste.durand@open.eurogiciel.org>
Change-Id: If4bd6c7687d1b875f945935488d93563dae92e3c
char **subapp;
} pkgmgrinfo_appcontrol_x;
char **subapp;
} pkgmgrinfo_appcontrol_x;
+
+typedef struct _db_handle {
+ sqlite3 *dbHandle;
+ int ref;
+} db_handle;
+
+
typedef int (*sqlite_query_callback)(void *data, int ncols, char **coltxt, char **colname);
typedef int (*pkgmgr_handler)(int req_id, const char *pkg_type,
typedef int (*sqlite_query_callback)(void *data, int ncols, char **coltxt, char **colname);
typedef int (*pkgmgr_handler)(int req_id, const char *pkg_type,
#define QUERY_CREATE_VIEW_14 "CREATE temp VIEW package_privilege_info as select * "\
"from (select *,0 as for_all_users from main.package_privilege_info union select *,1 as for_all_users from Global.package_privilege_info)"
#define QUERY_CREATE_VIEW_14 "CREATE temp VIEW package_privilege_info as select * "\
"from (select *,0 as for_all_users from main.package_privilege_info union select *,1 as for_all_users from Global.package_privilege_info)"
+#define GET_DB(X) (X).dbHandle
-__thread sqlite3 *manifest_db = NULL;
-__thread sqlite3 *datacontrol_db = NULL;
-__thread sqlite3 *cert_db = NULL;
+__thread db_handle manifest_db;
+__thread db_handle datacontrol_db;
+__thread db_handle cert_db;
static int __open_manifest_db(uid_t uid);
static int __open_manifest_db(uid_t uid);
+static int __close_manifest_db(void);
static int __open_cert_db(uid_t uid);
static int __open_cert_db(uid_t uid);
+static int __close_cert_db(void);
static int __exec_pkginfo_query(char *query, void *data);
static int __exec_certinfo_query(char *query, void *data);
static int __exec_certindexinfo_query(char *query, void *data);
static int __exec_pkginfo_query(char *query, void *data);
static int __exec_certinfo_query(char *query, void *data);
static int __exec_certindexinfo_query(char *query, void *data);
+static int __close_manifest_db(void)
+{
+ int ret = -1;
+ if(manifest_db.ref) {
+ if(--manifest_db.ref == 0)
+ sqlite3_close(GET_DB(manifest_db));
+ return 0;
+ }
+ return -1;
+}
+
+
static int __open_manifest_db(uid_t uid)
{
int ret = -1;
static int __open_manifest_db(uid_t uid)
{
int ret = -1;
+ if(manifest_db.ref) {
+ manifest_db.ref ++;
+ return 0;
+ }
const char* user_pkg_parser = getUserPkgParserDBPathUID(uid);
if (access(user_pkg_parser, F_OK) == 0) {
ret =
const char* user_pkg_parser = getUserPkgParserDBPathUID(uid);
if (access(user_pkg_parser, F_OK) == 0) {
ret =
- db_util_open_with_options(user_pkg_parser, &manifest_db,
+ db_util_open_with_options(user_pkg_parser, &GET_DB(manifest_db),
SQLITE_OPEN_READONLY, NULL);
retvm_if(ret != SQLITE_OK, -1, "connect db [%s] failed!\n", user_pkg_parser);
SQLITE_OPEN_READONLY, NULL);
retvm_if(ret != SQLITE_OK, -1, "connect db [%s] failed!\n", user_pkg_parser);
- ret = _pkgmgr_parser_attach_create_view_parserdb(manifest_db,uid);
+ manifest_db.ref ++;
+ ret = _pkgmgr_parser_attach_create_view_parserdb(GET_DB(manifest_db),uid);
retvm_if(ret != SQLITE_OK, -1, "attach db [%s] failed!\n", user_pkg_parser);
retvm_if(ret != SQLITE_OK, -1, "attach db [%s] failed!\n", user_pkg_parser);
return 0;
}
_LOGE("Manifest DB does not exists !!\n");
return -1;
}
return 0;
}
_LOGE("Manifest DB does not exists !!\n");
return -1;
}
+static int __close_cert_db(void)
+{
+ int ret = -1;
+ if(cert_db.ref) {
+ if(--cert_db.ref == 0)
+ sqlite3_close(GET_DB(cert_db));
+ }
+ _LOGE("Certificate DB is already closed !!\n");
+ return -1;
+}
+
+
static int __open_cert_db(uid_t uid)
{
int ret = -1;
const char* user_cert_parser = getUserPkgCertDBPathUID(uid);
if (access(user_cert_parser, F_OK) == 0) {
ret =
static int __open_cert_db(uid_t uid)
{
int ret = -1;
const char* user_cert_parser = getUserPkgCertDBPathUID(uid);
if (access(user_cert_parser, F_OK) == 0) {
ret =
- db_util_open_with_options(user_cert_parser, &cert_db,
+ db_util_open_with_options(user_cert_parser, &GET_DB(cert_db),
SQLITE_OPEN_READWRITE, NULL);
retvm_if(ret != SQLITE_OK, -1, "connect db [%s] failed!\n", user_cert_parser);
SQLITE_OPEN_READWRITE, NULL);
retvm_if(ret != SQLITE_OK, -1, "connect db [%s] failed!\n", user_cert_parser);
- ret = _pkgmgr_parser_attach_create_view_certdb(cert_db,uid);
+ ret = _pkgmgr_parser_attach_create_view_certdb(GET_DB(cert_db),uid);
retvm_if(ret != SQLITE_OK, -1, "attach db [%s] failed!\n", user_cert_parser);
return 0;
retvm_if(ret != SQLITE_OK, -1, "attach db [%s] failed!\n", user_cert_parser);
return 0;
+static int __close_datacontrol_db(void)
+{
+ int ret = -1;
+ if(datacontrol_db.ref) {
+ if(--datacontrol_db.ref == 0)
+ sqlite3_close(GET_DB(datacontrol_db));
+ }
+ _LOGE("Certificate DB is already closed !!\n");
+ return -1;
+}
+
static int __open_datacontrol_db()
{
int ret = -1;
if (access(DATACONTROL_DB, F_OK) == 0) {
ret =
static int __open_datacontrol_db()
{
int ret = -1;
if (access(DATACONTROL_DB, F_OK) == 0) {
ret =
- db_util_open_with_options(DATACONTROL_DB, &datacontrol_db,
+ db_util_open_with_options(DATACONTROL_DB, &GET_DB(datacontrol_db),
SQLITE_OPEN_READONLY, NULL);
retvm_if(ret != SQLITE_OK, -1, "connect db [%s] failed!\n", DATACONTROL_DB);
return 0;
SQLITE_OPEN_READONLY, NULL);
retvm_if(ret != SQLITE_OK, -1, "connect db [%s] failed!\n", DATACONTROL_DB);
return 0;
{
char *error_message = NULL;
if (SQLITE_OK !=
{
char *error_message = NULL;
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __pkginfo_cb, data, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __pkginfo_cb, data, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
{
char *error_message = NULL;
if (SQLITE_OK !=
{
char *error_message = NULL;
if (SQLITE_OK !=
- sqlite3_exec(cert_db, query, __certinfo_cb, data, &error_message)) {
+ sqlite3_exec(GET_DB(cert_db), query, __certinfo_cb, data, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
{
char *error_message = NULL;
if (SQLITE_OK !=
{
char *error_message = NULL;
if (SQLITE_OK !=
- sqlite3_exec(cert_db, query, __certindexinfo_cb, data, &error_message)) {
+ sqlite3_exec(GET_DB(cert_db), query, __certindexinfo_cb, data, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
static int __exec_db_query(sqlite3 *db, char *query, sqlite_query_callback callback, void *data)
{
char *error_message = NULL;
static int __exec_db_query(sqlite3 *db, char *query, sqlite_query_callback callback, void *data)
{
char *error_message = NULL;
- if (SQLITE_OK !=
- sqlite3_exec(db, query, callback, data, &error_message)) {
- _LOGE("Don't execute query = %s error message = %s\n", query,
- error_message);
+ int ret = sqlite3_exec(db, query, callback, data, &error_message);
+ if (SQLITE_OK != ret) {
+ _LOGE("Don't execute query = %s error message = %s ret = %d\n", query,
+ error_message, ret);
sqlite3_free(error_message);
return -1;
}
sqlite3_free(error_message);
return -1;
}
snprintf(query, MAX_QUERY_LEN, "delete from package_cert_index_info where cert_id=%d ", (certinfo->cert_id)[i]);
}
if (SQLITE_OK !=
snprintf(query, MAX_QUERY_LEN, "delete from package_cert_index_info where cert_id=%d ", (certinfo->cert_id)[i]);
}
if (SQLITE_OK !=
- sqlite3_exec(cert_db, query, NULL, NULL, &error_message)) {
+ sqlite3_exec(GET_DB(cert_db), query, NULL, NULL, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
/*Now delete the entry from db*/
snprintf(query, MAX_QUERY_LEN, "delete from package_cert_info where package='%s'", pkgid);
if (SQLITE_OK !=
/*Now delete the entry from db*/
snprintf(query, MAX_QUERY_LEN, "delete from package_cert_info where package='%s'", pkgid);
if (SQLITE_OK !=
- sqlite3_exec(cert_db, query, NULL, NULL, &error_message)) {
+ sqlite3_exec(GET_DB(cert_db), query, NULL, NULL, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
retvm_if(pkg_list_cb == NULL, PMINFO_R_EINVAL, "callback function is NULL\n");
char *error_message = NULL;
int ret = PMINFO_R_OK;
retvm_if(pkg_list_cb == NULL, PMINFO_R_EINVAL, "callback function is NULL\n");
char *error_message = NULL;
int ret = PMINFO_R_OK;
char query[MAX_QUERY_LEN] = {'\0'};
char *syslocale = NULL;
char *locale = NULL;
char query[MAX_QUERY_LEN] = {'\0'};
char *syslocale = NULL;
char *locale = NULL;
- ret = __open_manifest_db(uid);
- if (ret == -1) {
+ ret_db = __open_manifest_db(uid);
+ if (ret_db == -1) {
_LOGE("Fail to open manifest DB\n");
free(syslocale);
free(locale);
_LOGE("Fail to open manifest DB\n");
free(syslocale);
free(locale);
snprintf(query, MAX_QUERY_LEN, "select * from package_info");
if (SQLITE_OK !=
snprintf(query, MAX_QUERY_LEN, "select * from package_info");
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __pkg_list_cb, (void *)tmphead, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __pkg_list_cb, (void *)tmphead, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
- sqlite3_close(manifest_db);
ret = PMINFO_R_ERROR;
goto err;
}
ret = PMINFO_R_ERROR;
goto err;
}
- sqlite3_close(manifest_db);
if (syslocale) {
free(syslocale);
syslocale = NULL;
if (syslocale) {
free(syslocale);
syslocale = NULL;
/*check pkgid exist on db*/
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_info where package='%s')", pkgid);
/*check pkgid exist on db*/
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_info where package='%s')", pkgid);
- ret = __exec_db_query(manifest_db, query, __validate_cb, (void *)&exist);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __validate_cb, (void *)&exist);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec[%s] fail", pkgid);
tryvm_if(exist == 0, ret = PMINFO_R_ERROR, "pkgid[%s] not found in DB", pkgid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec[%s] fail", pkgid);
tryvm_if(exist == 0, ret = PMINFO_R_ERROR, "pkgid[%s] not found in DB", pkgid);
/*populate manifest_info from DB*/
snprintf(query, MAX_QUERY_LEN, "select * from package_info where package='%s' ", pkgid);
/*populate manifest_info from DB*/
snprintf(query, MAX_QUERY_LEN, "select * from package_info where package='%s' ", pkgid);
- ret = __exec_db_query(manifest_db, query, __pkginfo_cb, (void *)pkginfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __pkginfo_cb, (void *)pkginfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
/*populate privilege_info from DB*/
snprintf(query, MAX_QUERY_LEN, "select * from package_privilege_info where package='%s' ", pkgid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
/*populate privilege_info from DB*/
snprintf(query, MAX_QUERY_LEN, "select * from package_privilege_info where package='%s' ", pkgid);
- ret = __exec_db_query(manifest_db, query, __pkginfo_cb, (void *)pkginfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __pkginfo_cb, (void *)pkginfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Privilege Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where" \
" package='%s' and package_locale='%s'", pkgid, locale);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Privilege Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where" \
" package='%s' and package_locale='%s'", pkgid, locale);
- ret = __exec_db_query(manifest_db, query, __pkginfo_cb, (void *)pkginfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __pkginfo_cb, (void *)pkginfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
/*Also store the values corresponding to default locales*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where" \
" package='%s' and package_locale='%s'", pkgid, DEFAULT_LOCALE);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
/*Also store the values corresponding to default locales*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where" \
" package='%s' and package_locale='%s'", pkgid, DEFAULT_LOCALE);
- ret = __exec_db_query(manifest_db, query, __pkginfo_cb, (void *)pkginfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __pkginfo_cb, (void *)pkginfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
if (pkginfo->manifest_info->label) {
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
if (pkginfo->manifest_info->label) {
*handle = NULL;
__cleanup_pkginfo(pkginfo);
}
*handle = NULL;
__cleanup_pkginfo(pkginfo);
}
- sqlite3_close(manifest_db);
-
if (syslocale) {
free(syslocale);
syslocale = NULL;
if (syslocale) {
free(syslocale);
syslocale = NULL;
ret = PMINFO_R_ERROR;
goto err;
}
ret = PMINFO_R_ERROR;
goto err;
}
- _check_create_Cert_db(cert_db);
+ _check_create_Cert_db(GET_DB(cert_db));
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_cert_info where package='%s')", lhs_package_id);
if (SQLITE_OK !=
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_cert_info where package='%s')", lhs_package_id);
if (SQLITE_OK !=
- sqlite3_exec(cert_db, query, __validate_cb, (void *)&exist, &error_message)) {
+ sqlite3_exec(GET_DB(cert_db), query, __validate_cb, (void *)&exist, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
} else {
snprintf(query, MAX_QUERY_LEN, "select author_signer_cert from package_cert_info where package='%s'", lhs_package_id);
if (SQLITE_OK !=
} else {
snprintf(query, MAX_QUERY_LEN, "select author_signer_cert from package_cert_info where package='%s'", lhs_package_id);
if (SQLITE_OK !=
- sqlite3_exec(cert_db, query, __cert_cb, (void *)info, &error_message)) {
+ sqlite3_exec(GET_DB(cert_db), query, __cert_cb, (void *)info, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_cert_info where package='%s')", rhs_package_id);
if (SQLITE_OK !=
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_cert_info where package='%s')", rhs_package_id);
if (SQLITE_OK !=
- sqlite3_exec(cert_db, query, __validate_cb, (void *)&exist, &error_message)) {
+ sqlite3_exec(GET_DB(cert_db), query, __validate_cb, (void *)&exist, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
} else {
snprintf(query, MAX_QUERY_LEN, "select author_signer_cert from package_cert_info where package='%s'", rhs_package_id);
if (SQLITE_OK !=
} else {
snprintf(query, MAX_QUERY_LEN, "select author_signer_cert from package_cert_info where package='%s'", rhs_package_id);
if (SQLITE_OK !=
- sqlite3_exec(cert_db, query, __cert_cb, (void *)info, &error_message)) {
+ sqlite3_exec(GET_DB(cert_db), query, __cert_cb, (void *)info, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
err:
sqlite3_free(error_message);
err:
sqlite3_free(error_message);
- sqlite3_close(cert_db);
if (info) {
if (info->pkgid) {
free(info->pkgid);
if (info) {
if (info->pkgid) {
free(info->pkgid);
info = (pkgmgr_cert_x *)calloc(1, sizeof(pkgmgr_cert_x));
retvm_if(info == NULL, PMINFO_R_ERROR, "Out of Memory!!!");
info = (pkgmgr_cert_x *)calloc(1, sizeof(pkgmgr_cert_x));
retvm_if(info == NULL, PMINFO_R_ERROR, "Out of Memory!!!");
- ret = db_util_open_with_options(user_pkg_parser, &manifest_db,
+ ret = db_util_open_with_options(user_pkg_parser, &GET_DB(manifest_db),
SQLITE_OPEN_READONLY, NULL);
if (ret != SQLITE_OK) {
_LOGE("connect db [%s] failed!\n", user_pkg_parser);
SQLITE_OPEN_READONLY, NULL);
if (ret != SQLITE_OK) {
_LOGE("connect db [%s] failed!\n", user_pkg_parser);
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_app_info where app_id='%s')", lhs_app_id);
if (SQLITE_OK !=
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_app_info where app_id='%s')", lhs_app_id);
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __validate_cb, (void *)&exist, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __validate_cb, (void *)&exist, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
} else {
snprintf(query, MAX_QUERY_LEN, "select package from package_app_info where app_id='%s' ", lhs_app_id);
if (SQLITE_OK !=
} else {
snprintf(query, MAX_QUERY_LEN, "select package from package_app_info where app_id='%s' ", lhs_app_id);
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __cert_cb, (void *)info, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __cert_cb, (void *)info, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_app_info where app_id='%s')", rhs_app_id);
if (SQLITE_OK !=
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_app_info where app_id='%s')", rhs_app_id);
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __validate_cb, (void *)&exist, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __validate_cb, (void *)&exist, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
} else {
snprintf(query, MAX_QUERY_LEN, "select package from package_app_info where app_id='%s' ", rhs_app_id);
if (SQLITE_OK !=
} else {
snprintf(query, MAX_QUERY_LEN, "select package from package_app_info where app_id='%s' ", rhs_app_id);
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __cert_cb, (void *)info, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __cert_cb, (void *)info, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
ret = pkgmgrinfo_pkginfo_compare_pkg_cert_info(lpkgid, rpkgid, compare_result);
err:
sqlite3_free(error_message);
ret = pkgmgrinfo_pkginfo_compare_pkg_cert_info(lpkgid, rpkgid, compare_result);
err:
sqlite3_free(error_message);
- sqlite3_close(manifest_db);
if (info) {
if (info->pkgid) {
free(info->pkgid);
if (info) {
if (info->pkgid) {
free(info->pkgid);
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_app_info where app_id='%s')", lhs_app_id);
if (SQLITE_OK !=
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_app_info where app_id='%s')", lhs_app_id);
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __validate_cb, (void *)&exist, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __validate_cb, (void *)&exist, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
} else {
snprintf(query, MAX_QUERY_LEN, "select package from package_app_info where app_id='%s' ", lhs_app_id);
if (SQLITE_OK !=
} else {
snprintf(query, MAX_QUERY_LEN, "select package from package_app_info where app_id='%s' ", lhs_app_id);
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __cert_cb, (void *)info, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __cert_cb, (void *)info, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_app_info where app_id='%s')", rhs_app_id);
if (SQLITE_OK !=
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_app_info where app_id='%s')", rhs_app_id);
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __validate_cb, (void *)&exist, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __validate_cb, (void *)&exist, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
} else {
snprintf(query, MAX_QUERY_LEN, "select package from package_app_info where app_id='%s' ", rhs_app_id);
if (SQLITE_OK !=
} else {
snprintf(query, MAX_QUERY_LEN, "select package from package_app_info where app_id='%s' ", rhs_app_id);
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __cert_cb, (void *)info, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __cert_cb, (void *)info, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
ret = PMINFO_R_ERROR;
ret = pkgmgrinfo_pkginfo_compare_usr_pkg_cert_info(lpkgid, rpkgid, uid, compare_result);
err:
sqlite3_free(error_message);
ret = pkgmgrinfo_pkginfo_compare_usr_pkg_cert_info(lpkgid, rpkgid, uid, compare_result);
err:
sqlite3_free(error_message);
- sqlite3_close(manifest_db);
if (info) {
if (info->pkgid) {
free(info->pkgid);
if (info) {
if (info->pkgid) {
free(info->pkgid);
/*Execute Query*/
if (SQLITE_OK !=
/*Execute Query*/
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __count_cb, (void *)count, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __count_cb, (void *)count, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
- sqlite3_close(manifest_db);
ret = PMINFO_R_ERROR;
*count = 0;
goto err;
ret = PMINFO_R_ERROR;
*count = 0;
goto err;
free(syslocale);
syslocale = NULL;
}
free(syslocale);
syslocale = NULL;
}
- sqlite3_close(manifest_db);
tmphead->uid = uid;
if (SQLITE_OK !=
tmphead->uid = uid;
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __pkg_list_cb, (void *)tmphead, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __pkg_list_cb, (void *)tmphead, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
free(syslocale);
syslocale = NULL;
}
free(syslocale);
syslocale = NULL;
}
- sqlite3_close(manifest_db);
__cleanup_pkginfo(tmphead);
return ret;
}
__cleanup_pkginfo(tmphead);
return ret;
}
switch(component) {
case PMINFO_UI_APP:
/*Populate ui app info */
switch(component) {
case PMINFO_UI_APP:
/*Populate ui app info */
- ret = __exec_db_query(manifest_db, query, __uiapp_list_cb, (void *)info);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __uiapp_list_cb, (void *)info);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
uiapplication_x *tmp = NULL;
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
uiapplication_x *tmp = NULL;
if (locale) {
free(locale);
}
if (locale) {
free(locale);
}
- locale = __get_app_locale_by_fallback(manifest_db, appinfo->uiapp_info->appid, syslocale);
+ locale = __get_app_locale_by_fallback(GET_DB(manifest_db), appinfo->uiapp_info->appid, syslocale);
}
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
}
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
/*store setting notification icon section*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", appinfo->uiapp_info->appid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
/*store setting notification icon section*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", appinfo->uiapp_info->appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
/*store app preview image info*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", appinfo->uiapp_info->appid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
/*store app preview image info*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", appinfo->uiapp_info->appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
if (appinfo->uiapp_info->label) {
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
if (appinfo->uiapp_info->label) {
break;
case PMINFO_SVC_APP:
/*Populate svc app info */
break;
case PMINFO_SVC_APP:
/*Populate svc app info */
- ret = __exec_db_query(manifest_db, query, __svcapp_list_cb, (void *)info);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __svcapp_list_cb, (void *)info);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
serviceapplication_x *tmp1 = NULL;
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
serviceapplication_x *tmp1 = NULL;
appinfo->svcapp_info = tmp1;
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, locale);
appinfo->svcapp_info = tmp1;
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, locale);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, DEFAULT_LOCALE);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, DEFAULT_LOCALE);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
if (appinfo->svcapp_info->label) {
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
if (appinfo->svcapp_info->label) {
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where package='%s'", info->manifest_info->package);
/*Populate all app info */
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where package='%s'", info->manifest_info->package);
/*Populate all app info */
- ret = __exec_db_query(manifest_db, query, __allapp_list_cb, (void *)allinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __allapp_list_cb, (void *)allinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
/*UI Apps*/
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
/*UI Apps*/
appinfo->uiapp_info = tmp2;
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
appinfo->uiapp_info = tmp2;
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
/*store setting notification icon section*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", appinfo->uiapp_info->appid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
/*store setting notification icon section*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", appinfo->uiapp_info->appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
/*store app preview image info*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", appinfo->uiapp_info->appid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
/*store app preview image info*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", appinfo->uiapp_info->appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
if (appinfo->uiapp_info->label) {
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
if (appinfo->uiapp_info->label) {
appinfo->svcapp_info = tmp3;
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, locale);
appinfo->svcapp_info = tmp3;
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, locale);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, DEFAULT_LOCALE);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, DEFAULT_LOCALE);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
if (appinfo->svcapp_info->label) {
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
if (appinfo->svcapp_info->label) {
}
__cleanup_pkginfo(allinfo);
}
__cleanup_pkginfo(allinfo);
- sqlite3_close(manifest_db);
tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info");
tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info");
- ret = __exec_db_query(manifest_db, query, __mini_appinfo_cb, (void *)info);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __mini_appinfo_cb, (void *)info);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
if (info->manifest_info->uiapplication) {
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
if (info->manifest_info->uiapplication) {
ret = PMINFO_R_OK;
catch:
ret = PMINFO_R_OK;
catch:
- sqlite3_close(manifest_db);
-
if (appinfo) {
free(appinfo);
appinfo = NULL;
if (appinfo) {
free(appinfo);
appinfo = NULL;
tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info");
tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info");
- ret = __exec_db_query(manifest_db, query, __app_list_cb, (void *)info);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __app_list_cb, (void *)info);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
if (info->manifest_info->uiapplication) {
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
if (info->manifest_info->uiapplication) {
snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
"from package_app_info where " \
"app_id='%s'", ptr1->appid);
snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
"from package_app_info where " \
"app_id='%s'", ptr1->appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
if (locale) {
free(locale);
}
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
if (locale) {
free(locale);
}
- locale = __get_app_locale_by_fallback(manifest_db, ptr1->appid, syslocale);
+ locale = __get_app_locale_by_fallback(GET_DB(manifest_db), ptr1->appid, syslocale);
}
memset(query, '\0', MAX_QUERY_LEN);
}
memset(query, '\0', MAX_QUERY_LEN);
"from package_app_localized_info where " \
"app_id='%s' and app_locale='%s'",
ptr1->appid, locale);
"from package_app_localized_info where " \
"app_id='%s' and app_locale='%s'",
ptr1->appid, locale);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
"app_id='%s' and app_locale='%s'",
ptr1->appid, DEFAULT_LOCALE);
"app_id='%s' and app_locale='%s'",
ptr1->appid, DEFAULT_LOCALE);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
/*store setting notification icon section*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", ptr1->appid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
/*store setting notification icon section*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", ptr1->appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
/*store app preview image info*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", ptr1->appid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
/*store app preview image info*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", ptr1->appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
if (appinfo->uiapp_info->label) {
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
if (appinfo->uiapp_info->label) {
snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
"from package_app_info where " \
"app_id='%s'", ptr2->appid);
snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
"from package_app_info where " \
"app_id='%s'", ptr2->appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
"from package_app_localized_info where " \
"app_id='%s' and app_locale='%s'",
ptr2->appid, locale);
"from package_app_localized_info where " \
"app_id='%s' and app_locale='%s'",
ptr2->appid, locale);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
"from package_app_localized_info where " \
"app_id='%s' and app_locale='%s'",
ptr2->appid, DEFAULT_LOCALE);
"from package_app_localized_info where " \
"app_id='%s' and app_locale='%s'",
ptr2->appid, DEFAULT_LOCALE);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
if (appinfo->svcapp_info->label) {
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
if (appinfo->svcapp_info->label) {
free(syslocale);
syslocale = NULL;
}
free(syslocale);
syslocale = NULL;
}
- sqlite3_close(manifest_db);
if (appinfo) {
free(appinfo);
appinfo = NULL;
if (appinfo) {
free(appinfo);
appinfo = NULL;
/*check appid exist on db*/
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_app_info where app_id='%s')", appid);
/*check appid exist on db*/
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_app_info where app_id='%s')", appid);
- ret = __exec_db_query(manifest_db, query, __validate_cb, (void *)&exist);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __validate_cb, (void *)&exist);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec fail");
tryvm_if(exist == 0, ret = PMINFO_R_ERROR, "Appid[%s] not found in DB", appid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec fail");
tryvm_if(exist == 0, ret = PMINFO_R_ERROR, "Appid[%s] not found in DB", appid);
/*check app_component from DB*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select app_component, package from package_app_info where app_id='%s' ", appid);
/*check app_component from DB*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select app_component, package from package_app_info where app_id='%s' ", appid);
- ret = __exec_db_query(manifest_db, query, __appcomponent_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appcomponent_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
/*calloc app_component*/
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
/*calloc app_component*/
/*populate app_info from DB*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' ", appid);
/*populate app_info from DB*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' ", appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appid, locale);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appid, locale);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
/*Also store the values corresponding to default locales*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appid, DEFAULT_LOCALE);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
/*Also store the values corresponding to default locales*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appid, DEFAULT_LOCALE);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
/*Populate app category*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_category where app_id='%s'", appid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
/*Populate app category*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_category where app_id='%s'", appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
/*Populate app metadata*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_metadata where app_id='%s'", appid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
/*Populate app metadata*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_metadata where app_id='%s'", appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
/*Populate app permission*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_permission where app_id='%s'", appid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
/*Populate app permission*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_permission where app_id='%s'", appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App permission Info DB Information retrieval failed");
/*store setting notification icon section*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", appid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App permission Info DB Information retrieval failed");
/*store setting notification icon section*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
/*store app preview image info*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", appid);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
/*store app preview image info*/
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", appid);
- ret = __exec_db_query(manifest_db, query, __appinfo_cb, (void *)appinfo);
+ ret = __exec_db_query(GET_DB(manifest_db), query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
switch (appinfo->app_component) {
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
switch (appinfo->app_component) {
__cleanup_appinfo(appinfo);
}
__cleanup_appinfo(appinfo);
}
- sqlite3_close(manifest_db);
if (syslocale) {
free(syslocale);
syslocale = NULL;
if (syslocale) {
free(syslocale);
syslocale = NULL;
/*Execute Query*/
if (SQLITE_OK !=
/*Execute Query*/
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __count_cb, (void *)count, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __count_cb, (void *)count, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
- sqlite3_close(manifest_db);
ret = PMINFO_R_ERROR;
*count = 0;
goto err;
ret = PMINFO_R_ERROR;
*count = 0;
goto err;
free(syslocale);
syslocale = NULL;
}
free(syslocale);
syslocale = NULL;
}
- sqlite3_close(manifest_db);
goto err;
}
if (SQLITE_OK !=
goto err;
}
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __app_list_cb, (void *)info, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __app_list_cb, (void *)info, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
- sqlite3_close(manifest_db);
ret = PMINFO_R_ERROR;
goto err;
}
ret = PMINFO_R_ERROR;
goto err;
}
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
ptr1->appid, "uiapp");
if (SQLITE_OK !=
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
ptr1->appid, "uiapp");
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __uiapp_list_cb, (void *)filtinfo, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __uiapp_list_cb, (void *)filtinfo, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
- sqlite3_close(manifest_db);
ret = PMINFO_R_ERROR;
goto err;
}
ret = PMINFO_R_ERROR;
goto err;
}
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
ptr2->appid, "svcapp");
if (SQLITE_OK !=
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
ptr2->appid, "svcapp");
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __svcapp_list_cb, (void *)filtinfo, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, __svcapp_list_cb, (void *)filtinfo, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
- sqlite3_close(manifest_db);
ret = PMINFO_R_ERROR;
goto err;
}
ret = PMINFO_R_ERROR;
goto err;
}
free(syslocale);
syslocale = NULL;
}
free(syslocale);
syslocale = NULL;
}
- sqlite3_close(manifest_db);
if (appinfo) {
free(appinfo);
appinfo = NULL;
if (appinfo) {
free(appinfo);
appinfo = NULL;
appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
- ret = sqlite3_exec(manifest_db, query, __app_list_cb, (void *)info, &error_message);
+ ret = sqlite3_exec(GET_DB(manifest_db), query, __app_list_cb, (void *)info, &error_message);
tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s error message = %s\n", query, error_message);
memset(query, '\0', MAX_QUERY_LEN);
tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s error message = %s\n", query, error_message);
memset(query, '\0', MAX_QUERY_LEN);
{
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
ptr1->appid, "uiapp");
{
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
ptr1->appid, "uiapp");
- ret = sqlite3_exec(manifest_db, query, __uiapp_list_cb, (void *)filtinfo, &error_message);
+ ret = sqlite3_exec(GET_DB(manifest_db), query, __uiapp_list_cb, (void *)filtinfo, &error_message);
tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s error message = %s\n", query, error_message);
memset(query, '\0', MAX_QUERY_LEN);
}
tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s error message = %s\n", query, error_message);
memset(query, '\0', MAX_QUERY_LEN);
}
{
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
ptr2->appid, "svcapp");
{
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
ptr2->appid, "svcapp");
- ret = sqlite3_exec(manifest_db, query, __svcapp_list_cb, (void *)filtinfo, &error_message);
+ ret = sqlite3_exec(GET_DB(manifest_db), query, __svcapp_list_cb, (void *)filtinfo, &error_message);
tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s error message = %s\n", query, error_message);
memset(query, '\0', MAX_QUERY_LEN);
}
tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s error message = %s\n", query, error_message);
memset(query, '\0', MAX_QUERY_LEN);
}
syslocale = NULL;
}
sqlite3_free(error_message);
syslocale = NULL;
}
sqlite3_free(error_message);
- sqlite3_close(manifest_db);
if (appinfo) {
free(appinfo);
appinfo = NULL;
if (appinfo) {
free(appinfo);
appinfo = NULL;
/*Open db.*/
user_pkg_cert = getUserPkgCertDBPath();
/*Open db.*/
user_pkg_cert = getUserPkgCertDBPath();
- ret = db_util_open_with_options(user_pkg_cert, &cert_db,
+ ret = db_util_open_with_options(user_pkg_cert, &GET_DB(cert_db),
SQLITE_OPEN_READWRITE, NULL);
if (ret != SQLITE_OK) {
_LOGE("connect db [%s] failed!\n", user_pkg_cert);
return PMINFO_R_ERROR;
}
SQLITE_OPEN_READWRITE, NULL);
if (ret != SQLITE_OK) {
_LOGE("connect db [%s] failed!\n", user_pkg_cert);
return PMINFO_R_ERROR;
}
- _check_create_Cert_db(cert_db);
+ _check_create_Cert_db(GET_DB(cert_db));
/*validate pkgid*/
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_cert_info where package='%s')", pkgid);
if (SQLITE_OK !=
/*validate pkgid*/
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_cert_info where package='%s')", pkgid);
if (SQLITE_OK !=
- sqlite3_exec(cert_db, query, __validate_cb, (void *)&exist, &error_message)) {
+ sqlite3_exec(GET_DB(cert_db), query, __validate_cb, (void *)&exist, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
- sqlite3_close(cert_db);
info->pkgid = strdup(pkgid);
/*Open db.*/
info->pkgid = strdup(pkgid);
/*Open db.*/
- ret = db_util_open_with_options(getUserPkgCertDBPath(), &cert_db,
+ ret = db_util_open_with_options(getUserPkgCertDBPath(), &GET_DB(cert_db),
SQLITE_OPEN_READWRITE, NULL);
if (ret != SQLITE_OK) {
_LOGE("connect db [%s] failed!\n", getUserPkgCertDBPath());
ret = PMINFO_R_ERROR;
goto err;
}
SQLITE_OPEN_READWRITE, NULL);
if (ret != SQLITE_OK) {
_LOGE("connect db [%s] failed!\n", getUserPkgCertDBPath());
ret = PMINFO_R_ERROR;
goto err;
}
- _check_create_Cert_db(cert_db);
+ _check_create_Cert_db(GET_DB(cert_db));
- ret = sqlite3_exec(cert_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ ret = sqlite3_exec(GET_DB(cert_db), "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("Failed to begin transaction\n");
ret = PMINFO_R_ERROR;
if (ret != SQLITE_OK) {
_LOGE("Failed to begin transaction\n");
ret = PMINFO_R_ERROR;
/*Check if request is to insert/update*/
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_cert_info where package='%s')", pkgid);
if (SQLITE_OK !=
/*Check if request is to insert/update*/
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_cert_info where package='%s')", pkgid);
if (SQLITE_OK !=
- sqlite3_exec(cert_db, query, __validate_cb, (void *)&exist, &error_message)) {
+ sqlite3_exec(GET_DB(cert_db), query, __validate_cb, (void *)&exist, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select MAX(cert_id) from package_cert_index_info ");
if (SQLITE_OK !=
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select MAX(cert_id) from package_cert_index_info ");
if (SQLITE_OK !=
- sqlite3_exec(cert_db, query, __maxid_cb, (void *)&newid, &error_message)) {
+ sqlite3_exec(GET_DB(cert_db), query, __maxid_cb, (void *)&newid, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
(info->cert_id)[PMINFO_SET_DISTRIBUTOR2_ROOT_CERT],(info->cert_id)[PMINFO_SET_DISTRIBUTOR2_INTERMEDIATE_CERT],
(info->cert_id)[PMINFO_SET_DISTRIBUTOR2_SIGNER_CERT]);
if (SQLITE_OK !=
(info->cert_id)[PMINFO_SET_DISTRIBUTOR2_ROOT_CERT],(info->cert_id)[PMINFO_SET_DISTRIBUTOR2_INTERMEDIATE_CERT],
(info->cert_id)[PMINFO_SET_DISTRIBUTOR2_SIGNER_CERT]);
if (SQLITE_OK !=
- sqlite3_exec(cert_db, vquery, NULL, NULL, &error_message)) {
+ sqlite3_exec(GET_DB(cert_db), vquery, NULL, NULL, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", vquery,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", vquery,
error_message);
sqlite3_free(error_message);
"where cert_id=%d", (info->ref_count)[i] + 1, (info->cert_id)[i]);
}
if (SQLITE_OK !=
"where cert_id=%d", (info->ref_count)[i] + 1, (info->cert_id)[i]);
}
if (SQLITE_OK !=
- sqlite3_exec(cert_db, vquery, NULL, NULL, &error_message)) {
+ sqlite3_exec(GET_DB(cert_db), vquery, NULL, NULL, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", vquery,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", vquery,
error_message);
sqlite3_free(error_message);
}
}
/*Commit transaction*/
}
}
/*Commit transaction*/
- ret = sqlite3_exec(cert_db, "COMMIT", NULL, NULL, NULL);
+ ret = sqlite3_exec(GET_DB(cert_db), "COMMIT", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("Failed to commit transaction, Rollback now\n");
if (ret != SQLITE_OK) {
_LOGE("Failed to commit transaction, Rollback now\n");
- sqlite3_exec(cert_db, "ROLLBACK", NULL, NULL, NULL);
+ sqlite3_exec(GET_DB(cert_db), "ROLLBACK", NULL, NULL, NULL);
ret = PMINFO_R_ERROR;
goto err;
}
_LOGE("Transaction Commit and End\n");
ret = PMINFO_R_OK;
err:
ret = PMINFO_R_ERROR;
goto err;
}
_LOGE("Transaction Commit and End\n");
ret = PMINFO_R_OK;
err:
- sqlite3_close(cert_db);
if (vquery) {
free(vquery);
vquery = NULL;
if (vquery) {
free(vquery);
vquery = NULL;
ret = PMINFO_R_ERROR;
goto err;
}
ret = PMINFO_R_ERROR;
goto err;
}
- _check_create_Cert_db(cert_db);
+ _check_create_Cert_db(GET_DB(cert_db));
- ret = sqlite3_exec(cert_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ ret = sqlite3_exec(GET_DB(cert_db), "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("Failed to begin transaction\n");
ret = PMINFO_R_ERROR;
if (ret != SQLITE_OK) {
_LOGE("Failed to begin transaction\n");
ret = PMINFO_R_ERROR;
_LOGE("Certificate Deletion Success\n");
}
/*Commit transaction*/
_LOGE("Certificate Deletion Success\n");
}
/*Commit transaction*/
- ret = sqlite3_exec(cert_db, "COMMIT", NULL, NULL, NULL);
+ ret = sqlite3_exec(GET_DB(cert_db), "COMMIT", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("Failed to commit transaction, Rollback now\n");
if (ret != SQLITE_OK) {
_LOGE("Failed to commit transaction, Rollback now\n");
- sqlite3_exec(cert_db, "ROLLBACK", NULL, NULL, NULL);
+ sqlite3_exec(GET_DB(cert_db), "ROLLBACK", NULL, NULL, NULL);
ret = PMINFO_R_ERROR;
goto err;
}
_LOGE("Transaction Commit and End\n");
ret = PMINFO_R_OK;
err:
ret = PMINFO_R_ERROR;
goto err;
}
_LOGE("Transaction Commit and End\n");
ret = PMINFO_R_OK;
err:
- sqlite3_close(cert_db);
ret = __open_manifest_db(uid);
if (ret != SQLITE_OK) {
_LOGE("connect db [%s] failed!\n", getUserPkgParserDBPathUID(uid));
ret = __open_manifest_db(uid);
if (ret != SQLITE_OK) {
_LOGE("connect db [%s] failed!\n", getUserPkgParserDBPathUID(uid));
- sqlite3_close(manifest_db);
return PMINFO_R_ERROR;
}
/*Begin transaction*/
return PMINFO_R_ERROR;
}
/*Begin transaction*/
- ret = sqlite3_exec(manifest_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ ret = sqlite3_exec(GET_DB(manifest_db), "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("Failed to begin transaction\n");
if (ret != SQLITE_OK) {
_LOGE("Failed to begin transaction\n");
- sqlite3_close(manifest_db);
return PMINFO_R_ERROR;
}
_LOGD("Transaction Begin\n");
return PMINFO_R_ERROR;
}
_LOGD("Transaction Begin\n");
char *error_message = NULL;
if (SQLITE_OK !=
char *error_message = NULL;
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, NULL, NULL, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, NULL, NULL, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
sqlite3_free(error_message);
/*Commit transaction*/
sqlite3_free(error_message);
/*Commit transaction*/
- ret = sqlite3_exec(manifest_db, "COMMIT", NULL, NULL, NULL);
+ ret = sqlite3_exec(GET_DB(manifest_db), "COMMIT", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("Failed to commit transaction. Rollback now\n");
if (ret != SQLITE_OK) {
_LOGE("Failed to commit transaction. Rollback now\n");
- sqlite3_exec(manifest_db, "ROLLBACK", NULL, NULL, NULL);
- sqlite3_close(manifest_db);
+ sqlite3_exec(GET_DB(manifest_db), "ROLLBACK", NULL, NULL, NULL);
+ __close_manifest_db();
return PMINFO_R_ERROR;
}
_LOGD("Transaction Commit and End\n");
return PMINFO_R_ERROR;
}
_LOGD("Transaction Commit and End\n");
- sqlite3_close(manifest_db);
-
data = (pkgmgr_datacontrol_x *)calloc(1, sizeof(pkgmgr_datacontrol_x));
if (data == NULL) {
_LOGE("Failed to allocate memory for pkgmgr_datacontrol_x\n");
data = (pkgmgr_datacontrol_x *)calloc(1, sizeof(pkgmgr_datacontrol_x));
if (data == NULL) {
_LOGE("Failed to allocate memory for pkgmgr_datacontrol_x\n");
- sqlite3_close(datacontrol_db);
+ __close_datacontrol_db();
providerid, type);
if (SQLITE_OK !=
providerid, type);
if (SQLITE_OK !=
- sqlite3_exec(datacontrol_db, query, __datacontrol_cb, (void *)data, &error_message)) {
+ sqlite3_exec(GET_DB(datacontrol_db), query, __datacontrol_cb, (void *)data, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
- sqlite3_close(datacontrol_db);
+ __close_datacontrol_db();
return PMINFO_R_ERROR;
}
*appid = (char *)data->appid;
*access = (char *)data->access;
free(data);
return PMINFO_R_ERROR;
}
*appid = (char *)data->appid;
*access = (char *)data->access;
free(data);
- sqlite3_close(datacontrol_db);
+ __close_datacontrol_db();
- ret = sqlite3_exec(manifest_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ ret = sqlite3_exec(GET_DB(manifest_db), "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("Failed to begin transaction\n");
if (ret != SQLITE_OK) {
_LOGE("Failed to begin transaction\n");
- sqlite3_close(manifest_db);
return PMINFO_R_ERROR;
}
_LOGD("Transaction Begin\n");
return PMINFO_R_ERROR;
}
_LOGD("Transaction Begin\n");
"update package_app_localized_info set app_label='%s' where app_id='%s' and app_locale='No Locale'", label, appid);
if (SQLITE_OK !=
"update package_app_localized_info set app_label='%s' where app_id='%s' and app_locale='No Locale'", label, appid);
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, NULL, NULL, &error_message)) {
+ sqlite3_exec(GET_DB(manifest_db), query, NULL, NULL, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
- ret = sqlite3_exec(manifest_db, "COMMIT", NULL, NULL, NULL);
+ ret = sqlite3_exec(GET_DB(manifest_db), "COMMIT", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("Failed to commit transaction. Rollback now\n");
if (ret != SQLITE_OK) {
_LOGE("Failed to commit transaction. Rollback now\n");
- sqlite3_exec(manifest_db, "ROLLBACK", NULL, NULL, NULL);
- sqlite3_close(manifest_db);
+ sqlite3_exec(GET_DB(manifest_db), "ROLLBACK", NULL, NULL, NULL);
+ __close_manifest_db();
return PMINFO_R_ERROR;
}
_LOGD("Transaction Commit and End\n");
return PMINFO_R_ERROR;
}
_LOGD("Transaction Commit and End\n");
- sqlite3_close(manifest_db);
-