本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}