return tzAppId;
}
+void WidgetDAO::updateTizenAppId(
+ const TizenAppId & fromAppId,
+ const TizenAppId & toAppId)
+{
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ using namespace DPL::DB::ORM;
+ using namespace DPL::DB::ORM::wrt;
+
+ ScopedTransaction transaction(&WrtDatabase::interface());
+ if (!isWidgetInstalled(fromAppId)) {
+ ThrowMsg(WidgetDAOReadOnly::Exception::WidgetNotExist,
+ "Cannot find widget. tzAppId: " << fromAppId);
+ }
+
+ WRT_DB_SELECT(select, WidgetInfo, &WrtDatabase::interface())
+ select->Where(Equals<WidgetInfo::tizen_appid>(fromAppId));
+
+ WidgetInfo::Row row = select->GetSingleRow();
+
+ //WidgetInfo::Row row;
+ row.Set_tizen_appid(toAppId);
+
+ WRT_DB_UPDATE(update, WidgetInfo, &WrtDatabase::interface())
+ update->Where(Equals<WidgetInfo::tizen_appid>(fromAppId));
+ update->Values(row);
+ update->Execute();
+
+ transaction.Commit();
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to update appid")
+}
+
void WidgetDAO::registerWidgetInternal(
const TizenAppId & tzAppId,
const WidgetRegisterInfo &widgetRegInfo,
registerWidgetSecuritySettings(widgetHandle);
}
-void WidgetDAO::registerOrUpdateWidget(
- const TizenAppId & widgetName,
- const WidgetRegisterInfo &widgetRegInfo,
- const IWidgetSecurity &widgetSecurity)
-{
- LogDebug("Reregistering widget");
- SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
- {
- DPL::DB::ORM::wrt::ScopedTransaction transaction(
- &WrtDatabase::interface());
-
- unregisterWidgetInternal(widgetName);
- registerWidgetInternal(widgetName, widgetRegInfo, widgetSecurity);
- transaction.Commit();
- }
- SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to reregister widget")
-}
-
-void WidgetDAO::backupAndUpdateWidget(
- const TizenAppId & oldAppId,
- const TizenAppId & newAppId,
- const WidgetRegisterInfo &widgetRegInfo,
- const IWidgetSecurity &widgetSecurity)
-{
- LogDebug("Backup and Register widget");
- SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
- {
- DPL::DB::ORM::wrt::ScopedTransaction transaction(
- &WrtDatabase::interface());
-
- updateWidgetAppIdInternal(newAppId, oldAppId);
- registerWidgetInternal(newAppId, widgetRegInfo, widgetSecurity);
- transaction.Commit();
- }
- SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to reregister widget")
-}
-
-void WidgetDAO::restoreUpdateWidget(
- const TizenAppId & oldAppId,
- const TizenAppId & newAppId)
-{
- LogDebug("restore widget");
- SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
- {
- DPL::DB::ORM::wrt::ScopedTransaction transaction(
- &WrtDatabase::interface());
-
- unregisterWidgetInternal(newAppId);
- updateWidgetAppIdInternal(oldAppId, newAppId);
- transaction.Commit();
- }
- SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to reregister widget")
-}
-
#define DO_INSERT(row, table) \
{ \
WRT_DB_INSERT(insert, table, &WrtDatabase::interface()) \
SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to unregister widget")
}
-void WidgetDAO::unregisterWidget(WrtDB::DbWidgetHandle handle)
-{
- LogDebug("Unregistering widget from DB. Handle: " << handle);
- SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
- {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- ScopedTransaction transaction(&WrtDatabase::interface());
-
- // Delete from table Widget Info
- WRT_DB_DELETE(del, WidgetInfo, &WrtDatabase::interface())
- del->Where(Equals<WidgetInfo::app_id>(handle));
- del->Execute();
-
- transaction.Commit();
- }
- SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to unregister widget")
-}
-
void WidgetDAO::unregisterWidgetInternal(
const TizenAppId & tzAppId)
{
// Deleting in other tables is done via "delete cascade" in SQL
}
-void WidgetDAO::updateWidgetAppIdInternal(
- const TizenAppId & fromAppId,
- const TizenAppId & toAppId)
-{
- SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
- {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
-
- ScopedTransaction transaction(&WrtDatabase::interface());
- if (!isWidgetInstalled(fromAppId)) {
- ThrowMsg(WidgetDAOReadOnly::Exception::WidgetNotExist,
- "Cannot find widget. tzAppId: " << fromAppId);
- }
-
- WRT_DB_SELECT(select, WidgetInfo, &WrtDatabase::interface())
- select->Where(Equals<WidgetInfo::tizen_appid>(fromAppId));
-
- WidgetInfo::Row row = select->GetSingleRow();
-
- //WidgetInfo::Row row;
- row.Set_tizen_appid(toAppId);
-
- WRT_DB_UPDATE(update, WidgetInfo, &WrtDatabase::interface())
- update->Where(Equals<WidgetInfo::tizen_appid>(fromAppId));
- update->Values(row);
- update->Execute();
-
- transaction.Commit();
- }
- SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to update appid")
-}
-
#undef DO_INSERT
#undef SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN