Exemplo n.º 1
0
    bool IndexCursor::fetchMoreRows() {
        // We're going to get more rows, so get rid of what's there.
        _buffer.empty();

        int r;
        const int rows_to_fetch = getf_fetch_count();
        struct cursor_getf_extra extra(&_buffer, rows_to_fetch);
        DBC *cursor = _cursor.dbc();
        if ( forward() ) {
            r = cursor->c_getf_next(cursor, getf_flags(), cursor_getf, &extra);
        } else {
            r = cursor->c_getf_prev(cursor, getf_flags(), cursor_getf, &extra);
        }
        if ( extra.ex != NULL ) {
            throw *extra.ex;
        }
        if (r == TOKUDB_INTERRUPTED) {
            _interrupt_extra.throwException();
        }
        if ( r != 0 && r != DB_NOTFOUND ) {
            extra.throwException();
            storage::handle_ydb_error(r);
        }

        _getf_iteration++;
        return extra.rows_fetched > 0 ? true : false;
    }