# Class Results

java.lang.Object
org.mariadb.jdbc.internal.com.read.dao.Results

public class Results extends Object

## Constructor Summary

Constructors
Constructor
Description
`Results()`
Single Text query.
`Results(MariaDbStatement statement, int fetchSize, boolean batch, int expectedSize, boolean binaryFormat, int resultSetScrollType, int resultSetConcurrency, int autoGeneratedKeys, int autoIncrement, String sql, ParameterHolder[] parameters)`
Default constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`abort()`
Connection.abort() has been called, abort remaining active result-set
`void`
`addResultSet(SelectResultSet resultSet, boolean moreResultAvailable)`
Add resultSet to results.
`void`
`addStats(long updateCount, long insertId, boolean moreResultAvailable)`
Add execution statistics.
`void`
`addStatsError(boolean moreResultAvailable)`
Indicate that result is an Error, to set appropriate results.
`void`
`close()`
`boolean`
`commandEnd()`
Indicate that command / batch is finished, so set current resultSet if needed.
`int`
`getAutoGeneratedKeys()`
`SelectResultSet`
`getCallableResultSet()`
`CmdInformation`
`getCmdInformation()`
`int`
`getCurrentStatNumber()`
`int`
`getExpectedSize()`
`int`
`getFetchSize()`
`ResultSet`
`getGeneratedKeys(Protocol protocol)`
Send a resultSet that contain auto generated keys.
`int`
`getMaxFieldSize()`
`boolean`
`getMoreResults(int current, Protocol protocol)`
Position to next resultSet.
`ParameterHolder[]`
`getParameters()`
`SelectResultSet`
`getResultSet()`
`int`
`getResultSetConcurrency()`
`int`
`getResultSetScrollType()`
`String`
`getSql()`
`MariaDbStatement`
`getStatement()`
`boolean`
`isBatch()`
`boolean`
`isBinaryFormat()`
`boolean`
`isFullyLoaded(Protocol protocol)`
Indicate if result contain result-set that is still streaming from server.
`boolean`
`isRewritten()`
`void`
`loadFully(boolean skip, Protocol protocol)`
Load fully current results.
`void`
`removeFetchSize()`
`void`
`setAutoIncrement(int autoIncrement)`
`protected void`
`setCmdInformation(CmdInformation cmdInformation)`
`void`
`setRewritten(boolean rewritten)`

### Methods inherited from class Object

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

## Constructor Details

### Results

public Results()
Single Text query. /! use internally, because autoincrement value is not right for multi-queries !/

### Results

public Results(MariaDbStatement statement, int fetchSize, boolean batch, int expectedSize, boolean binaryFormat, int resultSetScrollType, int resultSetConcurrency, int autoGeneratedKeys, int autoIncrement, String sql, ParameterHolder[] parameters)
Default constructor.

Parameters:
  `statement` - current statement
  `fetchSize` - fetch size
  `batch` - select result possible
  `expectedSize` - expected size
  `binaryFormat` - use binary protocol
  `resultSetScrollType` - one of the following `ResultSet` constants: `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`
  `resultSetConcurrency` - a concurrency type; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`
  `autoGeneratedKeys` - a flag indicating whether auto-generated keys should be returned; one of `Statement.RETURN_GENERATED_KEYS` or `Statement.NO_GENERATED_KEYS`
  `autoIncrement` - Connection auto-increment value
  `sql` - sql command
  `parameters` - parameters

## Method Details

### addStats

public void addStats(long updateCount, long insertId, boolean moreResultAvailable)
Add execution statistics.

Parameters:
  `updateCount` - number of updated rows
  `insertId` - primary key
  `moreResultAvailable` - is there additional packet

### addStatsError

public void addStatsError(boolean moreResultAvailable)
Indicate that result is an Error, to set appropriate results.

Parameters:
  `moreResultAvailable` - indicate if other results (ResultSet or updateCount) are available.

### getCurrentStatNumber

public int getCurrentStatNumber()

### addResultSet

public void addResultSet(SelectResultSet resultSet, boolean moreResultAvailable)
Add resultSet to results.

Parameters:
  `resultSet` - new resultSet.
  `moreResultAvailable` - indicate if other results (ResultSet or updateCount) are available.

### getCmdInformation

public CmdInformation getCmdInformation()

### setCmdInformation

protected void setCmdInformation(CmdInformation cmdInformation)

### commandEnd

public boolean commandEnd()
Indicate that command / batch is finished, so set current resultSet if needed.

Returns:
  true id has cmdInformation

### getResultSet

public SelectResultSet getResultSet()

### getCallableResultSet

public SelectResultSet getCallableResultSet()

### loadFully

public void loadFully(boolean skip, Protocol protocol) throws SQLException
Load fully current results.

Lock must be set before using this method

Parameters:
  `skip` - must result be available afterwhile
  `protocol` - current protocol
Throws:
  `SQLException` - if any connection error occur

### abort

public void abort() throws SQLException
Connection.abort() has been called, abort remaining active result-set

Throws:
  `SQLException` - exception

### isFullyLoaded

public boolean isFullyLoaded(Protocol protocol)
Indicate if result contain result-set that is still streaming from server.

Parameters:
  `protocol` - current protocol
Returns:
  true if streaming is finished

### getMoreResults

public boolean getMoreResults(int current, Protocol protocol) throws SQLException
Position to next resultSet.

Parameters:
  `current` - one of the following `Statement` constants indicating what should happen to current `ResultSet` objects obtained using the method `getResultSet`: `Statement.CLOSE_CURRENT_RESULT`, `Statement.KEEP_CURRENT_RESULT`, or `Statement.CLOSE_ALL_RESULTS`
  `protocol` - current protocol
Returns:
  true if other resultSet exists.
Throws:
  `SQLException` - if any connection error occur.

### getFetchSize

public int getFetchSize()

### getStatement

public MariaDbStatement getStatement()

### isBatch

public boolean isBatch()

### getExpectedSize

public int getExpectedSize()

### isBinaryFormat

public boolean isBinaryFormat()

### removeFetchSize

public void removeFetchSize()

### getResultSetScrollType

public int getResultSetScrollType()

### getSql

public String getSql()

### getParameters

public ParameterHolder[] getParameters()

### getGeneratedKeys

public ResultSet getGeneratedKeys(Protocol protocol) throws SQLException
Send a resultSet that contain auto generated keys. 2 differences :

1. Batch will list all insert ids.
2. in case of multi-query is set, resultSet will be per query.

example "INSERT INTO myTable values ('a'),('b');INSERT INTO myTable values ('c'),('d'),('e')" will have a resultSet of 2 values, and when Statement.getMoreResults() will be called, a Statement.getGeneratedKeys will return a resultset with 3 ids.

Parameters:
  `protocol` - current protocol
Returns:
  a ResultSet containing generated ids.
Throws:
  `SQLException` - if autoGeneratedKeys was not set to Statement.RETURN_GENERATED_KEYS

### close

public void close()

### getMaxFieldSize

public int getMaxFieldSize()

### setAutoIncrement

public void setAutoIncrement(int autoIncrement)

### getResultSetConcurrency

public int getResultSetConcurrency()

### getAutoGeneratedKeys

public int getAutoGeneratedKeys()

### isRewritten

public boolean isRewritten()

### setRewritten

public void setRewritten(boolean rewritten)