当前位置: 首页>>代码示例>>C++>>正文


C++ CEpgDatabase::IsOpen方法代码示例

本文整理汇总了C++中CEpgDatabase::IsOpen方法的典型用法代码示例。如果您正苦于以下问题:C++ CEpgDatabase::IsOpen方法的具体用法?C++ CEpgDatabase::IsOpen怎么用?C++ CEpgDatabase::IsOpen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CEpgDatabase的用法示例。


在下文中一共展示了CEpgDatabase::IsOpen方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Load

bool CEpg::Load(void)
{
  bool bReturn(false);
  CEpgDatabase *database = g_EpgContainer.GetDatabase();

  if (!database || !database->IsOpen())
  {
    CLog::Log(LOGERROR, "EPG - %s - could not open the database", __FUNCTION__);
    return bReturn;
  }

  CSingleLock lock(m_critSection);
  int iEntriesLoaded = database->Get(*this);
  if (iEntriesLoaded <= 0)
  {
    CLog::Log(LOGDEBUG, "EPG - %s - no database entries found for table '%s'.", __FUNCTION__, m_strName.c_str());
  }
  else
  {
    m_lastScanTime = GetLastScanTime();
#if EPG_DEBUGGING
    CLog::Log(LOGDEBUG, "EPG - %s - %d entries loaded for table '%s'.", __FUNCTION__, (int) m_tags.size(), m_strName.c_str());
#endif
    bReturn = true;
  }

  m_bLoaded = true;

  return bReturn;
}
开发者ID:Jdiesel87,项目名称:xbmc,代码行数:30,代码来源:Epg.cpp

示例2: GetLastScanTime

CDateTime CEpg::GetLastScanTime(void)
{
  CDateTime lastScanTime;
  {
    CSingleLock lock(m_critSection);

    if (!m_lastScanTime.IsValid())
    {
      if (!CSettings::GetInstance().GetBool(CSettings::SETTING_EPG_IGNOREDBFORCLIENT))
      {
        CEpgDatabase *database = g_EpgContainer.GetDatabase();
        CDateTime dtReturn; dtReturn.SetValid(false);

        if (database && database->IsOpen())
          database->GetLastEpgScanTime(m_iEpgID, &m_lastScanTime);
      }

      if (!m_lastScanTime.IsValid())
      {
        m_lastScanTime.SetDateTime(1970, 1, 1, 0, 0, 0);
        assert(m_lastScanTime.IsValid());
      }
    }
    lastScanTime = m_lastScanTime;
  }

  return m_lastScanTime;
}
开发者ID:Jdiesel87,项目名称:xbmc,代码行数:28,代码来源:Epg.cpp

示例3: GetLastScanTime

CDateTime CEpg::GetLastScanTime(void)
{
  CDateTime lastScanTime;
  {
    CSingleLock lock(m_critSection);

    if (!m_lastScanTime.IsValid())
    {
      if (!CSettings::Get().GetBool("epg.ignoredbforclient"))
      {
        CEpgDatabase *database = g_EpgContainer.GetDatabase();
        CDateTime dtReturn; dtReturn.SetValid(false);

        if (database && database->IsOpen())
          database->GetLastEpgScanTime(m_iEpgID, &m_lastScanTime);
      }

      if (!m_lastScanTime.IsValid())
      {
        m_lastScanTime.SetDateTime(0, 0, 0, 0, 0, 0);
        m_lastScanTime.SetValid(true);
      }
    }
    lastScanTime = m_lastScanTime;
  }

  return m_lastScanTime;
}
开发者ID:Distrotech,项目名称:xbmc,代码行数:28,代码来源:Epg.cpp

示例4: Persist

bool CEpgInfoTag::Persist(bool bSingleUpdate /* = true */)
{
  bool bReturn = false;

#if EPG_DEBUGGING
  CLog::Log(LOGDEBUG, "Epg - %s - Infotag '%s' %s, persisting...", __FUNCTION__, m_strTitle.c_str(), m_iBroadcastId > 0 ? "has changes" : "is new");
#endif

  CEpgDatabase *database = g_EpgContainer.GetDatabase();
  if (!database || (bSingleUpdate && !database->IsOpen()))
  {
    CLog::Log(LOGERROR, "%s - could not open the database", __FUNCTION__);
    return bReturn;
  }

  int iId = database->Persist(*this, bSingleUpdate);
  if (iId >= 0)
  {
    bReturn = true;

    if (iId > 0)
      m_iBroadcastId = iId;
  }

  return bReturn;
}
开发者ID:Distrotech,项目名称:xbmc,代码行数:26,代码来源:EpgInfoTag.cpp

示例5: UpdateEntries

