public class GetAllBrowsers {
public static void runExample(DfpServices dfpServices, DfpSession session)
throws Exception {
// Get the PublisherQueryLanguageService.
PublisherQueryLanguageServiceInterface pqlService =
dfpServices.get(session, PublisherQueryLanguageServiceInterface.class);
// Create statement to select all browsers.
StatementBuilder statementBuilder = new StatementBuilder()
.select("Id, BrowserName, MajorVersion, MinorVersion")
.from("Browser")
.orderBy("BrowserName ASC")
.offset(0)
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for result sets.
ResultSet combinedResultSet = null;
ResultSet resultSet;
int i = 0;
do {
// Get all browsers.
resultSet = pqlService.select(statementBuilder.toStatement());
// Combine result sets with previous ones.
combinedResultSet = combinedResultSet == null
? resultSet
: Pql.combineResultSets(combinedResultSet, resultSet);