Skip to content

Commit

Permalink
videodb: potentially fix SQL query in GetRandomMusicVideo
Browse files Browse the repository at this point in the history
  • Loading branch information
Montellese committed Jan 17, 2015
1 parent b99142f commit 37dd3cb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions xbmc/video/VideoDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7214,10 +7214,9 @@ bool CVideoDatabase::GetRandomMusicVideo(CFileItem* item, int& idSong, const std
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;

// We don't use PrepareSQL here, as the WHERE clause is already formatted.
std::string strSQL = "select * from musicvideo_view";
if (!strWhere.empty())
strSQL += PrepareSQL(" where %s", strWhere.c_str());
strSQL += " where " + strWhere;
strSQL += PrepareSQL(" order by RANDOM() limit 1");
CLog::Log(LOGDEBUG, "%s query = %s", __FUNCTION__, strSQL.c_str());
// run query
Expand Down

0 comments on commit 37dd3cb

Please sign in to comment.