本文整理汇总了C++中Nullable::to_gregorian方法的典型用法代码示例。如果您正苦于以下问题:C++ Nullable::to_gregorian方法的具体用法?C++ Nullable::to_gregorian怎么用?C++ Nullable::to_gregorian使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nullable
的用法示例。
在下文中一共展示了Nullable::to_gregorian方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: db
void TestDatabase::Test5() {
cout << __PRETTY_FUNCTION__ << endl;
bool wasCaught = false;
try {
Database db("localhost", "root", "", "sakila", 0, NULL, 0);
db.Connect();
UTASSERT(db.IsConnected());
Statement stmt(db, "SELECT * from COUNTRY where country_id = ?");
stmt << Nullable<short int>(7) << execute;
UTASSERT(stmt << fetch);
UTASSERT(! stmt.Eof());
Nullable<unsigned short int> countryId;
Nullable<std::string> countryName;
Nullable<Julian> lastUpdate;
stmt >> countryId >> countryName >> lastUpdate;
UTASSERT(7 == (*countryId));
UTASSERT(strcmp(countryName->c_str(), "Armenia") == 0);
GregorianBreakdown gb = lastUpdate->to_gregorian(0);
UTASSERT(gb.year == 2006);
UTASSERT(gb.month == 2);
UTASSERT(gb.day == 15);
stmt << reset << Nullable<short int>(8) << execute;
UTASSERT(stmt << fetch);
UTASSERT(! stmt.Eof());
stmt >> countryId >> countryName >> lastUpdate;
UTASSERT(8 == (*countryId));
UTASSERT(strcmp(countryName->c_str(), "Australia") == 0);
gb = lastUpdate->to_gregorian(0);
UTASSERT(gb.year == 2006);
UTASSERT(gb.month == 2);
UTASSERT(gb.day == 15);
} catch (const DatabaseException &de) {
cout << de << endl;
wasCaught = true;
}
UTASSERT(! wasCaught);
}