Skip to content

Commit

Permalink
fix: surround where clause for sets in () else any AND clauses may ch…
Browse files Browse the repository at this point in the history
…ange its meaning
  • Loading branch information
Jonathan Marshall committed May 10, 2012
1 parent fb4a9c0 commit 256b716
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xbmc/video/VideoDatabase.cpp
Expand Up @@ -4230,7 +4230,7 @@ bool CVideoDatabase::GetSetsNav(const CStdString& strBaseDir, CFileItemList& ite
if (idContent == VIDEODB_CONTENT_MOVIES)
strSQL=PrepareSQL("SELECT sets.idSet,sets.strSet,path.strPath,files.playCount FROM sets JOIN setlinkmovie ON sets.idSet=setlinkmovie.idSet JOIN (SELECT idSet, COUNT(1) AS c FROM setlinkmovie GROUP BY idSet HAVING c>1) s2 ON s2.idSet=sets.idSet JOIN movie ON setlinkmovie.idMovie=movie.idMovie JOIN files ON files.idFile=movie.idFile JOIN path ON path.idPath=files.idPath ");
if (!where.empty())
strSQL += " WHERE " + where;
strSQL += " WHERE (" + where + ")";
}
else
{
Expand All @@ -4241,7 +4241,7 @@ bool CVideoDatabase::GetSetsNav(const CStdString& strBaseDir, CFileItemList& ite
group = " GROUP BY sets.idSet HAVING c>1";
}
if (!where.empty())
strSQL += " WHERE " + where;
strSQL += " WHERE (" + where + ")";
strSQL += group;
}

Expand Down Expand Up @@ -5034,7 +5034,7 @@ bool CVideoDatabase::GetMoviesByWhere(const CStdString& strBaseDir, const Filter
strSQL += filter.join;
if (!filter.where.empty())
{
strSQL += " WHERE " + filter.where;
strSQL += " WHERE (" + filter.where + ")";
strSQL += PrepareSQL(" AND " + movieSetsWhere);
}
else
Expand Down

0 comments on commit 256b716

Please sign in to comment.