Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

videodb: fix retrieval of movies being part of a set (Eden backport of

  • Loading branch information...
commit 901b05e7ee4b7c2b2fd825ece828b592b5a2308a 1 parent 2b1da1d
@Montellese Montellese authored committed
Showing with 15 additions and 4 deletions.
  1. +15 −4 xbmc/video/VideoDatabase.cpp
View
19 xbmc/video/VideoDatabase.cpp
@@ -4717,10 +4717,21 @@ bool CVideoDatabase::GetMoviesByWhere(const CStdString& strBaseDir, const CStdSt
if (where.size())
setsWhere = " where movie.idMovie in (select movieview.idMovie from movieview " + where + ")";
GetSetsNav("videodb://1/7/", items, VIDEODB_CONTENT_MOVIES, setsWhere);
- CStdString movieSetsWhere = "movieview.idMovie NOT IN (SELECT idMovie FROM setlinkmovie s1 JOIN(SELECT idSet, COUNT(1) AS c FROM setlinkmovie GROUP BY idSet HAVING c>1) s2 ON s2.idSet=s1.idSet)";
+ CStdString movieSetsWhere;
+ if (items.Size() > 0)
+ {
+ movieSetsWhere = "movieview.idMovie NOT IN (SELECT idMovie FROM setlinkmovie s1 JOIN(SELECT idSet, COUNT(1) AS c FROM setlinkmovie GROUP BY idSet HAVING c>1) s2 ON s2.idSet=s1.idSet WHERE s1.idSet IN (";
+ for (int index = 0; index < items.Size(); index++)
+ movieSetsWhere.AppendFormat("%s%d", index > 0 ? "," : "", items[index]->GetVideoInfoTag()->m_iDbId);
+ movieSetsWhere += "))";
+ }
if (where.size())
- strSQL += where + PrepareSQL(" and " + movieSetsWhere);
- else
+ {
+ strSQL += where;
+ if (!movieSetsWhere.empty())
+ strSQL += PrepareSQL(" and " + movieSetsWhere);
+ }
+ else if (!movieSetsWhere.empty())
strSQL += PrepareSQL(" WHERE " + movieSetsWhere);
}
else
@@ -4734,7 +4745,7 @@ bool CVideoDatabase::GetMoviesByWhere(const CStdString& strBaseDir, const CStdSt
return iRowsFound == 0;
// get data from returned rows
- items.Reserve(iRowsFound);
+ items.Reserve(items.Size() + iRowsFound);
while (!m_pDS->eof())
{
CVideoInfoTag movie = GetDetailsForMovie(m_pDS);
Please sign in to comment.
Something went wrong with that request. Please try again.