org.mariadb.jdbc.internal.queryresults

## Class CachedSelectResult

- java.lang.Object
- - org.mariadb.jdbc.internal.queryresults.AbstractQueryResult
  - - org.mariadb.jdbc.internal.queryresults.SelectQueryResult
    - - org.mariadb.jdbc.internal.queryresults.CachedSelectResult

    public class CachedSelectResult
    extends SelectQueryResult

### Field Summary

Fields
`protected short` `warningCount`

### Fields inherited from class org.mariadb.jdbc.internal.queryresults.AbstractQueryResult

`isClosed, prepareResult`

### Constructor Summary

Constructors
Constructor and Description
`CachedSelectResult(ColumnInformation[] ci, List<ValueObject[]> result, short warningCount)` Initialisation.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `addResult(AbstractQueryResult other)` When using rewrite statement, there can be many insert/update command send to database, according to max_allowed_packet size.
`static CachedSelectResult` `createCachedSelectResult(StreamingSelectResult streamingResult)` Will retrieve all "next" stream, and cache them.
`ColumnInformation[]` `getColumnInformation()`
`String` `getMessage()`
`ResultSetType` `getResultSetType()`
`int` `getRowPointer()` Gets the current row number.
`int` `getRows()`
`ValueObject` `getValueObject(int position)` gets the value at position i in the result set. i starts at zero!
`short` `getWarnings()`
`boolean` `isAfterLast()` Is pointer after last row.
`boolean` `isBeforeFirst()` Is pointer before first row.
`void` `moveRowPointerTo(int pointerPosition)` Moves the row pointer to position i.
`boolean` `next()` Move pointer forward.

### Methods inherited from class org.mariadb.jdbc.internal.queryresults.AbstractQueryResult

`close, getFailureObject, isClosed, setFailureObject`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### warningCount

    protected short warningCount

### Constructor Detail

#### CachedSelectResult

    public CachedSelectResult(ColumnInformation[] ci,
                              List<ValueObject[]> result,
                              short warningCount)

Initialisation.

Parameters:
  `ci` - column informations
  `result` - first valueObject
  `warningCount` - warning count

### Method Detail

#### addResult

    public void addResult(AbstractQueryResult other)

When using rewrite statement, there can be many insert/update command send to database, according to max_allowed_packet size. the result will be aggregate with this method to give only one result stream to client.

Specified by:
  `addResult` in class `AbstractQueryResult`
Parameters:
  `other` - other AbstractQueryResult.

#### createCachedSelectResult

    public static CachedSelectResult createCachedSelectResult(StreamingSelectResult streamingResult)
                                                       throws IOException,
                                                              QueryException

Will retrieve all "next" stream, and cache them.

Parameters:
  `streamingResult` - streamingResult to populate
Returns:
  ResultSet with all cached datas.
Throws:
  `IOException` - if any error occur during retreiving "next"s packets
  `QueryException` - if receiving an database error stream

#### next

    public boolean next()
                 throws IOException,
                        QueryException

Description copied from class: `SelectQueryResult`
Move pointer forward.

Specified by:
  `next` in class `SelectQueryResult`
Returns:
  true if there is another row
Throws:
  `IOException` - ioException
  `QueryException` - queryException

#### getWarnings

    public short getWarnings()

Overrides:
  `getWarnings` in class `SelectQueryResult`

#### getMessage

    public String getMessage()

Overrides:
  `getMessage` in class `SelectQueryResult`

#### getColumnInformation

    public ColumnInformation[] getColumnInformation()

Overrides:
  `getColumnInformation` in class `SelectQueryResult`

#### getValueObject

    public ValueObject getValueObject(int position)
                               throws NoSuchColumnException

gets the value at position i in the result set. i starts at zero!

Specified by:
  `getValueObject` in class `SelectQueryResult`
Parameters:
  `position` - index, starts at 0
Returns:
  the value
Throws:
  `NoSuchColumnException` - if the column does not exist

#### getRows

    public int getRows()

Specified by:
  `getRows` in class `AbstractQueryResult`

#### moveRowPointerTo

    public void moveRowPointerTo(int pointerPosition)

Description copied from class: `SelectQueryResult`
Moves the row pointer to position i.

Overrides:
  `moveRowPointerTo` in class `SelectQueryResult`
Parameters:
  `pointerPosition` - pointer to move

#### getRowPointer

    public int getRowPointer()

Description copied from class: `SelectQueryResult`
Gets the current row number.

Overrides:
  `getRowPointer` in class `SelectQueryResult`
Returns:
  the current row number

#### getResultSetType

    public ResultSetType getResultSetType()

Overrides:
  `getResultSetType` in class `SelectQueryResult`

#### isBeforeFirst

    public boolean isBeforeFirst()

Is pointer before first row.

Specified by:
  `isBeforeFirst` in class `SelectQueryResult`
Returns:
  true if pointer is before first row.

#### isAfterLast

    public boolean isAfterLast()

Is pointer after last row.

Specified by:
  `isAfterLast` in class `SelectQueryResult`
Returns:
  true if pointer is after last row