Pkgname (tizen id) - not null
[framework/web/wrt-commons.git] / modules / widget_dao / dao / widget_dao.cpp
index 56076b1..9327806 100644 (file)
@@ -53,6 +53,7 @@ namespace WrtDB {
 
 WidgetDAO::WidgetDAO(DPL::OptionalString widgetGUID) :
     WidgetDAOReadOnly(WidgetDAOReadOnly::getHandle(widgetGUID))
+// TODO THIS WILL BE DELETED
 {
 }
 
@@ -119,6 +120,29 @@ void WidgetDAO::setPkgName(const DPL::OptionalString& pkgName)
     SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to register widget")
 }
 
+void WidgetDAO::setPkgName_NOTNULL(const DPL::String& pkgName)
+{
+    SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+    {
+        using namespace DPL::DB::ORM;
+        wrt::ScopedTransaction transaction(&WrtDatabase::interface());
+
+        isWidgetInstalled(getHandle());
+
+        wrt::WidgetInfo::Row row;
+        row.Set_pkgname(pkgName);
+
+        WRT_DB_UPDATE(update, wrt::WidgetInfo, &WrtDatabase::interface())
+        update->Where(
+            Equals<wrt::WidgetInfo::app_id>(getHandle()));
+
+        update->Values(row);
+        update->Execute();
+        transaction.Commit();
+    }
+    SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to register widget")
+}
+
 void WidgetDAO::setSecurityPopupUsage(const SettingsType value)
 {
     SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
@@ -392,7 +416,7 @@ void WidgetDAO::registerWidgetExtendedInfo(DbWidgetHandle widgetHandle,
     row.Set_install_time(regInfo.installedTime);
     row.Set_splash_img_src(regInfo.configInfo.splashImgSrc);
     row.Set_background_page(regInfo.configInfo.backgroundPage);
-
+    row.Set_installed_path(regInfo.widgetInstalledPath);
 
     DO_INSERT(row, WidgetExtendedInfo)
 }