当前位置: 首页>>代码示例>>C++>>正文


C++ SQLiteDatabase::enqueueQuery方法代码示例

本文整理汇总了C++中SQLiteDatabase::enqueueQuery方法的典型用法代码示例。如果您正苦于以下问题:C++ SQLiteDatabase::enqueueQuery方法的具体用法?C++ SQLiteDatabase::enqueueQuery怎么用?C++ SQLiteDatabase::enqueueQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLiteDatabase的用法示例。


在下文中一共展示了SQLiteDatabase::enqueueQuery方法的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;
}
开发者ID:vipuldivyanshu92,项目名称:Projects,代码行数:59,代码来源:sqliteTest.cpp


注:本文中的SQLiteDatabase::enqueueQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。