Skip to content

Commit 9b4f3ec

Browse files
authored
docs(samples): update querypagination sample (#1209)
Based on feedback from a support case, I've made some changes to make this more clear and more accurate to what the comments indicate Created #1207 to track this Fixes #1207 ☕️
1 parent 2918a5b commit 9b4f3ec

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,23 @@ public static void queryPagination(String datasetName, String tableName, String
5959

6060
// First Page
6161
results
62-
.iterateAll()
63-
.forEach(row -> row.forEach(val -> System.out.printf("%s,", val.toString())));
62+
.getValues()
63+
.forEach(row -> row.forEach(val -> System.out.printf("%s,\n", val.toString())));
6464

6565
if (results.hasNextPage()) {
6666
// 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()) {
74+
// Remaining Pages
6775
results
6876
.getNextPage()
6977
.iterateAll()
70-
.forEach(row -> row.forEach(val -> System.out.printf("%s,", val.toString())));
78+
.forEach(row -> row.forEach(val -> System.out.printf("%s,\n", val.toString())));
7179
}
7280

7381
System.out.println("Query pagination performed successfully.");

0 commit comments

Comments
 (0)