Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4e153f5

Browse files
authoredMay 26, 2022
docs(samples): update querypagination sample (#2074)
- Updated example to loop through all remaining pages Changes for the open issue: #2073
1 parent 621d357 commit 4e153f5

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed
 

‎samples/snippets/src/main/java/com/example/bigquery/QueryPagination.java

+3-11
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,11 @@ public static void queryPagination(String datasetName, String tableName, String
6262
.getValues()
6363
.forEach(row -> row.forEach(val -> System.out.printf("%s,\n", val.toString())));
6464

65-
if (results.hasNextPage()) {
66-
// Next Page
67-
results
68-
.getNextPage()
69-
.getValues()
70-
.forEach(row -> row.forEach(val -> System.out.printf("%s,\n", val.toString())));
71-
}
72-
73-
if (results.hasNextPage()) {
65+
while (results.hasNextPage()) {
7466
// Remaining Pages
67+
results = results.getNextPage();
7568
results
76-
.getNextPage()
77-
.iterateAll()
69+
.getValues()
7870
.forEach(row -> row.forEach(val -> System.out.printf("%s,\n", val.toString())));
7971
}
8072

0 commit comments

Comments
 (0)
Failed to load comments.