1
0
Fork 0

Added OperationCursor to cmake file. Fixed compile errors

This commit is contained in:
Michael Hackstein 2016-02-22 14:02:03 +01:00
parent fd9c60d651
commit ef4f3790bc
2 changed files with 8 additions and 5 deletions

View File

@ -220,6 +220,7 @@ add_executable(
Utils/Cursor.cpp
Utils/CursorRepository.cpp
Utils/DocumentHelper.cpp
Utils/OperationCursor.cpp
Utils/ShapedJsonTransformer.cpp
Utils/StandaloneTransactionContext.cpp
Utils/Transaction.cpp

View File

@ -23,6 +23,8 @@
#include "OperationCursor.h"
using namespace arangodb;
//////////////////////////////////////////////////////////////////////////////
/// @brief Get next default batchSize many elements.
/// Check hasMore()==true before using this
@ -47,16 +49,16 @@ int OperationCursor::getMore(uint64_t batchSize) {
return TRI_ERROR_FORBIDDEN;
}
// We restart the builder
_builder->clear();
_builder.clear();
VPackArrayBuilder guard(&_builder);
TRI_doc_mptr_copy_t* mptr = nullptr;
TRI_doc_mptr_t* mptr = nullptr;
// TODO: Improve this for baby awareness
while (batchSize > 0 && _limit > 0 && (mptr = _iterator->next()) != nullptr) {
while (batchSize > 0 && _limit > 0 && (mptr = _indexIterator->next()) != nullptr) {
--batchSize;
--_limit;
_builder.add(VPackSlice(mptr.vpack()));
_builder.add(VPackSlice(mptr->vpack()));
}
if (batchSize > 0 || _limit = 0) {
if (batchSize > 0 || _limit == 0) {
// Iterator empty, there is no more
_hasMore = false;
}