From a81ceee5405315dcff231a7f7bac16f098e11452 Mon Sep 17 00:00:00 2001 From: Soyoung Kim Date: Fri, 8 Feb 2013 15:17:42 +0900 Subject: [PATCH] Add function get appid from pkgid [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] Add to get appid form pkgid [SCMRequest] N/A Change-Id: Ib57dc1a24398adf9b860df7bd680679a4d6c444d --- .../widget_dao/dao/widget_dao_read_only.cpp | 27 +++++++++++++++++++ .../dpl/wrt-dao-ro/widget_dao_read_only.h | 1 + 2 files changed, 28 insertions(+) diff --git a/modules/widget_dao/dao/widget_dao_read_only.cpp b/modules/widget_dao/dao/widget_dao_read_only.cpp index df8421d..468aa20 100644 --- a/modules/widget_dao/dao/widget_dao_read_only.cpp +++ b/modules/widget_dao/dao/widget_dao_read_only.cpp @@ -134,6 +134,28 @@ TizenAppId getTizenAppIdByHandle(const DbWidgetHandle handle) } SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed in getHandle") } + +TizenAppId getTizenAppIdByPkgId(const TizenPkgId tzPkgid) +{ + LogDebug("Getting TizenAppId by pkgid : " << tzPkgid); + SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN + { + WRT_DB_SELECT(select, WidgetInfo, &WrtDatabase::interface()) + select->Where(Equals(tzPkgid)); + WidgetInfo::Select::RowList rowList = select->GetRowList(); + + if (rowList.empty()) { + ThrowMsg(WidgetDAOReadOnly::Exception::WidgetNotExist, + "Failed to get widget by handle"); + } + TizenAppId tzAppid = rowList.front().Get_tizen_appid(); + + return tzAppid; + + } + SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed in getHandle") + +} } // namespace @@ -234,6 +256,11 @@ TizenAppId WidgetDAOReadOnly::getTzAppId(const DbWidgetHandle handle) return getTizenAppIdByHandle(handle); } +TizenAppId WidgetDAOReadOnly::getTzAppId(const TizenPkgId tzPkgid) +{ + return getTizenAppIdByPkgId(tzPkgid); +} + PropertyDAOReadOnly::WidgetPropertyKeyList WidgetDAOReadOnly::getPropertyKeyList() const { diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h index 76292ad..34d191e 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h @@ -329,6 +329,7 @@ class WidgetDAOReadOnly TizenAppId getTzAppId() const; static TizenAppId getTzAppId(const WidgetGUID GUID); static TizenAppId getTzAppId(const DbWidgetHandle handle); + static TizenAppId getTzAppId(const TizenPkgId tzPkgid); /** * Returns WidgetPkgName for the specified widget -- 2.34.1