Fix getting information
authorJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 11 Mar 2021 08:23:05 +0000 (17:23 +0900)
committer연정현/Tizen Platform Lab(SR)/Staff Engineer/삼성전자 <jungh.yeon@samsung.com>
Thu, 11 Mar 2021 09:00:17 +0000 (18:00 +0900)
- Fix condition for getting information from db.

Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/appinfo_internal.c
src/common/database/appinfo_db_handler.cc
src/common/database/pkg_get_db_handler.cc
src/pkginfo_internal.c

index 1ae8044..b4c5b32 100644 (file)
@@ -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;
 }
index 9c04a72..5e88e43 100644 (file)
@@ -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_);
 
index 501fa9c..8752a20 100644 (file)
@@ -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_);
 
index 27ccc4b..0feda4f 100644 (file)
@@ -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;
 }