Topic by Adam
Content
The documentation describes the following:
Paging
...
If the number of items or rows exceeds the maximum when the query results are executed, only the maximum number will be returned. In the case of QueryObjects, the response includes a Paging object that will contain the number of objects returned and a query handle field. This query handle will only be non-null if there were more results generated by the query than can be returned.
To handle paging, a query should be constructed that permits unique ordering of the results through the use of "ORDER BY" on the appropriate fields (typically by the primary key or the UpdatedTime field and the primary key of the object). These fields must be returned in the query. After the query is run the first 10,000 rows are returned and the query handle is returned indicating that more rows are available. Note the value of the last row for the fields used to order the query. Use the value(s) returned in the last row to construct a new query with the same structure but add to the "WHERE" clause a sub-clause to ensure that the next row returned will be after the value(s) just returned. For example, if only the primary key (typically ID) is used, then add "WHERE ID > abc" where "abc" was the value returned in the last row of the previous query. If two fields are used (e.g. UpdatedTime and ID in that order) then add "WHERE UpdatedTime >= 'def' AND ID > abc". Note the greater-than or equal for all the fields used except for the last which is just greater than.
Yet I've been completely unable to access the Paging object thus far. I've executed a query that (easily) hits the internal limit. A $rs->count() returns 10000, thus confirming. What am I missing? Could someone provide a quick usage scenario? Thanks.