3732
bool CMusicDatabase::GetRandomSong(CFileItem* item)
3738
if (NULL == m_pDB.get()) return false;
3739
if (NULL == m_pDS.get()) return false;
3741
CStdString strSQL=FormatSQL("select count(*) as count from songview");
3744
if (!m_pDS->query(strSQL.c_str())) return false;
3745
int iRowsFound = m_pDS->num_rows();
3746
if (iRowsFound != 1)
3751
lSongs = m_pDS->fv("songview.count").get_asLong();
3757
srand(timeGetTime());
3758
long lRandom = rand() % lSongs;
3759
strSQL=FormatSQL("select * from songview where idSong = %ld", lRandom);
3762
if (!m_pDS->query(strSQL.c_str())) return false;
3763
iRowsFound = m_pDS->num_rows();
3764
if (iRowsFound != 1)
3769
GetFileItemFromDataset(item, "");
3775
CLog::Log(LOGERROR,"CMusicDatabase::GetRandomSong() failed");
b'\\ No newline at end of file'