本文整理汇总了C++中Nullable::deref方法的典型用法代码示例。如果您正苦于以下问题:C++ Nullable::deref方法的具体用法?C++ Nullable::deref怎么用?C++ Nullable::deref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nullable
的用法示例。
在下文中一共展示了Nullable::deref方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: db
void TestDatabase::Test2() {
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");
stmt.Execute();
int testId = 0;
std::string lastCountry;
while (stmt.FetchNextRow()) {
testId++;
Nullable<unsigned short int> countryId = stmt.GetUShortDataInRow(0);
Nullable<std::string> countryName = stmt.GetStringDataInRow(1);
Nullable<Julian> lastUpdate = stmt.GetTimeDataInRow(2);
UTASSERT(testId == (*countryId));
GregorianBreakdown gb = lastUpdate->to_gregorian(0);
UTASSERT(gb.year == 2006);
UTASSERT(gb.month == 2);
UTASSERT(gb.day == 15);
if (testId > 1) {
UTASSERT(countryName.deref() > lastCountry);
}
lastCountry = countryName.deref();
}
UTASSERT(testId == 109);
} catch (const DatabaseException &de) {
cout << de << endl;
wasCaught = true;
} catch (const UTFail &fail) {
throw;
} catch (const JulianException &je) {
cout << je.what() << endl;
wasCaught = true;
} catch (...) {
cout << "random exception caught" << endl;
wasCaught = true;
}
UTASSERT(! wasCaught);
}