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


C++ DataStore::shutdown方法代码示例

本文整理汇总了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;
}
开发者ID:sdetwiler,项目名称:pammo,代码行数:101,代码来源:ds.cpp


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