Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[pvr] work around for frodo to fix CPVRDatabase::RemoveStaleChannelsF…

…romGroup for both sqlite3 and mysql
  • Loading branch information...
commit 1336ec731ff02fbcfa262140d531f50992624357 1 parent 55d0a0a
@opdenkamp opdenkamp authored
Showing with 13 additions and 2 deletions.
  1. +13 −2 xbmc/pvr/PVRDatabase.cpp
View
15 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)
Please sign in to comment.
Something went wrong with that request. Please try again.