Hi App Engine team,

the Cursor stores the full state of a prepared query to check if it
matches the query when applied and raise an exception if this is not
the case. Now the usual use case is that during a paging operation the
cursor is transferred between client (e.g HTML page, JSP, ...) and
server. The server restores the cursor from the string encoding and
applies it to the PreparedQuery.

As the server is stateless the server side needs to restore the
prepared query somehow either by caching it somewhere or by
reconstructing it from the application context (I take the
reconstruction approach)

Now I wonder if you could avoid caching/reconstructing the query if
you have the cursor, because apparently the cursor contains the full
state of the query. Wouldn't it be a trivial change in the API of the
SDK to introduce a method on the Cursor class like:

PreparedQuery getQuery()

Then you could have on the server have code like this:

Cursor decodedCursor = Cursor.fromWebSafeString(encodedCursor);
PreparedQuery preparedQuery = decodedCursor.getPreparedQuery();
List nextBatch =
preparedQuery.asQueryResultList(withLimit(20).cursor(decoded));

Not sure if I missed something but this seems to be trivial and it
would give so much convenience...

Comments?

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to