From: Junghyun Yeon Date: Thu, 11 Mar 2021 08:23:05 +0000 (+0900) Subject: Fix getting information X-Git-Tag: submit/tizen/20210317.082331~37 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fappfw%2Fpkgmgr-info.git;a=commitdiff_plain;h=447e60bb0b4d493eedf021c8307cf4a92048ea06 Fix getting information - Fix condition for getting information from db. Signed-off-by: Junghyun Yeon --- diff --git a/src/appinfo_internal.c b/src/appinfo_internal.c index 1ae8044..b4c5b32 100644 --- a/src/appinfo_internal.c +++ b/src/appinfo_internal.c @@ -672,12 +672,5 @@ API int appinfo_internal_filter_get_list(sqlite3 *db, if (!g_hash_table_size(appinfo_list) && uid != GLOBAL_USER) ret = _appinfo_get_applications(db, GLOBAL_USER, uid, locale, filter, PMINFO_APPINFO_GET_ALL, appinfo_list); - - if (ret != PMINFO_R_OK) - return ret; - - if (!g_hash_table_size(appinfo_list)) - return PMINFO_R_ENOENT; - return ret; } diff --git a/src/common/database/appinfo_db_handler.cc b/src/common/database/appinfo_db_handler.cc index 9c04a72..5e88e43 100644 --- a/src/common/database/appinfo_db_handler.cc +++ b/src/common/database/appinfo_db_handler.cc @@ -72,6 +72,9 @@ int AppInfoDBHandler::Execute() { } } + if (g_hash_table_size(list) == 0) + ret = PMINFO_R_ENOENT; + if (ret == PMINFO_R_OK) g_hash_table_foreach_steal(list, _move_func, &handle_list_); diff --git a/src/common/database/pkg_get_db_handler.cc b/src/common/database/pkg_get_db_handler.cc index 501fa9c..8752a20 100644 --- a/src/common/database/pkg_get_db_handler.cc +++ b/src/common/database/pkg_get_db_handler.cc @@ -69,11 +69,15 @@ int PkgGetDBHandler::Execute() { for (auto& conn : conn_list) { ret = pkginfo_internal_filter_get_list(conn, filter_, uid_, GetLocale().c_str(), list); - if (ret == PMINFO_R_ERROR) + if (ret == PMINFO_R_ERROR) { _LOGE("Failed to pkginfo_internal_filter_get_list (%d)", ret); break; + } } + if (g_hash_table_size(list) == 0) + ret = PMINFO_R_ENOENT; + if (ret == PMINFO_R_OK) g_hash_table_foreach_steal(list, _move_func, &handle_list_); diff --git a/src/pkginfo_internal.c b/src/pkginfo_internal.c index 27ccc4b..0feda4f 100644 --- a/src/pkginfo_internal.c +++ b/src/pkginfo_internal.c @@ -636,12 +636,6 @@ API int pkginfo_internal_filter_get_list( ret = _pkginfo_get_packages(db, GLOBAL_USER, locale, filter, PMINFO_PKGINFO_GET_ALL, pkginfo_list); - if (ret == PMINFO_R_ERROR) - return ret; - - if (!g_hash_table_size(pkginfo_list)) - return PMINFO_R_ENOENT; - return PMINFO_R_OK; }