@Immutable public class QueryResults extends Object implements QueryResults
Modifier and Type | Class and Description |
---|---|
class |
QueryResults.TupleCursor
An interface used to walk through the results.
|
QueryResults.Columns, QueryResults.Cursor, QueryResults.Location, QueryResults.Statistics, QueryResults.TupleReformatter
FORMATTER
Constructor and Description |
---|
QueryResults(QueryResults.Columns columns,
QueryResults.Statistics statistics)
Create an empty
QueryResults object for the supplied context, command, and result columns. |
QueryResults(QueryResults.Columns columns,
QueryResults.Statistics statistics,
List<Object[]> tuples)
Create a results object for the supplied context, command, and result columns and with the supplied tuples.
|
QueryResults(QueryResults.Columns columns,
QueryResults.Statistics statistics,
List<Object[]> tuples,
Problems problems,
String plan)
Create a results object for the supplied context, command, and result columns and with the supplied tuples.
|
QueryResults(QueryResults.Columns columns,
QueryResults.Statistics statistics,
Problems problems)
Create an empty
QueryResults object for the supplied context, command, and result columns. |
Modifier and Type | Method and Description |
---|---|
protected int[] |
determineColumnWidths(TypeSystem typeSystem,
int maxWidth,
boolean useData)
Determine the width of each column.
|
QueryResults.Columns |
getColumns()
Get the description of the columns contained in these results.
|
QueryResults.Cursor |
getCursor()
Get a cursor that can be used to walk through the results.
|
String |
getPlan()
Get a description of the query plan, if requested.
|
Problems |
getProblems()
Get the problems encountered during execution.
|
int |
getRowCount()
Get the number of rows in the results.
|
QueryResults.Statistics |
getStatistics()
Get the statistics that describe the time metrics for this query.
|
List<Object[]> |
getTuples()
Get the actual tuples that contain the results.
|
boolean |
hasErrors()
Return true if there is at least one error recorded in the
problems . |
boolean |
hasWarnings()
Return true if there is at least one warning recorded in the
problems . |
protected void |
printDelimiterLine(StringBuilder sb,
int[] columnWidths,
boolean includeLineFeed) |
protected void |
printHeader(StringBuilder sb,
int[] columnWidths) |
protected void |
printLines(TypeSystem typeSystem,
StringBuilder sb,
int[] columnWidths,
int maxRowsToPrint) |
protected String |
stringOf(TypeSystem typeSystem,
Object value) |
String |
toString() |
String |
toString(TypeSystem typeSystem,
int maxTuples)
Get a string representation of this result object, with a maximum number of tuples to include.
|
void |
toString(TypeSystem typeSystem,
StringBuilder sb)
Get a string representation of this result object.
|
void |
toString(TypeSystem typeSystem,
StringBuilder sb,
int maxTuples)
Get a string representation of this result object, with a maximum number of tuples to include.
|
public QueryResults(QueryResults.Columns columns, QueryResults.Statistics statistics, List<Object[]> tuples, Problems problems, String plan)
columns
- the definition of the query result columnsstatistics
- the statistics for this query; may not be nulltuples
- the tuplesproblems
- the problems; may be null if there are no problemsplan
- the text representation of the query plan, if the hints asked for itpublic QueryResults(QueryResults.Columns columns, QueryResults.Statistics statistics, List<Object[]> tuples)
columns
- the definition of the query result columnsstatistics
- the statistics for this query; may not be nulltuples
- the tuplespublic QueryResults(QueryResults.Columns columns, QueryResults.Statistics statistics, Problems problems)
QueryResults
object for the supplied context, command, and result columns.columns
- the definition of the query result columnsstatistics
- the statistics for this query; may not be nullproblems
- the problems; may be null if there are no problemspublic QueryResults(QueryResults.Columns columns, QueryResults.Statistics statistics)
QueryResults
object for the supplied context, command, and result columns.columns
- the definition of the query result columnsstatistics
- the statistics for this query; may not be nullpublic QueryResults.Columns getColumns()
QueryResults
tuples
.getColumns
in interface QueryResults
public QueryResults.Cursor getCursor()
QueryResults
getCursor
in interface QueryResults
QueryResults.Cursor.hasNext()
may return true)public List<Object[]> getTuples()
QueryResults
getTuples
in interface QueryResults
public int getRowCount()
QueryResults
getRowCount
in interface QueryResults
public String getPlan()
QueryResults
getPlan
in interface QueryResults
public Problems getProblems()
QueryResults
getProblems
in interface QueryResults
public boolean hasErrors()
QueryResults
problems
.hasErrors
in interface QueryResults
public boolean hasWarnings()
QueryResults
problems
.hasWarnings
in interface QueryResults
public QueryResults.Statistics getStatistics()
QueryResults
getStatistics
in interface QueryResults
public String toString(TypeSystem typeSystem, int maxTuples)
typeSystem
- the type system that can be used to convert the values to a string; may be null if
Object.toString()
should be usedmaxTuples
- the maximum number of tuples to print, or Integer.MAX_VALUE
if all the tuples are to be printedpublic void toString(TypeSystem typeSystem, StringBuilder sb)
typeSystem
- the type system that can be used to convert the values to a string; may be null if
Object.toString()
should be usedsb
- the string builder to which the results should be written; may not be nullpublic void toString(TypeSystem typeSystem, StringBuilder sb, int maxTuples)
typeSystem
- the type system that can be used to convert the values to a string; may be null if
Object.toString()
should be usedsb
- the string builder to which the results should be written; may not be nullmaxTuples
- the maximum number of tuples to print, or Integer.MAX_VALUE
if all the tuples are to be printedprotected int[] determineColumnWidths(TypeSystem typeSystem, int maxWidth, boolean useData)
typeSystem
- the type system that can be used to convert the values to a string; may be null if
Object.toString()
should be usedmaxWidth
- the maximum width; must be positiveuseData
- true if the data should be used to compute the length, or false if just the column names should be usedprotected String stringOf(TypeSystem typeSystem, Object value)
protected void printHeader(StringBuilder sb, int[] columnWidths)
protected void printLines(TypeSystem typeSystem, StringBuilder sb, int[] columnWidths, int maxRowsToPrint)
protected void printDelimiterLine(StringBuilder sb, int[] columnWidths, boolean includeLineFeed)
Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.