WrtDAO - getPkgnameList
authorTomasz Iwanek <t.iwanek@samsung.com>
Tue, 23 Oct 2012 14:46:02 +0000 (16:46 +0200)
committerGerrit Code Review <gerrit2@kim11>
Fri, 2 Nov 2012 04:52:46 +0000 (13:52 +0900)
[Issue#]       N/A
[Feature]      Listing of installed pkgnames
[Cause]        N/A
[Solution]     N/A
[Verification] Build & run dpl-tests-db

Change-Id: I8dd15f77e6bcbd7fce268404dfbd50694506c872

modules/widget_dao/dao/widget_dao_read_only.cpp
modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h
modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h

index 8d29294..7e5abf2 100644 (file)
@@ -368,6 +368,19 @@ DbWidgetHandleList WidgetDAOReadOnly::getHandleList()
     SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get handle list")
 }
 
+WidgetPkgNameList WidgetDAOReadOnly::getPkgnameList()
+{
+    LogDebug("Getting Pkgname List");
+    SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+    {
+        using namespace DPL::DB::ORM;
+        using namespace DPL::DB::ORM::wrt;
+        WRT_DB_SELECT(select, WidgetInfo, &WrtDatabase::interface())
+        return select->GetValueList<WidgetInfo::pkgname>();
+    }
+    SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get Pkgname list")
+}
+
 DbWidgetDAOReadOnlyList WidgetDAOReadOnly::getWidgetList()
 {
     LogDebug("Getting DbWidget List");
index d801a6a..c3891c4 100644 (file)
@@ -236,6 +236,8 @@ typedef std::multiset<DbWidgetFeature> DbWidgetFeatureSet;
  */
 typedef std::list<DbWidgetHandle> DbWidgetHandleList;
 
+typedef std::list<DPL::Optional<WidgetPkgName> > WidgetPkgNameList; //TODO: this cannot be null -> appropriate changes in db schema needed
+
 class WidgetDAOReadOnly; //forward declaration
 typedef std::shared_ptr<WidgetDAOReadOnly> WidgetDAOReadOnlyPtr;
 /**
index 1c28e52..7fdefdd 100644 (file)
@@ -553,6 +553,12 @@ class WidgetDAOReadOnly
     static DbWidgetHandleList getHandleList();
 
     /**
+     * This method returns list of pkgname of installed packages
+     * @return list of pkgname of installed packages
+     */
+    static WidgetPkgNameList getPkgnameList();
+
+    /**
      * This method returns a list of all the installed widgets.
      *
      * @return list of installed widgets.