Skip to content

Commit

Permalink
Add comments to SqliteItemRepository to help out whoever is next
Browse files Browse the repository at this point in the history
  • Loading branch information
hawken93 committed Jan 22, 2019
1 parent a356c14 commit 490e22c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Emby.Server.Implementations/Data/SqliteItemRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4712,9 +4712,21 @@ private List<string> GetWhereClauses(InternalItemsQuery query, IStatement statem
continue;
}

var paramName = "@HasAnyProviderId" + index;
// TODO this seems to be an idea for a better schema where ProviderIds are their own table
// buut this is not implemented
//hasProviderIds.Add("(COALESCE((select value from ProviderIds where ItemId=Guid and Name = '" + pair.Key + "'), '') <> " + paramName + ")");

// TODO this is a really BAD way to do it since the pair:
// Tmdb, 1234 matches Tmdb=1234 but also Tmdb=1234567
// and maybe even NotTmdb=1234.

// this is a placeholder for this specific pair to correlate it in the bigger query
var paramName = "@HasAnyProviderId" + index;

// this is a search for the placeholder
hasProviderIds.Add("ProviderIds like " + paramName + "");

// this replaces the placeholder with a value, here: %key=val%
if (statement != null)
{
statement.TryBind(paramName, "%" + pair.Key + "=" + pair.Value + "%");
Expand Down

0 comments on commit 490e22c

Please sign in to comment.