remove schema version checks

pull/702/head
Luke Pulverenti 9 years ago
parent df121005ee
commit e5049f92b4

@ -62,13 +62,6 @@ namespace MediaBrowser.Controller.Entities.Audio
query.ArtistNames = new[] { Name };
}
// Need this for now since the artist filter isn't yet supported by the db
if (ConfigurationManager.Configuration.SchemaVersion < 79)
{
var filter = GetItemFilter();
return LibraryManager.GetItemList(query).Where(filter);
}
return LibraryManager.GetItemList(query);
}

@ -773,53 +773,8 @@ namespace MediaBrowser.Controller.Entities
}
}
var supportsUserDataQueries = ConfigurationManager.Configuration.SchemaVersion >= 76;
if (query.SortBy != null && query.SortBy.Length > 0)
{
if (!supportsUserDataQueries)
{
if (query.SortBy.Contains(ItemSortBy.DatePlayed, StringComparer.OrdinalIgnoreCase))
{
Logger.Debug("Query requires post-filtering due to ItemSortBy.IsFavoriteOrLiked");
return true;
}
if (query.SortBy.Contains(ItemSortBy.PlayCount, StringComparer.OrdinalIgnoreCase))
{
Logger.Debug("Query requires post-filtering due to ItemSortBy.PlayCount");
return true;
}
if (query.SortBy.Contains(ItemSortBy.IsFavoriteOrLiked, StringComparer.OrdinalIgnoreCase))
{
Logger.Debug("Query requires post-filtering due to ItemSortBy.IsFavoriteOrLiked");
return true;
}
if (query.SortBy.Contains(ItemSortBy.IsPlayed, StringComparer.OrdinalIgnoreCase))
{
Logger.Debug("Query requires post-filtering due to ItemSortBy.IsPlayed");
return true;
}
if (query.SortBy.Contains(ItemSortBy.IsUnplayed, StringComparer.OrdinalIgnoreCase))
{
Logger.Debug("Query requires post-filtering due to ItemSortBy.IsUnplayed");
return true;
}
}
if (ConfigurationManager.Configuration.SchemaVersion < 79)
{
if (query.SortBy.Contains(ItemSortBy.AlbumArtist, StringComparer.OrdinalIgnoreCase))
{
Logger.Debug("Query requires post-filtering due to ItemSortBy.AlbumArtist");
return true;
}
if (query.SortBy.Contains(ItemSortBy.Artist, StringComparer.OrdinalIgnoreCase))
{
Logger.Debug("Query requires post-filtering due to ItemSortBy.Artist");
return true;
}
}
if (query.SortBy.Contains(ItemSortBy.AiredEpisodeOrder, StringComparer.OrdinalIgnoreCase))
{
Logger.Debug("Query requires post-filtering due to ItemSortBy.AiredEpisodeOrder");
@ -884,39 +839,6 @@ namespace MediaBrowser.Controller.Entities
return true;
}
if (!supportsUserDataQueries)
{
if (query.IsLiked.HasValue)
{
Logger.Debug("Query requires post-filtering due to IsLiked");
return true;
}
if (query.IsFavoriteOrLiked.HasValue)
{
Logger.Debug("Query requires post-filtering due to IsFavoriteOrLiked");
return true;
}
if (query.IsFavorite.HasValue)
{
Logger.Debug("Query requires post-filtering due to IsFavorite");
return true;
}
if (query.IsResumable.HasValue)
{
Logger.Debug("Query requires post-filtering due to IsResumable");
return true;
}
if (query.IsPlayed.HasValue)
{
Logger.Debug("Query requires post-filtering due to IsPlayed");
return true;
}
}
if (query.IsInBoxSet.HasValue)
{
Logger.Debug("Query requires post-filtering due to IsInBoxSet");
@ -1102,15 +1024,6 @@ namespace MediaBrowser.Controller.Entities
return true;
}
if (ConfigurationManager.Configuration.SchemaVersion < 79)
{
if (query.ArtistNames.Length > 0)
{
Logger.Debug("Query requires post-filtering due to ArtistNames");
return true;
}
}
return false;
}

