Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.access
Class QueryResult

    java.lang.Object
      org.apache.cayenne.access.util.DefaultOperationObserver
          org.apache.cayenne.access.QueryResult

All Implemented Interfaces:
  OperationHints, OperationObserver

    public class QueryResult

extends DefaultOperationObserver

QueryResult encapsulates a result of execution of zero or more queries using QueryEngine. QueryResult supports queries with multiple mixed selects and updates, such as ProcedureQueries.

Author:
  Andrus Adamchik

Field Summary
`protected java.util.Map` | `queries`

Fields inherited from class org.apache.cayenne.access.util.DefaultOperationObserver
`DEFAULT_LOG_LEVEL, globalExceptions, queryExceptions`

Constructor Summary
`QueryResult()`

Method Summary
`void` | `clear()` Clears any previously collected information.
`java.util.List` | `getFirstRows(Query query)` Returns the first results for the query.
`int` | `getFirstUpdateCount(Query query)` Returns the first update count for the query.
`int[]` | `getFirstUpdateCounts(Query query)` Returns the first update count.
`java.util.Iterator` | `getQueries()` Returns an iterator over all executed queries in the order they were executed.
`java.util.List` | `getResults(Query query)` Returns a list of all results of a given query.
`java.util.List` | `getRows(Query query)` Returns a List that itself contains Lists of data rows for each ResultSet returned by the query.
`java.util.List` | `getUpdates(Query query)` Returns a List that contains java.lang.Integer objects for each one of the update counts returned by the query.
`boolean` | `isIteratedResult()` Always returns `false`, iterated results are not supported.
`void` | `nextBatchCount(Query query, int[] resultCount)` Callback method invoked after a batch update is executed.
`void` | `nextCount(Query query, int resultCount)` Callback method invoked after an updating query is executed.
`void` | `nextDataRows(Query query, java.util.List dataRows)` Callback method invoked for each processed ResultSet.
`void` | `nextDataRows(Query q, ResultIterator it)` Closes ResultIterator without reading its data.
`void` | `nextGlobalException(java.lang.Exception ex)` Overrides superclass implementation to rethrow an exception immediately.
`void` | `nextQueryException(Query query, java.lang.Exception ex)` Overrides superclass implementation to rethrow an exception immediately.

Methods inherited from class org.apache.cayenne.access.util.DefaultOperationObserver
`getGlobalExceptions, getLoggingLevel, getQueryExceptions, hasExceptions, nextGeneratedDataRows, printExceptions, setLoggingLevel`

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

Field Detail

### queries

    protected java.util.Map queries

Constructor Detail

### QueryResult

    public QueryResult()

Method Detail

### clear

    public void clear()

  Clears any previously collected information.

### getQueries

    public java.util.Iterator getQueries()

  Returns an iterator over all executed queries in the order they were executed.

### getResults

    public java.util.List getResults(Query query)

  Returns a list of all results of a given query. This is potentially a mix of java.lang.Integer values for update operations and java.util.List for select operations. Results are returned in the order they were obtained.

### getFirstUpdateCount

    public int getFirstUpdateCount(Query query)

  Returns the first update count for the query. This is a shortcut for `(Integer)getUpdates(query).get(0)`, kind of like Google's "I'm feeling lucky". Returns -1 if no update count is found for the query.

  ``

### getFirstUpdateCounts

    public int[] getFirstUpdateCounts(Query query)

  Returns the first update count. Returns int[0] if there was no update results for the query.

  Since:
    1.2

### getFirstRows

    public java.util.List getFirstRows(Query query)

  Returns the first results for the query. This is a shortcut for `(List)getRows(query).get(0)`, kind of like Google's "I'm feeling lucky".

  ``

### getRows

    public java.util.List getRows(Query query)

  Returns a List that itself contains Lists of data rows for each ResultSet returned by the query. ResultSets are returned in the oder they were obtained. Any updates that were performed are not included.

### getUpdates

    public java.util.List getUpdates(Query query)

  Returns a List that contains java.lang.Integer objects for each one of the update counts returned by the query. Update counts are returned in the order they were obtained. Batched and regular updates are combined together.

### nextQueryException

    public void nextQueryException(Query query,
                                   java.lang.Exception ex)

  Overrides superclass implementation to rethrow an exception immediately.

  Specified by:
    `nextQueryException` in interface `OperationObserver`
  Overrides:
    `nextQueryException` in class `DefaultOperationObserver`

### nextGlobalException

    public void nextGlobalException(java.lang.Exception ex)

  Overrides superclass implementation to rethrow an exception immediately.

  Specified by:
    `nextGlobalException` in interface `OperationObserver`
  Overrides:
    `nextGlobalException` in class `DefaultOperationObserver`

### isIteratedResult

    public boolean isIteratedResult()

  Always returns `false`, iterated results are not supported.

  Specified by:
    `isIteratedResult` in interface `OperationHints`
  Overrides:
    `isIteratedResult` in class `DefaultOperationObserver`

### nextBatchCount

    public void nextBatchCount(Query query,
                               int[] resultCount)

  Description copied from interface: `OperationObserver`
  Callback method invoked after a batch update is executed.

  Specified by:
    `nextBatchCount` in interface `OperationObserver`
  Overrides:
    `nextBatchCount` in class `DefaultOperationObserver`

### nextCount

    public void nextCount(Query query,
                          int resultCount)

  Description copied from interface: `OperationObserver`
  Callback method invoked after an updating query is executed.

  Specified by:
    `nextCount` in interface `OperationObserver`
  Overrides:
    `nextCount` in class `DefaultOperationObserver`

### nextDataRows

    public void nextDataRows(Query query,
                             java.util.List dataRows)

  Description copied from interface: `OperationObserver`
  Callback method invoked for each processed ResultSet.

  Specified by:
    `nextDataRows` in interface `OperationObserver`
  Overrides:
    `nextDataRows` in class `DefaultOperationObserver`

### nextDataRows

    public void nextDataRows(Query q,
                             ResultIterator it)

  Description copied from class: `DefaultOperationObserver`
  Closes ResultIterator without reading its data. If you implement a custom subclass, only call super if closing the iterator is what you need.

  Specified by:
    `nextDataRows` in interface `OperationObserver`
  Overrides:
    `nextDataRows` in class `DefaultOperationObserver`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2006 Apache.org All Rights Reserved.