Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.query.process
Class QueryResults

    java.lang.Object
      org.modeshape.jcr.query.process.QueryResults

All Implemented Interfaces:
  Serializable, QueryResults

    @Immutable
    public class QueryResults

extends Object
implements QueryResults

The resulting output of a query.

See Also:
  Serialized Form

Nested Class Summary
`class` | `QueryResults.TupleCursor` An interface used to walk through the results.

Nested classes/interfaces inherited from interface org.modeshape.jcr.query.QueryResults
`QueryResults.Columns, QueryResults.Cursor, QueryResults.Location, QueryResults.Statistics`

Field Summary

Fields inherited from interface org.modeshape.jcr.query.QueryResults
`FORMATTER`

Constructor Summary
`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.

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### QueryResults

    public 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.

  Parameters:
    `columns` - the definition of the query result columns
    `statistics` - the statistics for this query; may not be null
    `tuples` - the tuples
    `problems` - the problems; may be null if there are no problems
    `plan` - the text representation of the query plan, if the hints asked for it

### QueryResults

    public 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.

  Parameters:
    `columns` - the definition of the query result columns
    `statistics` - the statistics for this query; may not be null
    `tuples` - the tuples

### QueryResults

    public QueryResults(QueryResults.Columns columns,
                        QueryResults.Statistics statistics,
                        Problems problems)

  Create an empty `QueryResults` object for the supplied context, command, and result columns.

  Parameters:
    `columns` - the definition of the query result columns
    `statistics` - the statistics for this query; may not be null
    `problems` - the problems; may be null if there are no problems

### QueryResults

    public QueryResults(QueryResults.Columns columns,
                        QueryResults.Statistics statistics)

  Create an empty `QueryResults` object for the supplied context, command, and result columns.

  Parameters:
    `columns` - the definition of the query result columns
    `statistics` - the statistics for this query; may not be null

Method Detail

### getColumns

    public QueryResults.Columns getColumns()

  Description copied from interface: `QueryResults`
  Get the description of the columns contained in these results. These columns can be used to discover the indexes of the corresponding values from the arrays representing the `tuples`.

  Specified by:
    `getColumns` in interface `QueryResults`
  Returns:
    the column descriptions; never null

### getCursor

    public QueryResults.Cursor getCursor()

  Description copied from interface: `QueryResults`
  Get a cursor that can be used to walk through the results.

  Specified by:
    `getCursor` in interface `QueryResults`
  Returns:
    the cursor; never null, though possibly empty (meaning `QueryResults.Cursor.hasNext()` may return true)

### getTuples

    public List<Object[]> getTuples()

  Description copied from interface: `QueryResults`
  Get the actual tuples that contain the results. Each element in the list represents a tuple, and each tuple corresponds to the column definitions.

  Specified by:
    `getTuples` in interface `QueryResults`
  Returns:
    the list of tuples; never null but possibly empty

### getRowCount

    public int getRowCount()

  Description copied from interface: `QueryResults`
  Get the number of rows in the results.

  Specified by:
    `getRowCount` in interface `QueryResults`
  Returns:
    the number of rows; never negative

### getPlan

    public String getPlan()

  Description copied from interface: `QueryResults`
  Get a description of the query plan, if requested.

  Specified by:
    `getPlan` in interface `QueryResults`
  Returns:
    the query plan, or null if the plan was not requested

### getProblems

    public Problems getProblems()

  Description copied from interface: `QueryResults`
  Get the problems encountered during execution.

  Specified by:
    `getProblems` in interface `QueryResults`
  Returns:
    the problems; never null but possibly empty

### hasErrors

    public boolean hasErrors()

  Description copied from interface: `QueryResults`
  Return true if there is at least one error recorded in the `problems`.

  Specified by:
    `hasErrors` in interface `QueryResults`
  Returns:
    true if there is one or more errors associated with the query, or false otherwise

### hasWarnings

    public boolean hasWarnings()

  Description copied from interface: `QueryResults`
  Return true if there is at least one warning recorded in the `problems`.

  Specified by:
    `hasWarnings` in interface `QueryResults`
  Returns:
    true if there is one or more warnings associated with the query, or false otherwise

### getStatistics

    public QueryResults.Statistics getStatistics()

  Description copied from interface: `QueryResults`
  Get the statistics that describe the time metrics for this query.

  Specified by:
    `getStatistics` in interface `QueryResults`
  Returns:
    the statistics; never null

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### toString

    public String toString(TypeSystem typeSystem,
                           int maxTuples)

  Get a string representation of this result object, with a maximum number of tuples to include.

  Parameters:
    `typeSystem` - the type system that can be used to convert the values to a string; may be null if `Object.toString()` should be used
    `maxTuples` - the maximum number of tuples to print, or `Integer.MAX_VALUE` if all the tuples are to be printed
  Returns:
    the string representation; never null

### toString

    public void toString(TypeSystem typeSystem,
                         StringBuilder sb)

  Get a string representation of this result object.

  Parameters:
    `typeSystem` - the type system that can be used to convert the values to a string; may be null if `Object.toString()` should be used
    `sb` - the string builder to which the results should be written; may not be null

### toString

    public void toString(TypeSystem typeSystem,
                         StringBuilder sb,
                         int maxTuples)

  Get a string representation of this result object, with a maximum number of tuples to include.

  Parameters:
    `typeSystem` - the type system that can be used to convert the values to a string; may be null if `Object.toString()` should be used
    `sb` - the string builder to which the results should be written; may not be null
    `maxTuples` - the maximum number of tuples to print, or `Integer.MAX_VALUE` if all the tuples are to be printed

### determineColumnWidths

    protected int[] determineColumnWidths(TypeSystem typeSystem,
                                          int maxWidth,
                                          boolean useData)

  Determine the width of each column.

  Parameters:
    `typeSystem` - the type system that can be used to convert the values to a string; may be null if `Object.toString()` should be used
    `maxWidth` - the maximum width; must be positive
    `useData` - true if the data should be used to compute the length, or false if just the column names should be used
  Returns:
    the array of widths for each column, excluding any decorating characters; never null

### stringOf

    protected String stringOf(TypeSystem typeSystem,
                              Object value)

### printHeader

    protected void printHeader(StringBuilder sb,
                               int[] columnWidths)

### printLines

    protected void printLines(TypeSystem typeSystem,
                              StringBuilder sb,
                              int[] columnWidths,
                              int maxRowsToPrint)

### printDelimiterLine

    protected void printDelimiterLine(StringBuilder sb,
                                      int[] columnWidths,
                                      boolean includeLineFeed)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.