Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

pvr: stick the table creation in a transaction, and don't try to cont…

…inue when the tables couldn't be created
  • Loading branch information...
commit b3e96b39a5afc87211ba7c470660a7793fdccdff 1 parent 94ece28
@opdenkamp opdenkamp authored
Showing with 16 additions and 10 deletions.
  1. +16 −10 xbmc/pvr/PVRDatabase.cpp
View
26 xbmc/pvr/PVRDatabase.cpp
@@ -48,6 +48,7 @@ bool CPVRDatabase::CreateTables()
if (!CDatabase::CreateTables())
return false;
+ BeginTransaction();
CLog::Log(LOGINFO, "PVR - %s - creating tables", __FUNCTION__);
CLog::Log(LOGDEBUG, "PVR - %s - creating table 'clients'", __FUNCTION__);
@@ -153,25 +154,30 @@ bool CPVRDatabase::CreateTables()
")"
);
+ CommitTransaction();
bReturn = true;
}
catch (...)
{
CLog::Log(LOGERROR, "PVR - %s - unable to create PVR database tables (error %i)", __FUNCTION__, (int)GetLastError());
+ RollbackTransaction();
bReturn = false;
}
- // disable all PVR add-on when started the first time
- ADDON::VECADDONS addons;
- if ((bReturn = CAddonMgr::Get().GetAddons(ADDON_PVRDLL, addons, true, false)) == false)
- CLog::Log(LOGERROR, "PVR - %s - failed to get add-ons from the add-on manager", __FUNCTION__);
- else
+ if (bReturn)
{
- CAddonDatabase database;
- database.Open();
- for (IVECADDONS it = addons.begin(); it != addons.end(); it++)
- database.DisableAddon(it->get()->ID());
- database.Close();
+ // disable all PVR add-on when started the first time
+ ADDON::VECADDONS addons;
+ if ((bReturn = CAddonMgr::Get().GetAddons(ADDON_PVRDLL, addons, true, false)) == false)
+ CLog::Log(LOGERROR, "PVR - %s - failed to get add-ons from the add-on manager", __FUNCTION__);
+ else
+ {
+ CAddonDatabase database;
+ database.Open();
+ for (IVECADDONS it = addons.begin(); it != addons.end(); it++)
+ database.DisableAddon(it->get()->ID());
+ database.Close();
+ }
}
return bReturn;
Please sign in to comment.
Something went wrong with that request. Please try again.