@ -1504,11 +1504,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
private bool EnableJoinUserData(InternalItemsQuery query)
{
if (_config.Configuration.SchemaVersion < 76)
{
return false;
}
if (query.User == null)
{
return false;
@ -1623,7 +1618,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
cmd.CommandText += whereText;
if (EnableGroupByPresentationUniqueKey(query) && _config.Configuration.SchemaVersion >= 66)
if (EnableGroupByPresentationUniqueKey(query))
{
cmd.CommandText += " Group by PresentationUniqueKey";
}
@ -1711,7 +1706,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
cmd.CommandText += whereText;
if (EnableGroupByPresentationUniqueKey(query) && _config.Configuration.SchemaVersion >= 66)
if (EnableGroupByPresentationUniqueKey(query))
{
cmd.CommandText += " Group by PresentationUniqueKey";
}
@ -1730,7 +1725,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
}
}
if (EnableGroupByPresentationUniqueKey(query) && _config.Configuration.SchemaVersion >= 66)
if (EnableGroupByPresentationUniqueKey(query))
{
cmd.CommandText += "; select count (distinct PresentationUniqueKey) from TypedBaseItems";
}
@ -1880,7 +1875,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
cmd.CommandText += whereText;
if (EnableGroupByPresentationUniqueKey(query) && _config.Configuration.SchemaVersion >= 66)
if (EnableGroupByPresentationUniqueKey(query))
{
cmd.CommandText += " Group by PresentationUniqueKey";
}
@ -1940,7 +1935,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
cmd.CommandText += whereText;
if (EnableGroupByPresentationUniqueKey(query) && _config.Configuration.SchemaVersion >= 66)
if (EnableGroupByPresentationUniqueKey(query))
{
cmd.CommandText += " Group by PresentationUniqueKey";
}
@ -2023,7 +2018,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
cmd.CommandText += whereText;
if (EnableGroupByPresentationUniqueKey(query) && _config.Configuration.SchemaVersion >= 66)
if (EnableGroupByPresentationUniqueKey(query))
{
cmd.CommandText += " Group by PresentationUniqueKey";
}
@ -2042,7 +2037,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
}
}
if (EnableGroupByPresentationUniqueKey(query) && _config.Configuration.SchemaVersion >= 66)
if (EnableGroupByPresentationUniqueKey(query))
{
cmd.CommandText += "; select count (distinct PresentationUniqueKey) from TypedBaseItems";
}
@ -2319,41 +2314,19 @@ namespace MediaBrowser.Server.Implementations.Persistence
if (!string.IsNullOrWhiteSpace(query.SlugName))
{
if (_config.Configuration.SchemaVersion >= 70)
{
whereClauses.Add("SlugName=@SlugName");
}
else
{
whereClauses.Add("Name=@SlugName");
}
whereClauses.Add("SlugName=@SlugName");
cmd.Parameters.Add(cmd, "@SlugName", DbType.String).Value = query.SlugName;
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
if (_config.Configuration.SchemaVersion >= 66)
{
whereClauses.Add("CleanName=@Name");
cmd.Parameters.Add(cmd, "@Name", DbType.String).Value = query.Name.RemoveDiacritics();
}
else
{
whereClauses.Add("Name=@Name");
cmd.Parameters.Add(cmd, "@Name", DbType.String).Value = query.Name;
}
whereClauses.Add("CleanName=@Name");
cmd.Parameters.Add(cmd, "@Name", DbType.String).Value = query.Name.RemoveDiacritics();
}
if (!string.IsNullOrWhiteSpace(query.NameContains))
{
if (_config.Configuration.SchemaVersion >= 66)
{
whereClauses.Add("CleanName like @NameContains");
}
else
{
whereClauses.Add("Name like @NameContains");
}
whereClauses.Add("CleanName like @NameContains");
cmd.Parameters.Add(cmd, "@NameContains", DbType.String).Value = "%" + query.NameContains.RemoveDiacritics() + "%";
}
if (!string.IsNullOrWhiteSpace(query.NameStartsWith))

Loading…
Cancel
Save