- All Known Subinterfaces:
ArrayRecord<E>,AssociativeArrayRecord<K,,V> Cursor<R>,EmbeddableRecord<R>,QualifiedRecord<R>,Record,Record1<T1>,Record10<T1,,T2, T3, T4, T5, T6, T7, T8, T9, T10> Record11<T1,,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Record12<T1,,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Record13<T1,,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Record14<T1,,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Record15<T1,,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Record16<T1,,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Record17<T1,,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> Record18<T1,,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> Record19<T1,,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> Record2<T1,,T2> Record20<T1,,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> Record21<T1,,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> Record22<T1,,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> Record3<T1,,T2, T3> Record4<T1,,T2, T3, T4> Record5<T1,,T2, T3, T4, T5> Record6<T1,,T2, T3, T4, T5, T6> Record7<T1,,T2, T3, T4, T5, T6, T7> Record8<T1,,T2, T3, T4, T5, T6, T7, T8> Record9<T1,,T2, T3, T4, T5, T6, T7, T8, T9> Result<R>,TableRecord<R>,UDTRecord<R>,UpdatableRecord<R>
- All Known Implementing Classes:
ArrayRecordImpl,AssociativeArrayRecordImpl,CustomRecord,DefaultBinding.SdoElemInfoArray,DefaultBinding.SdoGeometryRecord,DefaultBinding.SdoOrdinateArray,DefaultBinding.SdoPointTypeRecord,EmbeddableRecordImpl,TableRecordImpl,UDTRecordImpl,UpdatableRecordImpl
This type provides a common interface for Result and Cursor
formatting functionality, which includes formatting results to:
- Charts
- CSV
- HTML
- INSERT statements
- JSON
- Text
- XML
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.
- Author:
- Lukas Eder
-
Method Summary
Modifier and TypeMethodDescription@NotNull Stringformat()Get a simple formatted representation of this result.@NotNull Stringformat(int maxRecords) Get a simple formatted representation of this result.voidformat(OutputStream stream) Likeformat(), but the data is output onto anOutputStream.voidformat(OutputStream stream, int maxRecords) Likeformat(int), but the data is output onto anOutputStream.voidformat(OutputStream stream, TXTFormat format) Likeformat(TXTFormat), but the data is output onto anOutputStream.voidvoidLikeformat(int), but the data is output onto aWriter.voidLikeformat(TXTFormat), but the data is output onto aWriter.@NotNull StringGet a simple formatted representation of this result.@NotNull StringGet this result as an ASCII chart.voidformatChart(OutputStream stream) LikeformatChart(), but the data is output onto anOutputStream.voidformatChart(OutputStream stream, ChartFormat format) LikeformatChart(ChartFormat), but the data is output onto anOutputStream.voidformatChart(Writer writer) LikeformatChart(), but the data is output onto aWriter.voidformatChart(Writer writer, ChartFormat format) LikeformatChart(ChartFormat), but the data is output onto aWriter.@NotNull StringformatChart(ChartFormat format) Get this result as an ASCII chart.@NotNull StringGet a simple formatted representation of this result as CSV.@NotNull StringformatCSV(boolean header) Get a simple formatted representation of this result as CSV.@NotNull StringformatCSV(boolean header, char delimiter) Get a simple formatted representation of this result as CSV.@NotNull StringGet a simple formatted representation of this result as CSV.@NotNull StringformatCSV(char delimiter) Get a simple formatted representation of this result as CSV.@NotNull StringGet a simple formatted representation of this result as CSV.voidformatCSV(OutputStream stream) LikeformatCSV(), but the data is output onto anOutputStream.voidformatCSV(OutputStream stream, boolean header) LikeformatCSV(boolean), but the data is output onto anOutputStream.voidformatCSV(OutputStream stream, boolean header, char delimiter) LikeformatCSV(boolean, char), but the data is output onto anOutputStream.voidformatCSV(OutputStream stream, boolean header, char delimiter, String nullString) LikeformatCSV(boolean, char, String), but the data is output onto anOutputStream.voidformatCSV(OutputStream stream, char delimiter) LikeformatCSV(char), but the data is output onto anOutputStream.voidformatCSV(OutputStream stream, char delimiter, String nullString) LikeformatCSV(char, String), but the data is output onto anOutputStream.voidformatCSV(OutputStream stream, CSVFormat format) LikeformatCSV(CSVFormat), but the data is output onto anOutputStream.voidLikeformatCSV(), but the data is output onto aWriter.voidLikeformatCSV(boolean), but the data is output onto aWriter.voidLikeformatCSV(boolean, char), but the data is output onto aWriter.voidLikeformatCSV(boolean, char, String), but the data is output onto aWriter.voidLikeformatCSV(char), but the data is output onto aWriter.voidLikeformatCSV(char, String), but the data is output onto aWriter.voidLikeformatCSV(CSVFormat), but the data is output onto aWriter.@NotNull StringGet a simple formatted representation of this result as CSV.@NotNull StringGet a simple formatted representation of this result as HTML.voidformatHTML(OutputStream stream) LikeformatHTML(), but the data is output onto anOutputStream.voidformatHTML(Writer writer) LikeformatHTML(), but the data is output onto aWriter.@NotNull StringGet this result as a set ofINSERTstatements.voidformatInsert(OutputStream stream) LikeformatInsert(), but the data is output onto anOutputStream.voidformatInsert(OutputStream stream, Table<?> table, Field<?>... fields) LikeformatInsert(Table, Field...), but the data is output onto anOutputStream.voidformatInsert(Writer writer) LikeformatInsert(), but the data is output onto aWriter.voidformatInsert(Writer writer, Table<?> table, Field<?>... fields) LikeformatInsert(Table, Field...), but the data is output onto anWriter.@NotNull StringformatInsert(Table<?> table, Field<?>... fields) Get this result as a set ofINSERTstatements.@NotNull StringGet a simple formatted representation of this result as a JSON array of array.voidformatJSON(OutputStream stream) LikeformatJSON(), but the data is output onto anOutputStream.voidformatJSON(OutputStream stream, JSONFormat format) LikeformatJSON(JSONFormat), but the data is output onto anOutputStream.voidformatJSON(Writer writer) LikeformatJSON(), but the data is output onto aWriter.voidformatJSON(Writer writer, JSONFormat format) LikeformatJSON(JSONFormat), but the data is output onto aWriter.@NotNull StringformatJSON(JSONFormat format) Get a simple formatted representation of this result as a JSON data structure, according to the format.@NotNull StringGet this result formatted as XML.voidformatXML(OutputStream stream) LikeformatXML(), but the data is output onto anOutputStream.voidformatXML(OutputStream stream, XMLFormat format) LikeformatXML(XMLFormat), but the data is output onto anOutputStream.voidLikeformatXML(), but the data is output onto aWriter.voidLikeformatXML(XMLFormat), but the data is output onto aWriter.@NotNull StringGet this result formatted as XML.@NotNull DocumentintoXML()Get this result as XML.<H extends ContentHandler>
HintoXML(H handler) Get this result as XML using a SAXContentHandler.<H extends ContentHandler>
HGet this result as XML using a SAXContentHandler.@NotNull DocumentGet this result as XML.
-
Method Details
-
format
Get a simple formatted representation of this result.This is the same as calling
format(int)withmaxRows = Integer.MAX_VALUE- Returns:
- The formatted result
-
format
Get a simple formatted representation of this result.- Parameters:
maxRecords- The maximum number of records to include in the formatted result- Returns:
- The formatted result
-
format
Get a simple formatted representation of this result.- Parameters:
format- The formatting information- Returns:
- The formatted result
-
formatHTML
Get a simple formatted representation of this result as HTML.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>- Returns:
- The formatted result
-
formatCSV
Get a simple formatted representation of this result as CSV.This is the same as calling
formatCSV(true, ',', "")- Returns:
- The formatted result
-
formatCSV
Get a simple formatted representation of this result as CSV.This is the same as calling
formatCSV(true, delimiter, "")- Parameters:
delimiter- The delimiter to use between records- Returns:
- The formatted result
-
formatCSV
Get a simple formatted representation of this result as CSV.This is the same as calling
formatCSV(true, delimiter, nullString)- Parameters:
delimiter- The delimiter to use between recordsnullString- A special string for encodingNULLvalues.- Returns:
- The formatted result
-
formatCSV
Get a simple formatted representation of this result as CSV.This is the same as calling
formatCSV(',', "")- Parameters:
header- Whether to emit a CSV header line- Returns:
- The formatted result
-
formatCSV
Get a simple formatted representation of this result as CSV.This is the same as calling
formatCSV(delimiter, "")- Parameters:
header- Whether to emit a CSV header linedelimiter- The delimiter to use between records- Returns:
- The formatted result
-
formatCSV
Get a simple formatted representation of this result as CSV.- Parameters:
header- Whether to emit a CSV header linedelimiter- The delimiter to use between recordsnullString- A special string for encodingNULLvalues.- Returns:
- The formatted result
-
formatCSV
Get a simple formatted representation of this result as CSV.- Returns:
- The formatted result
-
formatJSON
Get a simple formatted representation of this result as a JSON array of array.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]]}- Returns:
- The formatted result
-
formatJSON
Get a simple formatted representation of this result as a JSON data structure, according to the format.- Returns:
- The formatted result
- See Also:
-
formatXML
Get this result formatted as XML. -
formatXML
Get this result formatted as XML. -
formatChart
Get this result as an ASCII chart.- See Also:
-
formatChart
Get this result as an ASCII chart.When running a query like this:
Where the formatted result would look like this:String chart = create.select( BOOK_TO_BOOK_STORE.BOOK_STORE_NAME, count(BOOK_TO_BOOK_STORE.BOOK_ID).as("books") ) .from(BOOK_TO_BOOK_STORE) .groupBy(BOOK_TO_BOOK_STORE.BOOK_STORE_NAME) .fetch() .formatChart();+-------------------------+-----+ |BOOK_STORE_NAME |books| +-------------------------+-----+ |Buchhandlung im Volkshaus| 1| |Ex Libris | 2| |Orell Füssli | 3| +-------------------------+-----+
Then the chart might look something like this:3.00| █████████████████████████ 2.91| █████████████████████████ 2.82| █████████████████████████ 2.73| █████████████████████████ 2.64| █████████████████████████ 2.55| █████████████████████████ 2.45| █████████████████████████ 2.36| █████████████████████████ 2.27| █████████████████████████ 2.18| █████████████████████████ 2.09| █████████████████████████ 2.00| ██████████████████████████████████████████████████ 1.91| ██████████████████████████████████████████████████ 1.82| ██████████████████████████████████████████████████ 1.73| ██████████████████████████████████████████████████ 1.64| ██████████████████████████████████████████████████ 1.55| ██████████████████████████████████████████████████ 1.45| ██████████████████████████████████████████████████ 1.36| ██████████████████████████████████████████████████ 1.27| ██████████████████████████████████████████████████ 1.18| ██████████████████████████████████████████████████ 1.09| ██████████████████████████████████████████████████ 1.00|███████████████████████████████████████████████████████████████████████████ ----+--------------------------------------------------------------------------- | Buchhandlung im Volkshaus Ex Libris Orell FüssliIt is possible to specify a variety ofChartFormatformatting specifications, such as the width, height, display type (default, stacked, 100% stacked), the column index of the category and value columns, etc.- See Also:
-
formatInsert
Get this result as a set ofINSERTstatements.This uses the the first record's
TableRecord.getTable(), if the first record is aTableRecord. Otherwise, this generatesINSERTstatements into an"UNKNOWN_TABLE". In both cases, theFields.fields()are used for column names. -
formatInsert
Get this result as a set ofINSERTstatements.This explicitly specifies the table (and optionally the fields) to insert into. If the
fieldsargument is left empty, theFields.fields()are used, instead. -
format
Likeformat(), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
format
Likeformat(int), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
format
Likeformat(TXTFormat), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatHTML
LikeformatHTML(), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
LikeformatCSV(), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
LikeformatCSV(char), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
LikeformatCSV(char, String), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
LikeformatCSV(boolean), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
LikeformatCSV(boolean, char), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
void formatCSV(OutputStream stream, boolean header, char delimiter, String nullString) throws IOException LikeformatCSV(boolean, char, String), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
LikeformatCSV(CSVFormat), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatJSON
LikeformatJSON(), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatJSON
LikeformatJSON(JSONFormat), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatXML
LikeformatXML(), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatXML
LikeformatXML(XMLFormat), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatChart
LikeformatChart(), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatChart
LikeformatChart(ChartFormat), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatInsert
LikeformatInsert(), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatInsert
LikeformatInsert(Table, Field...), but the data is output onto anOutputStream.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
format
- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
format
Likeformat(int), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
format
Likeformat(TXTFormat), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatHTML
LikeformatHTML(), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
LikeformatCSV(), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
LikeformatCSV(char), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
LikeformatCSV(char, String), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
LikeformatCSV(boolean), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
LikeformatCSV(boolean, char), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
LikeformatCSV(boolean, char, String), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatCSV
LikeformatCSV(CSVFormat), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatJSON
LikeformatJSON(), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatJSON
LikeformatJSON(JSONFormat), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatXML
LikeformatXML(), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatXML
LikeformatXML(XMLFormat), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatChart
LikeformatChart(), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatChart
LikeformatChart(ChartFormat), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatInsert
LikeformatInsert(), but the data is output onto aWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
formatInsert
LikeformatInsert(Table, Field...), but the data is output onto anWriter.- Throws:
IOException- - an unchecked wrapper forIOException, if anything goes wrong.
-
intoXML
Get this result as XML. -
intoXML
Get this result as XML. -
intoXML
Get this result as XML using a SAXContentHandler.- Parameters:
handler- The custom content handler.- Returns:
- The argument content handler is returned for convenience.
- Throws:
SAXException- See Also:
-
intoXML
Get this result as XML using a SAXContentHandler.- Parameters:
handler- The custom content handler.- Returns:
- The argument content handler is returned for convenience.
- Throws:
SAXException- See Also:
-