本文整理汇总了C++中CDateTime::GetAsDBDateTime方法的典型用法代码示例。如果您正苦于以下问题:C++ CDateTime::GetAsDBDateTime方法的具体用法?C++ CDateTime::GetAsDBDateTime怎么用?C++ CDateTime::GetAsDBDateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDateTime
的用法示例。
在下文中一共展示了CDateTime::GetAsDBDateTime方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateLastEpgScanTime
bool CPVRDatabase::UpdateLastEpgScanTime(void)
{
CDateTime now = CDateTime::GetCurrentDateTime();
CLog::Log(LOGDEBUG, "PVRDB - %s - updating last scan time to '%s'",
__FUNCTION__, now.GetAsDBDateTime().c_str());
lastScanTime = now;
bool bReturn = true;
CStdString strQuery = FormatSQL("REPLACE INTO LastEPGScan (ScanTime) VALUES ('%s')\n",
now.GetAsDBDateTime().c_str());
bReturn = ExecuteQuery(strQuery);
return bReturn;
}
示例2: AddRepository
int CAddonDatabase::AddRepository(const std::string& id, const VECADDONS& addons, const std::string& checksum, const AddonVersion& version)
{
try
{
if (NULL == m_pDB.get()) return -1;
if (NULL == m_pDS.get()) return -1;
std::string sql;
int idRepo = GetRepoChecksum(id,sql);
if (idRepo > -1)
DeleteRepository(idRepo);
BeginTransaction();
CDateTime time = CDateTime::GetCurrentDateTime();
sql = PrepareSQL("insert into repo (id,addonID,checksum,lastcheck,version) values (NULL,'%s','%s','%s','%s')",
id.c_str(), checksum.c_str(), time.GetAsDBDateTime().c_str(), version.asString().c_str());
m_pDS->exec(sql.c_str());
idRepo = (int)m_pDS->lastinsertid();
for (unsigned int i=0;i<addons.size();++i)
AddAddon(addons[i],idRepo);
CommitTransaction();
return idRepo;
}
catch (...)
{
CLog::Log(LOGERROR, "%s failed on repo '%s'", __FUNCTION__, id.c_str());
RollbackTransaction();
}
return -1;
}
示例3: EraseOldEpgEntries
bool CPVRDatabase::EraseOldEpgEntries()
{
CDateTime yesterday = CDateTime::GetCurrentDateTime() - CDateTimeSpan(1, 0, 0, 0);
CStdString strWhereClause = FormatSQL("EndTime < '%s'", yesterday.GetAsDBDateTime().c_str());
return DeleteValues("EpgData", strWhereClause);
}
示例4: EraseEpgForChannel
bool CPVRDatabase::EraseEpgForChannel(const CPVRChannel &channel, const CDateTime &start /* = NULL */, const CDateTime &end /* = NULL */)
{
/* invalid channel */
if (channel.ChannelID() <= 0)
{
CLog::Log(LOGERROR, "PVRDB - %s - invalid channel id: %li",
__FUNCTION__, channel.ChannelID());
return false;
}
CLog::Log(LOGDEBUG, "PVRDB - %s - clearing the EPG for channel '%s'",
__FUNCTION__, channel.ChannelName().c_str());
CStdString strWhereClause;
strWhereClause = FormatSQL("ChannelId = %u", channel.ChannelID());
if (start != NULL)
strWhereClause.append(FormatSQL(" AND StartTime < %u", start.GetAsDBDateTime().c_str()).c_str());
if (end != NULL)
strWhereClause.append(FormatSQL(" AND EndTime > %u", end.GetAsDBDateTime().c_str()).c_str());
return DeleteValues("EpgData", strWhereClause);
}
示例5: SetLastUpdated
bool CAddonDatabase::SetLastUpdated(const std::string& addonId, const CDateTime& dateTime)
{
try
{
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
m_pDS->exec(PrepareSQL("UPDATE installed SET lastUpdated='%s' WHERE addonID='%s'",
dateTime.GetAsDBDateTime().c_str(), addonId.c_str()));
return true;
}
catch (...)
{
CLog::Log(LOGERROR, "%s failed on addon '%s'", __FUNCTION__, addonId.c_str());
}
return false;
}
示例6: SetLastUsed
bool CAddonDatabase::SetLastUsed(const std::string& addonId, const CDateTime& dateTime)
{
try
{
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
auto start = XbmcThreads::SystemClockMillis();
m_pDS->exec(PrepareSQL("UPDATE installed SET lastUsed='%s' WHERE addonID='%s'",
dateTime.GetAsDBDateTime().c_str(), addonId.c_str()));
CLog::Log(LOGDEBUG, "CAddonDatabase::SetLastUsed[%s] took %i ms", addonId.c_str(), XbmcThreads::SystemClockMillis() - start);
return true;
}
catch (...)
{
CLog::Log(LOGERROR, "%s failed on addon '%s'", __FUNCTION__, addonId.c_str());
}
return false;
}
示例7: SetDateTime
void XMLUtils::SetDateTime(TiXmlNode* pRootNode, const char *strTag, const CDateTime& dateTime)
{
SetString(pRootNode, strTag, dateTime.IsValid() ? dateTime.GetAsDBDateTime() : "");
}
示例8: GetEpgForChannel
int CPVRDatabase::GetEpgForChannel(CPVREpg *epg, const CDateTime &start /* = NULL */, const CDateTime &end /* = NULL */)
{
int iReturn = -1;
CPVRChannel *channel = epg->Channel();
if (!channel)
{
CLog::Log(LOGERROR, "PVRDB - %s - EPG doesn't contain a channel tag", __FUNCTION__);
return false;
}
CStdString strWhereClause;
strWhereClause = FormatSQL("ChannelId = %u", channel->ChannelID());
if (start != NULL)
strWhereClause.append(FormatSQL(" AND StartTime < %u", start.GetAsDBDateTime().c_str()).c_str());
if (end != NULL)
strWhereClause.append(FormatSQL(" AND EndTime > %u", end.GetAsDBDateTime().c_str()).c_str());
CStdString strQuery;
strQuery.Format("SELECT * FROM EpgData WHERE %s ORDER BY StartTime ASC\n", strWhereClause.c_str());
int iNumRows = ResultQuery(strQuery);
if (iNumRows > 0)
{
try
{
while (!m_pDS->eof())
{
int iBroadcastUid = m_pDS->fv("BroadcastUid").get_asInt();
CDateTime startTime, endTime, firstAired;
startTime.SetFromDBDateTime (m_pDS->fv("StartTime").get_asString());
endTime.SetFromDBDateTime (m_pDS->fv("EndTime").get_asString());
firstAired.SetFromDBDateTime(m_pDS->fv("FirstAired").get_asString());
CPVREpgInfoTag newTag(iBroadcastUid);
newTag.SetBroadcastId (m_pDS->fv("BroadcastId").get_asInt());
newTag.SetTitle (m_pDS->fv("Title").get_asString().c_str());
newTag.SetPlotOutline (m_pDS->fv("PlotOutline").get_asString().c_str());
newTag.SetPlot (m_pDS->fv("Plot").get_asString().c_str());
newTag.SetStart (startTime);
newTag.SetEnd (endTime);
newTag.SetGenre (m_pDS->fv("GenreType").get_asInt(),
m_pDS->fv("GenreSubType").get_asInt(),
m_pDS->fv("Genre").get_asString().c_str());
newTag.SetFirstAired (firstAired);
newTag.SetParentalRating (m_pDS->fv("ParentalRating").get_asInt());
newTag.SetStarRating (m_pDS->fv("StarRating").get_asInt());
newTag.SetNotify (m_pDS->fv("Notify").get_asBool());
newTag.SetEpisodeNum (m_pDS->fv("EpisodeId").get_asString().c_str());
newTag.SetEpisodePart (m_pDS->fv("EpisodePart").get_asString().c_str());
newTag.SetEpisodeName (m_pDS->fv("EpisodeName").get_asString().c_str());
epg->UpdateEntry(newTag, false);
m_pDS->next();
++iReturn;
}
}
catch (...)
{
CLog::Log(LOGERROR, "%s - couldn't load EPG data from the database", __FUNCTION__);
}
}
return iReturn;
}
示例9: OpenStream
bool CPVRClients::OpenStream(const CPVRRecordingPtr &channel)
{
assert(channel.get());
bool bReturn(false);
CloseStream();
/* try to open the recording stream on the client */
PVR_CLIENT client;
if (GetConnectedClient(channel->m_iClientId, client) &&
client->OpenStream(channel))
{
CSingleLock lock(m_critSection);
CDateTime endTime = channel->RecordingTimeAsLocalTime() +
CDateTimeSpan(0, 0, channel->GetDuration() / 60, channel->GetDuration() % 60);
m_bIsRecordingInProgress = (endTime > CDateTime::GetCurrentDateTime());
if (m_bIsRecordingInProgress)
CLog::Log(LOGNOTICE, "PVRClients - %s - recording is still in progress, end time = %s", __FUNCTION__, endTime.GetAsDBDateTime().c_str());
m_playingClientId = channel->m_iClientId;
m_bIsPlayingRecording = true;
m_strPlayingClientName = client->GetFriendlyName();
bReturn = true;
}
return bReturn;
}