本文整理汇总了C++中SQLStatement::AddColumnDate方法的典型用法代码示例。如果您正苦于以下问题:C++ SQLStatement::AddColumnDate方法的具体用法?C++ SQLStatement::AddColumnDate怎么用?C++ SQLStatement::AddColumnDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLStatement
的用法示例。
在下文中一共展示了SQLStatement::AddColumnDate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
PersistentFetchAccountUID::SaveObject(shared_ptr<FetchAccountUID> pUID, String &result)
{
SQLStatement oStatement;
oStatement.SetTable("hm_fetchaccounts_uids");
oStatement.AddColumnInt64("uidfaid", pUID->GetAccountID());
oStatement.AddColumn("uidvalue", pUID->GetUID());
oStatement.AddColumnDate("uidtime", pUID->GetCreationDate());
if (pUID->GetID() == 0)
{
oStatement.SetStatementType(SQLStatement::STInsert);
oStatement.SetIdentityColumn("uidid");
}
else
{
oStatement.SetStatementType(SQLStatement::STUpdate);
oStatement.SetWhereClause(Formatter::Format("uidid = {0}", pUID->GetID()));
}
bool bNewObject = pUID->GetID() == 0;
// Save and fetch ID
__int64 iDBID = 0;
bool bRetVal = Application::Instance()->GetDBManager()->Execute(oStatement, bNewObject ? &iDBID : 0);
if (bRetVal && bNewObject)
pUID->SetID((int) iDBID);
return bRetVal;
}
示例2:
bool
PersistentIMAPFolder::SaveObject(std::shared_ptr<IMAPFolder> pFolder)
{
bool bNewObject = true;
if (pFolder->GetID())
bNewObject = false;
SQLStatement oStatement;
oStatement.SetTable("hm_imapfolders");
if (bNewObject)
{
oStatement.SetStatementType(SQLStatement::STInsert);
oStatement.SetIdentityColumn("folderid");
DateTime creationTime = pFolder->GetCreationTime();
if (pFolder->GetCreationTime().GetStatus() == DateTime::invalid)
pFolder->SetCreationTime(DateTime::GetCurrentTime());
// This column is always updated by GetUniqueMessageID below
// but we still need to create it.
oStatement.AddColumn("foldercurrentuid", pFolder->GetCurrentUID());
oStatement.AddColumnDate("foldercreationtime", pFolder->GetCreationTime());
}
else
{
oStatement.SetStatementType(SQLStatement::STUpdate);
String sWhere;
sWhere.Format(_T("folderid = %I64d"), pFolder->GetID());
oStatement.SetWhereClause(sWhere);
}
oStatement.AddColumnInt64("folderaccountid", pFolder->GetAccountID());
oStatement.AddColumnInt64("folderparentid", pFolder->GetParentFolderID());
oStatement.AddColumn("foldername", pFolder->GetFolderName());
oStatement.AddColumn("folderissubscribed", pFolder->GetIsSubscribed() ? 1 : 0);
__int64 iDBID = 0;
bool bRetVal = Application::Instance()->GetDBManager()->Execute(oStatement, bNewObject ? &iDBID : 0);
if (bRetVal && bNewObject)
pFolder->SetID((int) iDBID);
return true;
}
示例3:
bool
PersistentMessageMetaData::SaveObject(boost::shared_ptr<MessageMetaData> metaData)
{
SQLStatement statement;
statement.SetTable("hm_message_metadata");
statement.SetStatementType(SQLStatement::STInsert);
statement.SetIdentityColumn("metadata_id");
statement.AddColumn("metadata_accountid", metaData->GetAccountID());
statement.AddColumn("metadata_folderid", metaData->GetFolderID());
statement.AddColumnInt64("metadata_messageid", metaData->GetMessageID());
statement.AddColumnDate("metadata_dateutc", metaData->GetDate());
statement.AddColumn("metadata_from", metaData->GetFrom(), 100);
statement.AddColumn("metadata_subject", metaData->GetSubject(), 100);
statement.AddColumn("metadata_to", metaData->GetTo(), 100);
statement.AddColumn("metadata_cc", metaData->GetCC(), 100);
// Save and fetch ID
__int64 iDBID = 0;
bool bRetVal = Application::Instance()->GetDBManager()->Execute(statement, &iDBID);
metaData->SetID((int) iDBID);
return bRetVal;
}