Skip to content

Commit f53764d

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 2697 b: refs/heads/update-datastore c: e4113c4 h: refs/heads/master i: 2695: 49f34c1
1 parent 6e3247f commit f53764d

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
@@ -5,7 +5,7 @@ refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
66
refs/heads/pubsub-alpha: 1a0e970f265af871e02274085b9662b3fe29058b
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
8-
refs/heads/update-datastore: 663e54b356162b6890fd8175c9cc17a4a70dd097
8+
refs/heads/update-datastore: e4113c47155b73d5be62e387a224ac43d1b6a43a
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
1010
refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd
1111
refs/tags/v0.0.11: ffbfba48a6426ff63c08ff2117e58681f251fbf2

branches/update-datastore/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)