本文整理汇总了C++中DataStore::shutdown方法的典型用法代码示例。如果您正苦于以下问题:C++ DataStore::shutdown方法的具体用法?C++ DataStore::shutdown怎么用?C++ DataStore::shutdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataStore
的用法示例。
在下文中一共展示了DataStore::shutdown方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
return 1;
}
cout << "b\n";
// Connect as the guest user.
Session* session = dataStore.connect(0);
if(!session)
{
cerr << "DataStore.connect(0) failed\n";
return 1;
}
cout << "c\n";
// Get a query object.
Query* query = session->newQuery();
if(!query)
{
cerr << "Session.newQuery failed\n";
return 1;
}
cout << "d\n";
query->setQuery("INSERT INTO object VALUES (0,1,'2005-10-26', '2005-10-26', 'This is test data.');");
if(query->execute() < 0)
{
cout << "Failed to execute INSERT query.\n";
return 1;
}
cout << "e\n";
// Reuse the query object.
query->setQuery("SELECT data FROM object");
if(query->execute() < 0)
{
cout << "Failed to execute SELECT query.\n";
return 1;
}
cout << "f\n";
// Save the results of the query.
if(query->saveResults() < 0)
{
cout << "Failed to save query results.\n";
}
cout << "g\n";
string xml;
// Retrieve the results as xml.
TableVec* results = query->getResults();
TableVec::iterator i = results->begin();
while(i != results->end())
{
if((*i)->getAsXml(xml) < 0)
{
cout << "Failed to get results.\n";
}
cout << "Result\n------\n";
cout << xml.c_str() << endl;
i++;
}
cout << endl;
cout << "h\n";
// Reuse the query again to delete what was added.
query->setQuery("DELETE FROM object WHERE ID>0");
if(query->execute() < 0)
{
cout << "Failed to execute DELETE query.\n";
return 1;
}
cout << "i\n";
// Delete the objects.
delete query;
cout << "j\n";
// Disconnect the session.
dataStore.disconnect(session);
cout << "k\n";
dataStore.shutdown();
cout << "l\n";
return 0;
}