Skip to content

Commit 7295b88

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 1567 b: refs/heads/master c: e4113c4 h: refs/heads/master i: 1565: 0fe9c49 1563: 84f87ae 1559: 107ad49 1551: 2614531 1535: fb7aac1
1 parent 12696e0 commit 7295b88

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 663e54b356162b6890fd8175c9cc17a4a70dd097
2+
refs/heads/master: e4113c47155b73d5be62e387a224ac43d1b6a43a
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: d1b373c30c176edc08692348167bec3a244bb823
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3

trunk/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/QueryResultsImpl.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.google.common.base.Preconditions;
2222
import com.google.common.collect.AbstractIterator;
2323
import com.google.gcloud.datastore.Query.ResultType;
24+
import com.google.protobuf.ByteString;
2425

2526
import java.util.Iterator;
2627
import java.util.Objects;
@@ -36,7 +37,7 @@ class QueryResultsImpl<T> extends AbstractIterator<T> implements QueryResults<T>
3637
private DatastoreV1.QueryResultBatch queryResultBatchPb;
3738
private boolean lastBatch;
3839
private Iterator<DatastoreV1.EntityResult> entityResultPbIter;
39-
//private ByteString cursor; // only available in v1beta3
40+
private ByteString cursor; // only available in v1beta3
4041

4142

4243
QueryResultsImpl(DatastoreImpl datastore, DatastoreV1.ReadOptions readOptionsPb,
@@ -83,6 +84,7 @@ protected T computeNext() {
8384
sendRequest();
8485
}
8586
if (!entityResultPbIter.hasNext()) {
87+
cursor = queryResultBatchPb.getEndCursor();
8688
return endOfData();
8789
}
8890
DatastoreV1.EntityResult entityResultPb = entityResultPbIter.next();
@@ -99,10 +101,7 @@ public Class<?> resultClass() {
99101

100102
@Override
101103
public Cursor cursorAfter() {
104+
return cursor == null ? null : new Cursor(cursor);
102105
//return new Cursor(cursor); // only available in v1beta3
103-
if (!hasNext()) {
104-
return new Cursor(queryResultBatchPb.getEndCursor());
105-
}
106-
return null;
107106
}
108107
}

0 commit comments

Comments
 (0)