diff options
author | Lars Op den Kamp <lars@opdenkamp.eu> | 2013-01-11 03:04:48 +0100 |
---|---|---|
committer | Lars Op den Kamp <lars@opdenkamp.eu> | 2013-01-11 03:06:50 +0100 |
commit | 1336ec731ff02fbcfa262140d531f50992624357 (patch) | |
tree | 7b1994554dae09cd0a5637b1deab1dfdddbe5aad | |
parent | 55d0a0ad39bc31b7472c3b6f98f2c98071c2b0a4 (diff) |
[pvr] work around for frodo to fix CPVRDatabase::RemoveStaleChannelsFromGroup for both sqlite3 and mysql
-rw-r--r-- | xbmc/pvr/PVRDatabase.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/xbmc/pvr/PVRDatabase.cpp b/xbmc/pvr/PVRDatabase.cpp index fbfc5d0d3f..3622985102 100644 --- a/xbmc/pvr/PVRDatabase.cpp +++ b/xbmc/pvr/PVRDatabase.cpp @@ -609,8 +609,19 @@ bool CPVRDatabase::RemoveStaleChannelsFromGroup(const CPVRChannelGroup &group) if (!group.IsInternalGroup()) { /* First remove channels that don't exist in the main channels table */ - CStdString strQuery = FormatSQL("DELETE m FROM map_channelgroups_channels m LEFT JOIN channels c ON (c.idChannel = m.idChannel) WHERE c.idChannel IS NULL"); - bDelete = ExecuteQuery(strQuery); + + // XXX work around for frodo: fix this up so it uses one query for all db types + // mysql doesn't support subqueries when deleting and sqlite doesn't support joins when deleting + if (g_advancedSettings.m_databaseTV.type.Equals("mysql")) + { + CStdString strQuery = FormatSQL("DELETE m FROM map_channelgroups_channels m LEFT JOIN channels c ON (c.idChannel = m.idChannel) WHERE c.idChannel IS NULL"); + bDelete = ExecuteQuery(strQuery); + } + else + { + CStdString strWhereClause = FormatSQL("idChannel IN (SELECT m.idChannel FROM map_channelgroups_channels m LEFT JOIN channels on m.idChannel = channels.idChannel WHERE channels.idChannel IS NULL)"); + bDelete = DeleteValues("map_channelgroups_channels", strWhereClause); + } } if (group.m_members.size() > 0) |