You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DatabaseMetaData.getProcedures(...)</a>, there is no SQL or JDBC Statement to use to set a limit, the ResultSet class does not have an API to limit rows.
352
+
</p>
353
+
<p>
354
+
To simplify limiting ResultSet rows, Commons CVS offers the <ahref="org/apache/commons/csv/CSVFormat.Builder.html#setMaxRows(long)">CSVFormat.Builder.setMaxRows(long)</a>
355
+
method. For example:
356
+
</p>
357
+
<pre>
358
+
<code>
359
+
CSVFormat csvFormat = CSVFormat.DEFAULT
360
+
.setMaxRows(5_000)
361
+
.get();
362
+
try (ResultSet resultSet = ...) {
363
+
csvFormat.printer().printRecords(resultSet);
364
+
}
365
+
</code>
366
+
</pre>
367
+
<p>
368
+
Using the above, calling <ahref="org/apache/commons/csv/CSVPrinter.html#printRecords(java.sql.ResultSet)">CSVPrinter.printRecords(ResultSet)</a> will
369
+
limit the row count to the maximum number of rows specified in setMaxRows().
370
+
</p>
371
+
<p>Note that setMaxRows() works with the other methods that print a sequence of records.</p>
0 commit comments