bool CEpg::UpdateEntries(const CEpg &epg, bool bStoreInDb /* = true */)
{
  bool bReturn(false);
  CEpgDatabase *database = g_EpgContainer.GetDatabase();

  if (epg.m_tags.size() > 0)
  {
    if (bStoreInDb)
    {
      if (!database || !database->IsOpen())
      {
        CLog::Log(LOGERROR, "%s - could not open the database", __FUNCTION__);
        return bReturn;
      }
      database->BeginTransaction();
    }

    {
      CSingleLock lock(m_critSection);
      CLog::Log(LOGDEBUG, "%s - %zu entries in memory before merging", __FUNCTION__, m_tags.size());
      /* copy over tags */
      for (map<CDateTime, CEpgInfoTagPtr>::const_iterator it = epg.m_tags.begin(); it != epg.m_tags.end(); it++)
        UpdateEntry(*it->second, bStoreInDb, false);

      CLog::Log(LOGDEBUG, "%s - %zu entries in memory after merging and before fixing", __FUNCTION__, m_tags.size());
      FixOverlappingEvents(bStoreInDb);
      CLog::Log(LOGDEBUG, "%s - %zu entries in memory after fixing", __FUNCTION__, m_tags.size());
      /* update the last scan time of this table */
      m_lastScanTime = CDateTime::GetCurrentDateTime().GetAsUTCDateTime();

      SetChanged();
    }
    /* persist changes */
    if (bStoreInDb)
    {
      bReturn = database->CommitTransaction();
      if (bReturn)
        Persist(true);
    }
    else
      bReturn = true;
  }
  else
  {
    if (bStoreInDb)
      bReturn = Persist(true);
    else
      bReturn = true;
  }

  NotifyObservers(ObservableMessageEpg);

  return bReturn;
}
开发者ID:RobertMe,项目名称:xbmc,代码行数:54,代码来源:Epg.cpp

示例6: Persist

bool CEpg::Persist(bool bUpdateLastScanTime /* = false */)
{
  if (g_guiSettings.GetBool("epg.ignoredbforclient"))
    return true;

  CEpgDatabase *database = g_EpgContainer.GetDatabase();

  if (!database || !database->IsOpen())
  {
    CLog::Log(LOGERROR, "%s - could not open the database", __FUNCTION__);
    return false;
  }

  CEpg epgCopy;
  {
    CSingleLock lock(m_critSection);
    epgCopy = *this;
    m_bChanged     = false;
    m_bTagsChanged = false;
  }

  database->BeginTransaction();

  if (epgCopy.m_iEpgID <= 0 || epgCopy.m_bChanged)
  {
    int iId = database->Persist(epgCopy);
    if (iId > 0)
    {
      epgCopy.m_iEpgID   = iId;
      epgCopy.m_bChanged = false;
      if (m_iEpgID != epgCopy.m_iEpgID)
      {
        CSingleLock lock(m_critSection);
        m_iEpgID = epgCopy.m_iEpgID;
      }
    }
  }

  bool bReturn(true);

  if (bUpdateLastScanTime)
    bReturn = database->PersistLastEpgScanTime(epgCopy.m_iEpgID);

  database->CommitTransaction();

  return bReturn;
}
开发者ID:Omel,项目名称:xbmc,代码行数:47,代码来源:Epg.cpp

示例7: Persist

bool CEpg::Persist(void)
{
  if (CSettings::GetInstance().GetBool(CSettings::SETTING_EPG_IGNOREDBFORCLIENT) || !NeedsSave())
    return true;

#if EPG_DEBUGGING
  CLog::Log(LOGDEBUG, "persist table '%s' (#%d) changed=%d deleted=%d", Name().c_str(), m_iEpgID, m_changedTags.size(), m_deletedTags.size());
#endif

  CEpgDatabase *database = g_EpgContainer.GetDatabase();
  if (!database || !database->IsOpen())
  {
    CLog::Log(LOGERROR, "EPG - %s - could not open the database", __FUNCTION__);
    return false;
  }

  {
    CSingleLock lock(m_critSection);
    if (m_iEpgID <= 0 || m_bChanged)
    {
      int iId = database->Persist(*this, m_iEpgID > 0);
      if (iId > 0)
        m_iEpgID = iId;
    }

    for (std::map<int, CEpgInfoTagPtr>::iterator it = m_deletedTags.begin(); it != m_deletedTags.end(); ++it)
      database->Delete(*it->second);

    for (std::map<int, CEpgInfoTagPtr>::iterator it = m_changedTags.begin(); it != m_changedTags.end(); ++it)
      it->second->Persist(false);

    if (m_bUpdateLastScanTime)
      database->PersistLastEpgScanTime(m_iEpgID, true);

    m_deletedTags.clear();
    m_changedTags.clear();
    m_bChanged            = false;
    m_bTagsChanged        = false;
    m_bUpdateLastScanTime = false;
  }

  return database->CommitInsertQueries();
}
开发者ID:Jdiesel87,项目名称:xbmc,代码行数:43,代码来源:Epg.cpp

示例8: PersistTags

bool CEpg::PersistTags(void) const
{
  bool bReturn = false;
  CEpgDatabase *database = g_EpgContainer.GetDatabase();

  if (!database || !database->IsOpen())
  {
    CLog::Log(LOGERROR, "EPG - %s - could not load the database", __FUNCTION__);
    return bReturn;
  }

  CDateTime first = GetFirstDate();
  CDateTime last = GetLastDate();

  time_t iStart(0), iEnd(0);
  if (first.IsValid())
    first.GetAsTime(iStart);
  if (last.IsValid())
    last.GetAsTime(iEnd);
  database->Delete(*this, iStart, iEnd);

  if (m_tags.size() > 0)
  {
    for (map<CDateTime, CEpgInfoTag *>::const_iterator it = m_tags.begin(); it != m_tags.end(); it++)
    {
      if (!it->second->Persist())
      {
        CLog::Log(LOGERROR, "failed to persist epg tag %d", it->second->UniqueBroadcastID());
        bReturn = false;
      }
    }
  }
  else
  {
    /* Return true if we have no tags, so that no error is logged */
    bReturn = true;
  }

  return bReturn;
}
开发者ID:Omel,项目名称:xbmc,代码行数:40,代码来源:Epg.cpp


注:本文中的CEpgDatabase::IsOpen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。