本文整理汇总了C++中SQLiteDatabase::start方法的典型用法代码示例。如果您正苦于以下问题:C++ SQLiteDatabase::start方法的具体用法?C++ SQLiteDatabase::start怎么用?C++ SQLiteDatabase::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLiteDatabase
的用法示例。
在下文中一共展示了SQLiteDatabase::start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
SQLiteDatabase* db = new SQLiteDatabase(10,"aocemu.db");
db->start();
SQLiteQuery* q = new SQLiteQuery(Query::WORKER_THREAD,Query::HAS_RESULT);
q->setQueryText("SELECT * FROM auth");
q->setCallbackFunction(boost::bind(&dummyFunction, q));
SQLiteQuery* q2 = new SQLiteQuery(boost::bind(&dummyFunction, q2),Query::WORKER_THREAD,Query::HAS_RESULT);
q2->setQueryText("SELECT * FROM auth");
q2->setCallbackFunction(boost::bind(&dummyFunction, q2));
SQLiteQuery* q3 = new SQLiteQuery(boost::bind(&secondDummyFunction, q3),Query::MAIN_THREAD,Query::HAS_RESULT);
q3->setQueryText("SELECT * FROM auth");
q3->setCallbackFunction(boost::bind(&dummyFunction, q3));
SQLiteQuery* q4 = new SQLiteQuery(boost::bind(&secondDummyFunction, q4),Query::MAIN_THREAD,Query::HAS_RESULT);
q4->setQueryText("SELECT * FROM auth");
q4->setCallbackFunction(boost::bind(&dummyFunction, q4));
SQLiteQuery* q5 = new SQLiteQuery(boost::bind(&secondDummyFunction, q5),Query::MAIN_THREAD,Query::HAS_RESULT);
q5->setQueryText("SELECT * FROM auth");
q5->setCallbackFunction(boost::bind(&dummyFunction, q5));
SQLiteQuery* q6 = new SQLiteQuery(boost::bind(&dummyFunction, q6),Query::WORKER_THREAD,Query::HAS_RESULT);
q6->setQueryText("SELECT * FROM auth");
q6->setCallbackFunction(boost::bind(&dummyFunction, q6));
SQLiteQuery* q7 = new SQLiteQuery(boost::bind(&dummyFunction, q7),Query::WORKER_THREAD,Query::HAS_RESULT);
q7->setQueryText("SELECT * FROM auth");
q7->setCallbackFunction(boost::bind(&dummyFunction, q7));
SQLiteQuery* q8 = new SQLiteQuery(boost::bind(&dummyFunction, q8),Query::WORKER_THREAD,Query::HAS_RESULT);
q8->setQueryText("SELECT * FROM auth");
q8->setCallbackFunction(boost::bind(&dummyFunction, q8));
db->enqueueQuery(q);
db->enqueueQuery(q2);
db->enqueueQuery(q3);
db->enqueueQuery(q4);
db->enqueueQuery(q5);
db->enqueueQuery(q6);
db->enqueueQuery(q7);
db->enqueueQuery(q8);
std::cout << "available connection : " << db->availableDBConnection() << std::endl;
db->runFinishedQueryCallback();
boost::xtime sleepA;
boost::xtime_get(&sleepA, boost::TIME_UTC);
sleepA.sec += 1;
boost::thread::sleep(sleepA);
db->runFinishedQueryCallback();
std::cout << "available connection : " << db->availableDBConnection() << std::endl;
db->shutdown();
delete db;
return 0;
}