Beispiel #1
0
bool CPVRDatabase::GetChannelGroupList(CPVRChannelGroups &results, bool bRadio /* = false */)
{
  bool bReturn = false;
  CStdString strQuery = FormatSQL("SELECT * from ChannelGroup WHERE IsRadio = %u ORDER BY sortOrder\n", bRadio);
  int iNumRows = ResultQuery(strQuery);

  if (iNumRows > 0)
  {
    try
    {
      while (!m_pDS->eof())
      {
        CPVRChannelGroup data;

        data.SetGroupID(m_pDS->fv("GroupId").get_asInt());
        data.SetGroupName(m_pDS->fv("Name").get_asString());
        data.SetSortOrder(m_pDS->fv("SortOrder").get_asInt());

        results.push_back(data);
        m_pDS->next();
      }
      bReturn = true;
    }
    catch (...)
    {
      CLog::Log(LOGERROR, "%s - couldn't load channels from the database", __FUNCTION__);
    }
  }

  m_pDS->close();
  return bReturn;
}