use of com.google.apphosting.datastore.DatastoreV3Pb.NextRequest in project appengine-java-standard by GoogleCloudPlatform.
the class RemoteApiServlet method executeRunQuery.
private byte[] executeRunQuery(Request request) {
Query queryRequest = new Query();
parseFromBytes(queryRequest, request.getRequestAsBytes());
int batchSize = Math.max(1000, queryRequest.getLimit());
queryRequest.setCount(batchSize);
QueryResult runQueryResponse = new QueryResult();
byte[] res = ApiProxy.makeSyncCall("datastore_v3", "RunQuery", request.getRequestAsBytes());
parseFromBytes(runQueryResponse, res);
if (queryRequest.hasLimit()) {
// Try to pull all results
while (runQueryResponse.isMoreResults()) {
NextRequest nextRequest = new NextRequest();
nextRequest.getMutableCursor().mergeFrom(runQueryResponse.getCursor());
nextRequest.setCount(batchSize);
byte[] nextRes = ApiProxy.makeSyncCall("datastore_v3", "Next", nextRequest.toByteArray());
parseFromBytes(runQueryResponse, nextRes);
}
}
return runQueryResponse.toByteArray();
}
use of com.google.apphosting.datastore.DatastoreV3Pb.NextRequest in project appengine-java-standard by GoogleCloudPlatform.
the class QueryResultsSourceV3 method buildNextCallPrototype.
@Override
public NextRequest buildNextCallPrototype(QueryResult initialResult) {
DatastoreV3Pb.NextRequest req = new DatastoreV3Pb.NextRequest();
req.setCursor(initialResult.getCursor());
if (initialResult.hasCompiledCursor()) {
// Compiled cursor setting should match original query.
req.setCompile(true);
}
// This used to call .freeze() but that method has been deleted, see go/javaproto1freezeremoval
return req;
}
Aggregations