Overview | Package | Class | Use | 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 Map` | `queries`

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

Constructor Summary
`QueryResult()`

Method Summary
`void` | `clear()` Clears any previously collected information.
`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.
`Iterator` | `getQueries()` Returns an iterator over all executed queries in the order they were executed.
`List` | `getResults(Query query)` Returns a list of all results of a given query.
`List` | `getRows(Query query)` Returns a List that itself contains Lists of data rows for each ResultSet returned by the query.
`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, List dataRows)` Callback method invoked for each processed ResultSet.
`void` | `nextDataRows(Query q, ResultIterator it)` Closes ResultIterator without reading its data.
`void` | `nextGlobalException(Exception ex)` Overrides superclass implementation to rethrow an exception immediately.
`void` | `nextQueryException(Query query, Exception ex)` Overrides superclass implementation to rethrow an exception immediately.

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

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

Field Detail

### queries

    protected Map queries

Constructor Detail

### QueryResult

    public QueryResult()

Method Detail

### clear

    public void clear()

  Clears any previously collected information.

### getQueries

    public Iterator getQueries()

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

### getResults

    public 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 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 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 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,
                                   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(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,
                             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 | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2007 Apache Cayenne. All Rights Reserved.