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


C++ DBClientCursor类代码示例

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


在下文中一共展示了DBClientCursor类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cursor_has_more

/*
 * has_more = cursor:has_more(in_current_batch)
 *    pass true to call moreInCurrentBatch (mongo >=1.5)
 */
static int cursor_has_more(lua_State *L) {
    DBClientCursor *cursor = userdata_to_cursor(L, 1);

    bool in_current_batch = lua_toboolean(L, 2);
    if (in_current_batch)
        lua_pushboolean(L, cursor->moreInCurrentBatch());
    else
        lua_pushboolean(L, cursor->more());

    return 1;
}
开发者ID:pabloromeu,项目名称:luamongo,代码行数:15,代码来源:mongo_cursor.cpp

示例2: result_iterator

static int result_iterator(lua_State *L) {
    DBClientCursor *cursor = userdata_to_cursor(L, lua_upvalueindex(1));

    if (cursor->more()) {
        bson_to_lua(L, cursor->next());
    } else {
        lua_pushnil(L);
    }

    return 1;
}
开发者ID:pabloromeu,项目名称:luamongo,代码行数:11,代码来源:mongo_cursor.cpp

示例3: cursor_next

/*
 * res = cursor:next()
 */
static int cursor_next(lua_State *L) {
    DBClientCursor *cursor = userdata_to_cursor(L, 1);

    if (cursor->more()) {
        bson_to_lua(L, cursor->next());
    } else {
        lua_pushnil(L);
    }

    return 1;
}
开发者ID:pabloromeu,项目名称:luamongo,代码行数:14,代码来源:mongo_cursor.cpp

示例4: testClient3

// "./db testclient" to invoke
    void testClient3() {
        out() << "testClient()" << endl;
//	DBClientConnection c(true);
        DBClientPaired c;
        string err;
        if ( !c.connect("10.211.55.2", "1.2.3.4") ) {
//    if( !c.connect("10.211.55.2", err) ) {
            out() << "testClient: connect() failed" << endl;
        }
        else {
            // temp:
            out() << "test query returns: " << c.findOne("foo.bar", fromjson("{}")).toString() << endl;
        }
again:
        out() << "query foo.bar..." << endl;
        auto_ptr<DBClientCursor> cursor =
            c.query("foo.bar", BSONObj(), 0, 0, 0, Option_CursorTailable);
        DBClientCursor *cc = cursor.get();
        if ( cc == 0 ) {
            out() << "query() returned 0, sleeping 10 secs" << endl;
            sleepsecs(10);
            goto again;
        }
        while ( 1 ) {
            bool m;
            try {
                m = cc->more();
            } catch (AssertionException&) {
                out() << "more() asserted, sleeping 10 sec" << endl;
                goto again;
            }
            out() << "more: " << m << " dead:" << cc->isDead() << endl;
            if ( !m ) {
                if ( cc->isDead() )
                    out() << "cursor dead, stopping" << endl;
                else {
                    out() << "Sleeping 10 seconds" << endl;
                    sleepsecs(10);
                    continue;
                }
                break;
            }
            out() << cc->next().toString() << endl;
        }
    }
开发者ID:tanfulai,项目名称:mongo,代码行数:46,代码来源:dbclient.cpp

示例5: cursor_get_id

/*
 * id = cursor:get_id()
 */
static int cursor_get_id(lua_State *L) {
    DBClientCursor *cursor = userdata_to_cursor(L, 1);
    lua_pushnumber(L, cursor->getCursorId());
    return 1;
}
开发者ID:pabloromeu,项目名称:luamongo,代码行数:8,代码来源:mongo_cursor.cpp

示例6: cursor_has_result_flag

/*
 * has_result_flag = cursor:has_result_flag()
 */
static int cursor_has_result_flag(lua_State *L) {
    DBClientCursor *cursor = userdata_to_cursor(L, 1);
    int flag = lua_tointeger(L, 2);
    lua_pushboolean(L, cursor->hasResultFlag(flag));
    return 1;
}
开发者ID:pabloromeu,项目名称:luamongo,代码行数:9,代码来源:mongo_cursor.cpp

示例7: cursor_is_tailable

/*
 * is_tailable = cursor:is_tailable()
 */
static int cursor_is_tailable(lua_State *L) {
    DBClientCursor *cursor = userdata_to_cursor(L, 1);
    lua_pushboolean(L, cursor->tailable());
    return 1;
}
开发者ID:pabloromeu,项目名称:luamongo,代码行数:8,代码来源:mongo_cursor.cpp

示例8: cursor_is_dead

/*
 * is_dead = cursor:is_dead()
 */
static int cursor_is_dead(lua_State *L) {
    DBClientCursor *cursor = userdata_to_cursor(L, 1);
    lua_pushboolean(L, cursor->isDead());
    return 1;
}
开发者ID:pabloromeu,项目名称:luamongo,代码行数:8,代码来源:mongo_cursor.cpp

示例9: cursor_itcount

/*
 * it_count = cursor:itcount()
 */
static int cursor_itcount(lua_State *L) {
    DBClientCursor *cursor = userdata_to_cursor(L, 1);
    lua_pushinteger(L, cursor->itcount());
    return 1;
}
开发者ID:pabloromeu,项目名称:luamongo,代码行数:8,代码来源:mongo_cursor.cpp


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