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


C++ CDateTime::SetFromDBDateTime方法代码示例

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


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

示例1: GetCachedTexture

bool CTextureDatabase::GetCachedTexture(const CStdString &url, CStdString &cacheFile, CStdString &imageHash)
{
  try
  {
    if (NULL == m_pDB.get()) return false;
    if (NULL == m_pDS.get()) return false;

    CStdString sql = PrepareSQL("select id, cachedurl, lasthashcheck, imagehash from texture where url='%s'", url.c_str());
    m_pDS->query(sql.c_str());

    if (!m_pDS->eof())
    { // have some information
      int textureID = m_pDS->fv(0).get_asInt();
      cacheFile = m_pDS->fv(1).get_asString();
      CDateTime lastCheck;
      lastCheck.SetFromDBDateTime(m_pDS->fv(2).get_asString());
      if (!lastCheck.IsValid() || lastCheck + CDateTimeSpan(1,0,0,0) < CDateTime::GetCurrentDateTime())
        imageHash = m_pDS->fv(3).get_asString();
      m_pDS->close();
      // update the use count
      sql = PrepareSQL("update texture set usecount=usecount+1, lastusetime=CURRENT_TIMESTAMP where id=%u", textureID);
      m_pDS->exec(sql.c_str());
      return true;
    }
    m_pDS->close();
  }
  catch (...)
  {
    CLog::Log(LOGERROR, "%s, failed on url '%s'", __FUNCTION__, url.c_str());
  }
  return false;
}
开发者ID:Ayu222,项目名称:android,代码行数:32,代码来源:TextureDatabase.cpp

示例2: GetCachedTexture

bool CTextureDatabase::GetCachedTexture(const CStdString &url, CTextureDetails &details)
{
  try
  {
    if (NULL == m_pDB.get()) return false;
    if (NULL == m_pDS.get()) return false;

    CStdString sql = PrepareSQL("SELECT id, cachedurl, lasthashcheck, imagehash, width, height FROM texture JOIN sizes ON (texture.id=sizes.idtexture AND sizes.size=1) WHERE url='%s'", url.c_str());
    m_pDS->query(sql.c_str());
    if (!m_pDS->eof())
    { // have some information
      details.id = m_pDS->fv(0).get_asInt();
      details.file  = m_pDS->fv(1).get_asString();
      CDateTime lastCheck;
      lastCheck.SetFromDBDateTime(m_pDS->fv(2).get_asString());
      if (lastCheck.IsValid() && lastCheck + CDateTimeSpan(1,0,0,0) < CDateTime::GetCurrentDateTime())
        details.hash = m_pDS->fv(3).get_asString();
      details.width = m_pDS->fv(4).get_asInt();
      details.height = m_pDS->fv(5).get_asInt();
      m_pDS->close();
      return true;
    }
    m_pDS->close();
  }
  catch (...)
  {
    CLog::Log(LOGERROR, "%s, failed on url '%s'", __FUNCTION__, url.c_str());
  }
  return false;
}
开发者ID:A600,项目名称:xbmc,代码行数:30,代码来源:TextureDatabase.cpp

示例3: GetDateTime

bool XMLUtils::GetDateTime(const TiXmlNode* pRootNode, const char* strTag, CDateTime& dateTime)
{
  CStdString strDateTime;
  if (GetString(pRootNode, strTag, strDateTime) && !strDateTime.empty())
  {
    dateTime.SetFromDBDateTime(strDateTime);
    return true;
  }

  return false;
}
开发者ID:B0k0,项目名称:xbmc,代码行数:11,代码来源:XMLUtils.cpp

示例4: GetLastEpgScanTime

CDateTime CPVRDatabase::GetLastEpgScanTime()
{
  if (lastScanTime.IsValid())
    return lastScanTime;

  CStdString strValue = GetSingleValue("LastEPGScan", "ScanTime");

  if (strValue.IsEmpty())
    return -1;

  CDateTime lastTime;
  lastTime.SetFromDBDateTime(strValue);
  lastScanTime = lastTime;

  return lastTime;
}
开发者ID:margro,项目名称:xbmc-antiquated,代码行数:16,代码来源:PVRDatabase.cpp

示例5: GetEpgDataEnd

CDateTime CPVRDatabase::GetEpgDataEnd(long iChannelId /* = -1 */)
{
  CDateTime lastProgramme;
  CStdString strWhereClause;

  if (iChannelId > 0)
    strWhereClause = FormatSQL("ChannelId = '%u'", iChannelId);

  CStdString strReturn = GetSingleValue("EpgData", "EndTime", strWhereClause, "EndTime DESC");
  if (!strReturn.IsEmpty())
    lastProgramme.SetFromDBDateTime(strReturn);

  if (!lastProgramme.IsValid())
    return CDateTime::GetCurrentDateTime();
  else
    return lastProgramme;
}
开发者ID:margro,项目名称:xbmc-antiquated,代码行数:17,代码来源:PVRDatabase.cpp

示例6: GetRepoTimestamp

CDateTime CAddonDatabase::GetRepoTimestamp(const std::string& id)
{
  CDateTime date;
  try
  {
    if (NULL == m_pDB.get()) return date;
    if (NULL == m_pDS.get()) return date;

    std::string strSQL = PrepareSQL("select * from repo where addonID='%s'",id.c_str());
    m_pDS->query(strSQL.c_str());
    if (!m_pDS->eof())
    {
      date.SetFromDBDateTime(m_pDS->fv("lastcheck").get_asString());
      return date;
    }
  }
  catch (...)
  {
    CLog::Log(LOGERROR, "%s failed on repo '%s'", __FUNCTION__, id.c_str());
  }
  return date;
}
开发者ID:Distrotech,项目名称:xbmc,代码行数:22,代码来源:AddonDatabase.cpp

示例7: version

std::pair<CDateTime, ADDON::AddonVersion> CAddonDatabase::LastChecked(const std::string& id)
{
  CDateTime date;
  AddonVersion version("0.0.0");
  try
  {
    if (m_pDB.get() != nullptr && m_pDS.get() != nullptr)
    {
      std::string strSQL = PrepareSQL("select * from repo where addonID='%s'",id.c_str());
      m_pDS->query(strSQL);
      if (!m_pDS->eof())
      {
        date.SetFromDBDateTime(m_pDS->fv("lastcheck").get_asString());
        version = AddonVersion(m_pDS->fv("version").get_asString());
      }
    }
  }
  catch (...)
  {
    CLog::Log(LOGERROR, "%s failed on repo '%s'", __FUNCTION__, id.c_str());
  }
  return std::make_pair(date, version);
}
开发者ID:Montellese,项目名称:xbmc,代码行数:23,代码来源:AddonDatabase.cpp


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