aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorksooo <3226626+ksooo@users.noreply.github.com>2024-08-10 11:00:29 +0200
committerksooo <3226626+ksooo@users.noreply.github.com>2024-08-10 12:15:40 +0200
commitc10995e0626bc2e59376b2ebe8f21891f0fc2324 (patch)
tree1ec65f5f807b9f7bdccb107f34e38b964d4070e5
parentc5e4f59a74397a08ce35e3d45e12ad98577e1eb1 (diff)
[PVR] Backport PVR database schema update 44->45. No functional changes, only needed to bring actual changes of schema 46 into Omega in a compatible way).
-rw-r--r--xbmc/pvr/PVRDatabase.cpp25
-rw-r--r--xbmc/pvr/PVRDatabase.h2
2 files changed, 19 insertions, 8 deletions
diff --git a/xbmc/pvr/PVRDatabase.cpp b/xbmc/pvr/PVRDatabase.cpp
index a26bd5f636..be5a896262 100644
--- a/xbmc/pvr/PVRDatabase.cpp
+++ b/xbmc/pvr/PVRDatabase.cpp
@@ -156,7 +156,8 @@ void CPVRDatabase::CreateTables()
"bHasArchive bool, "
"iClientProviderUid integer, "
"bIsUserSetHidden bool, "
- "iLastWatchedGroupId integer"
+ "iLastWatchedGroupId integer, "
+ "sDateTimeAdded varchar(20)"
")");
CLog::LogFC(LOGDEBUG, LOGPVR, "Creating table 'channelgroups'");
@@ -368,6 +369,12 @@ void CPVRDatabase::UpdateTables(int iVersion)
m_pDS->exec("ALTER TABLE channels ADD iLastWatchedGroupId integer");
m_pDS->exec("UPDATE channels SET iLastWatchedGroupId = -1");
}
+
+ if (iVersion < 45)
+ {
+ m_pDS->exec("ALTER TABLE channels ADD sDateTimeAdded varchar(20)");
+ m_pDS->exec("UPDATE channels SET sDateTimeAdded = ''");
+ }
}
/********** Client methods **********/
@@ -1037,15 +1044,17 @@ bool CPVRDatabase::Persist(CPVRChannel& channel, bool bCommit)
"INSERT INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsUserSetName, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
- "idEpg, bHasArchive, iClientProviderUid, bIsUserSetHidden, iLastWatchedGroupId) "
- "VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, %i, %i, %i, %i)",
+ "idEpg, bHasArchive, iClientProviderUid, bIsUserSetHidden, iLastWatchedGroupId, "
+ "sDateTimeAdded) "
+ "VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, %i, %i, %i, %i, "
+ "'%s')",
channel.UniqueID(), (channel.IsRadio() ? 1 : 0), (channel.IsHidden() ? 1 : 0),
(channel.IsUserSetIcon() ? 1 : 0), (channel.IsUserSetName() ? 1 : 0),
(channel.IsLocked() ? 1 : 0), channel.IconPath().c_str(), channel.ChannelName().c_str(), 0,
(channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(),
static_cast<unsigned int>(channel.LastWatched()), channel.ClientID(), channel.EpgID(),
channel.HasArchive(), channel.ClientProviderUid(), channel.IsUserSetHidden() ? 1 : 0,
- channel.LastWatchedGroupId());
+ channel.LastWatchedGroupId(), "");
}
else
{
@@ -1054,8 +1063,10 @@ bool CPVRDatabase::Persist(CPVRChannel& channel, bool bCommit)
"REPLACE INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsUserSetName, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
- "idChannel, idEpg, bHasArchive, iClientProviderUid, bIsUserSetHidden, iLastWatchedGroupId) "
- "VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %s, %i, %i, %i, %i, %i)",
+ "idChannel, idEpg, bHasArchive, iClientProviderUid, bIsUserSetHidden, iLastWatchedGroupId, "
+ "sDateTimeAdded) "
+ "VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %s, %i, %i, %i, %i, %i, "
+ "'%s')",
channel.UniqueID(), (channel.IsRadio() ? 1 : 0), (channel.IsHidden() ? 1 : 0),
(channel.IsUserSetIcon() ? 1 : 0), (channel.IsUserSetName() ? 1 : 0),
(channel.IsLocked() ? 1 : 0), channel.ClientIconPath().c_str(),
@@ -1063,7 +1074,7 @@ bool CPVRDatabase::Persist(CPVRChannel& channel, bool bCommit)
channel.EPGScraper().c_str(), static_cast<unsigned int>(channel.LastWatched()),
channel.ClientID(), strValue.c_str(), channel.EpgID(), channel.HasArchive(),
channel.ClientProviderUid(), channel.IsUserSetHidden() ? 1 : 0,
- channel.LastWatchedGroupId());
+ channel.LastWatchedGroupId(), "");
}
if (QueueInsertQuery(strQuery))
diff --git a/xbmc/pvr/PVRDatabase.h b/xbmc/pvr/PVRDatabase.h
index 7a8932e95d..509360d5b6 100644
--- a/xbmc/pvr/PVRDatabase.h
+++ b/xbmc/pvr/PVRDatabase.h
@@ -64,7 +64,7 @@ namespace PVR
* @brief Get the minimal database version that is required to operate correctly.
* @return The minimal database version.
*/
- int GetSchemaVersion() const override { return 44; }
+ int GetSchemaVersion() const override { return 45; }
/*!
* @brief Get the default sqlite database filename.