public interface Formattable
This type provides a common interface for Result
and Cursor
formatting functionality, which includes formatting results to:
Calling formatting methods on a Result
is repeatable as the
Result
has been previously materialised in memory and the database
resource is closed. Calling these methods on a Cursor
is not
repeatable as the Cursor
(and the underlying JDBC ResultSet
)
is consumed entirely, and closed eagerly after consumption.
Modifier and Type | Method and Description |
---|---|
String |
format()
Get a simple formatted representation of this result.
|
String |
format(int maxRecords)
Get a simple formatted representation of this result.
|
void |
format(OutputStream stream)
Like
format() , but the data is output onto an OutputStream . |
void |
format(OutputStream stream,
int maxRecords)
Like
format(int) , but the data is output onto an OutputStream . |
void |
format(OutputStream stream,
TXTFormat format)
Like
format(TXTFormat) , but the data is output onto an OutputStream . |
String |
format(TXTFormat format)
Get a simple formatted representation of this result.
|
void |
format(Writer writer)
|
void |
format(Writer writer,
int maxRecords)
Like
format(int) , but the data is output onto a Writer . |
void |
format(Writer writer,
TXTFormat format)
Like
format(TXTFormat) , but the data is output onto a Writer . |
String |
formatChart() |
String |
formatChart(ChartFormat format) |
void |
formatChart(OutputStream stream)
Like
formatChart() , but the data is output onto an OutputStream . |
void |
formatChart(OutputStream stream,
ChartFormat format)
Like
formatChart(ChartFormat) , but the data is output onto an OutputStream . |
void |
formatChart(Writer writer)
Like
formatChart() , but the data is output onto a Writer . |
void |
formatChart(Writer writer,
ChartFormat format)
Like
formatChart(ChartFormat) , but the data is output onto a Writer . |
String |
formatCSV()
Get a simple formatted representation of this result as CSV.
|
String |
formatCSV(boolean header)
Get a simple formatted representation of this result as CSV.
|
String |
formatCSV(boolean header,
char delimiter)
Get a simple formatted representation of this result as CSV.
|
String |
formatCSV(boolean header,
char delimiter,
String nullString)
Get a simple formatted representation of this result as CSV.
|
String |
formatCSV(char delimiter)
Get a simple formatted representation of this result as CSV.
|
String |
formatCSV(char delimiter,
String nullString)
Get a simple formatted representation of this result as CSV.
|
String |
formatCSV(CSVFormat format)
Get a simple formatted representation of this result as CSV.
|
void |
formatCSV(OutputStream stream)
Like
formatCSV() , but the data is output onto an OutputStream . |
void |
formatCSV(OutputStream stream,
boolean header)
Like
formatCSV(boolean) , but the data is output onto an OutputStream . |
void |
formatCSV(OutputStream stream,
boolean header,
char delimiter)
Like
formatCSV(boolean, char) , but the data is output onto an OutputStream . |
void |
formatCSV(OutputStream stream,
boolean header,
char delimiter,
String nullString)
Like
formatCSV(boolean, char, String) , but the data is output onto an OutputStream . |
void |
formatCSV(OutputStream stream,
char delimiter)
Like
formatCSV(char) , but the data is output onto an OutputStream . |
void |
formatCSV(OutputStream stream,
char delimiter,
String nullString)
Like
formatCSV(char, String) , but the data is output onto an OutputStream . |
void |
formatCSV(OutputStream stream,
CSVFormat format)
Like
formatCSV(CSVFormat) , but the data is output onto an OutputStream . |
void |
formatCSV(Writer writer)
Like
formatCSV() , but the data is output onto a Writer . |
void |
formatCSV(Writer writer,
boolean header)
Like
formatCSV(boolean) , but the data is output onto a Writer . |
void |
formatCSV(Writer writer,
boolean header,
char delimiter)
Like
formatCSV(boolean, char) , but the data is output onto a Writer . |
void |
formatCSV(Writer writer,
boolean header,
char delimiter,
String nullString)
Like
formatCSV(boolean, char, String) , but the data is output onto a Writer . |
void |
formatCSV(Writer writer,
char delimiter)
Like
formatCSV(char) , but the data is output onto a Writer . |
void |
formatCSV(Writer writer,
char delimiter,
String nullString)
Like
formatCSV(char, String) , but the data is output onto a Writer . |
void |
formatCSV(Writer writer,
CSVFormat format)
Like
formatCSV(CSVFormat) , but the data is output onto a Writer . |
String |
formatHTML()
Get a simple formatted representation of this result as HTML.
|
void |
formatHTML(OutputStream stream)
Like
formatHTML() , but the data is output onto an OutputStream . |
void |
formatHTML(Writer writer)
Like
formatHTML() , but the data is output onto a Writer . |
String |
formatInsert()
Get this result as a set of
INSERT statements. |
void |
formatInsert(OutputStream stream)
Like
formatInsert() , but the data is output onto an OutputStream . |
void |
formatInsert(OutputStream stream,
Table<?> table,
Field<?>... fields)
Like
formatInsert(Table, Field...) , but the data is output onto an OutputStream . |
String |
formatInsert(Table<?> table,
Field<?>... fields)
Get this result as a set of
INSERT statements. |
void |
formatInsert(Writer writer)
Like
formatInsert() , but the data is output onto a Writer . |
void |
formatInsert(Writer writer,
Table<?> table,
Field<?>... fields)
Like
formatInsert(Table, Field...) , but the data is output onto an Writer . |
String |
formatJSON()
Get a simple formatted representation of this result as a JSON array of
array.
|
String |
formatJSON(JSONFormat format)
Get a simple formatted representation of this result as a JSON data
structure, according to the format.
|
void |
formatJSON(OutputStream stream)
Like
formatJSON() , but the data is output onto an OutputStream . |
void |
formatJSON(OutputStream stream,
JSONFormat format)
Like
formatJSON(JSONFormat) , but the data is output onto an OutputStream . |
void |
formatJSON(Writer writer)
Like
formatJSON() , but the data is output onto a Writer . |
void |
formatJSON(Writer writer,
JSONFormat format)
Like
formatJSON(JSONFormat) , but the data is output onto a Writer . |
String |
formatXML()
Get this result formatted as XML.
|
void |
formatXML(OutputStream stream)
Like
formatXML() , but the data is output onto an OutputStream . |
void |
formatXML(OutputStream stream,
XMLFormat format)
Like
formatXML(XMLFormat) , but the data is output onto an OutputStream . |
void |
formatXML(Writer writer)
Like
formatXML() , but the data is output onto a Writer . |
void |
formatXML(Writer writer,
XMLFormat format)
Like
formatXML(XMLFormat) , but the data is output onto a Writer . |
String |
formatXML(XMLFormat format)
Get this result formatted as XML.
|
Document |
intoXML()
Get this result as XML.
|
<H extends ContentHandler> |
intoXML(H handler)
Get this result as XML using a SAX
ContentHandler . |
<H extends ContentHandler> |
intoXML(H handler,
XMLFormat format)
Get this result as XML using a SAX
ContentHandler . |
Document |
intoXML(XMLFormat format)
Get this result as XML.
|
String format()
This is the same as calling format(int)
with
maxRows = Integer.MAX_VALUE
String format(int maxRecords)
maxRecords
- The maximum number of records to include in the
formatted resultString format(TXTFormat format)
format
- The formatting informationString formatHTML()
The HTML code is formatted as follows:
<table>
<thead>
<tr>
<th>field-1</th>
<th>field-2</th>
...
<th>field-n</th>
</tr>
</thead>
<tbody>
<tr>
<th>value-1-1</th>
<th>value-1-2</th>
...
<th>value-1-n</th>
</tr>
<tr>
<th>value-2-1</th>
<th>value-2-2</th>
...
<th>value-2-n</th>
</tr>
...
</tbody>
</table>
String formatCSV()
This is the same as calling formatCSV(true, ',', "")
String formatCSV(char delimiter)
This is the same as calling formatCSV(true, delimiter, "")
delimiter
- The delimiter to use between recordsString formatCSV(char delimiter, String nullString)
This is the same as calling formatCSV(true, delimiter, nullString)
delimiter
- The delimiter to use between recordsnullString
- A special string for encoding NULL
values.String formatCSV(boolean header)
This is the same as calling formatCSV(',', "")
header
- Whether to emit a CSV header lineString formatCSV(boolean header, char delimiter)
This is the same as calling formatCSV(delimiter, "")
header
- Whether to emit a CSV header linedelimiter
- The delimiter to use between recordsString formatCSV(boolean header, char delimiter, String nullString)
header
- Whether to emit a CSV header linedelimiter
- The delimiter to use between recordsnullString
- A special string for encoding NULL
values.String formatCSV(CSVFormat format)
String formatJSON()
The format is the following:
{"fields":[{"name":"field-1","type":"type-1"},
{"name":"field-2","type":"type-2"},
...,
{"name":"field-n","type":"type-n"}],
"records":[[value-1-1,value-1-2,...,value-1-n],
[value-2-1,value-2-2,...,value-2-n]]}
String formatJSON(JSONFormat format)
JSONFormat
String formatXML()
String formatChart()
String formatChart(ChartFormat format)
String formatInsert()
INSERT
statements.
This uses the the first record's TableRecord.getTable()
, if the
first record is a TableRecord
. Otherwise, this generates
INSERT
statements into an "UNKNOWN_TABLE"
. In
both cases, the Result.fields()
are used for column names.
String formatInsert(Table<?> table, Field<?>... fields)
INSERT
statements.
This explicitly specifies the table (and optionally the fields) to insert
into. If the fields
argument is left empty, the
Result.fields()
are used, instead.
void format(OutputStream stream) throws IOException
format()
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void format(OutputStream stream, int maxRecords) throws IOException
format(int)
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void format(OutputStream stream, TXTFormat format) throws IOException
format(TXTFormat)
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatHTML(OutputStream stream) throws IOException
formatHTML()
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(OutputStream stream) throws IOException
formatCSV()
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(OutputStream stream, char delimiter) throws IOException
formatCSV(char)
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(OutputStream stream, char delimiter, String nullString) throws IOException
formatCSV(char, String)
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(OutputStream stream, boolean header) throws IOException
formatCSV(boolean)
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(OutputStream stream, boolean header, char delimiter) throws IOException
formatCSV(boolean, char)
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(OutputStream stream, boolean header, char delimiter, String nullString) throws IOException
formatCSV(boolean, char, String)
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(OutputStream stream, CSVFormat format) throws IOException
formatCSV(CSVFormat)
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatJSON(OutputStream stream) throws IOException
formatJSON()
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatJSON(OutputStream stream, JSONFormat format) throws IOException
formatJSON(JSONFormat)
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatXML(OutputStream stream) throws IOException
formatXML()
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatXML(OutputStream stream, XMLFormat format) throws IOException
formatXML(XMLFormat)
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatChart(OutputStream stream) throws IOException
formatChart()
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatChart(OutputStream stream, ChartFormat format) throws IOException
formatChart(ChartFormat)
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatInsert(OutputStream stream) throws IOException
formatInsert()
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatInsert(OutputStream stream, Table<?> table, Field<?>... fields) throws IOException
formatInsert(Table, Field...)
, but the data is output onto an OutputStream
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void format(Writer writer) throws IOException
IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void format(Writer writer, int maxRecords) throws IOException
format(int)
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void format(Writer writer, TXTFormat format) throws IOException
format(TXTFormat)
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatHTML(Writer writer) throws IOException
formatHTML()
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(Writer writer) throws IOException
formatCSV()
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(Writer writer, char delimiter) throws IOException
formatCSV(char)
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(Writer writer, char delimiter, String nullString) throws IOException
formatCSV(char, String)
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(Writer writer, boolean header) throws IOException
formatCSV(boolean)
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(Writer writer, boolean header, char delimiter) throws IOException
formatCSV(boolean, char)
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(Writer writer, boolean header, char delimiter, String nullString) throws IOException
formatCSV(boolean, char, String)
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatCSV(Writer writer, CSVFormat format) throws IOException
formatCSV(CSVFormat)
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatJSON(Writer writer) throws IOException
formatJSON()
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatJSON(Writer writer, JSONFormat format) throws IOException
formatJSON(JSONFormat)
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatXML(Writer writer) throws IOException
formatXML()
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatXML(Writer writer, XMLFormat format) throws IOException
formatXML(XMLFormat)
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatChart(Writer writer) throws IOException
formatChart()
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatChart(Writer writer, ChartFormat format) throws IOException
formatChart(ChartFormat)
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatInsert(Writer writer) throws IOException
formatInsert()
, but the data is output onto a Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.void formatInsert(Writer writer, Table<?> table, Field<?>... fields) throws IOException
formatInsert(Table, Field...)
, but the data is output onto an Writer
.IOException
- - an unchecked wrapper for IOException
, if anything goes wrong.Document intoXML()
<H extends ContentHandler> H intoXML(H handler) throws SAXException
ContentHandler
.handler
- The custom content handler.SAXException
formatXML()
,
http://www.jooq.org/xsd/jooq-export-3.10.0.xsd<H extends ContentHandler> H intoXML(H handler, XMLFormat format) throws SAXException
ContentHandler
.handler
- The custom content handler.SAXException
formatXML()
,
http://www.jooq.org/xsd/jooq-export-3.10.0.xsdCopyright © 2019. All rights reserved.