本文整理汇总了C++中DateTime::GetStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ DateTime::GetStatus方法的具体用法?C++ DateTime::GetStatus怎么用?C++ DateTime::GetStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTime
的用法示例。
在下文中一共展示了DateTime::GetStatus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
PersistentSecurityRange::SaveObject(shared_ptr<SecurityRange> pSR, String &result)
{
if (!Validate(pSR, result))
return false;
DateTime rangeExpiresTime = pSR->GetExpiresTime();
if (rangeExpiresTime.GetStatus() != DateTime::valid)
rangeExpiresTime.SetDateTime(2001,01,01,0,0,0);
String name = pSR->GetName();
if (name.GetLength() > 100)
name = name.Mid(0, 100);
IPAddressSQLHelper helper;
SQLStatement oStatement;
oStatement.SetTable("hm_securityranges");
oStatement.AddColumn("rangename", name);
oStatement.AddColumn("rangepriorityid", pSR->GetPriority());
helper.AppendStatement(oStatement, pSR->GetLowerIP(), "rangelowerip1", "rangelowerip2");
helper.AppendStatement(oStatement, pSR->GetUpperIP(), "rangeupperip1", "rangeupperip2");
oStatement.AddColumn("rangeoptions", pSR->GetOptions());
oStatement.AddColumn("rangeexpires", pSR->GetExpires());
oStatement.AddColumn("rangeexpirestime", Time::GetTimeStampFromDateTime(rangeExpiresTime));
if (pSR->GetID() == 0)
{
oStatement.SetStatementType(SQLStatement::STInsert);
oStatement.SetIdentityColumn("rangeid");
}
else
{
oStatement.SetStatementType(SQLStatement::STUpdate);
String sWhere;
sWhere.Format(_T("rangeid = %I64d"), pSR->GetID());
oStatement.SetWhereClause(sWhere);
}
bool bNewObject = pSR->GetID() == 0;
// Save and fetch ID
__int64 iDBID = 0;
bool bRetVal = Application::Instance()->GetDBManager()->Execute(oStatement, bNewObject ? &iDBID : 0);
if (bRetVal && bNewObject)
pSR->SetID((int) iDBID);
if (!bRetVal)
result = "Failed to save. Please see the hMailServer error log for details.";
return bRetVal;
}
示例2: DoubleFromDate
DateTimeSpan DateTime::operator-(const DateTime& date) const
{
DateTimeSpan spanResult;
// If either operand NULL, result NULL
if (GetStatus() == null || date.GetStatus() == null)
{
spanResult.SetStatus(DateTimeSpan::null);
return spanResult;
}
// If either operand invalid, result invalid
if (GetStatus() == invalid || date.GetStatus() == invalid)
{
spanResult.SetStatus(DateTimeSpan::invalid);
return spanResult;
}
// Return result (span can't be invalid, so don't check range)
return DoubleFromDate(dt_) - DoubleFromDate(date.dt_);
}
示例3:
void
SQLStatement::AddColumnDate(const String &sName, const DateTime & dtValue)
{
String value = Time::GetTimeStampFromDateTime(dtValue);
Column p;
p.sName = sName;
// If the date is older than 1800, don't store it. This is to solve
// limitations in SQL Server.
if (dtValue.GetStatus() == DateTime::invalid || dtValue.GetYear() < 1800)
{
p.iType = ColTypeRaw;
p.sString = "NULL";
}
else
{
p.iType = ColTypeString;
p.sString = value;
}
vecColumns.push_back(p);
}