Exporting data
Exporting (or formatting) data is achievable via the org.jooq.Formattable
API. jOOQ exposes a suite of format()
and formatFoo()
methods that can be used to format Result
and Cursor
(remember fetchLazy()
from Chapter 8, Fetching and Mapping) as text, JSON, XML, CSV, XML, charts, and INSERT
statements. As you can see in the documentation, all these methods come in different flavors capable of exporting data into a string or a file via the Java OutputStream
or Writer
APIs.
Exporting as text
I'm sure that you have already seen in your console output something similar to the following:
This textual tabular representation can be achieved via the format()
method. A flavor of this method takes an integer argument representing the maximum number of records to include in the formatted result (by default, jOOQ logs just the first five records of the result formatted via jOOQ's text export, but we can...