Treat a limit of 0 as requesting no results
Previously, this would treat a limit of 0 as an unlimited query.
@@ -486,7 +486,7 @@ class DatastoreDistributed(apiproxy_stub.APIProxyStub):
del self.__queries[cursor_handle]
return
- if query.limit() and internal_cursor.get_offset() >= query.limit():
+ if query.has_limit() and internal_cursor.get_offset() >= query.limit():
query_result.set_more_results(False)
query_result.mutable_compiled_cursor().CopyFrom(last_cursor)
if next_request.compile():
@@ -496,7 +496,7 @@ class DatastoreDistributed(apiproxy_stub.APIProxyStub):
del self.__queries[cursor_handle]
return
- if query.limit():
+ if query.has_limit():
max_remaining_results = query.limit() - internal_cursor.get_offset()
else:
max_remaining_results = sys.maxint
