org.mariadb.jdbc.internal.queryresults

## Class MultiVariableIntExecutionResult

- java.lang.Object
- - org.mariadb.jdbc.internal.queryresults.MultiVariableIntExecutionResult

All Implemented Interfaces:
  ExecutionResult, MultiExecutionResult

    public class MultiVariableIntExecutionResult
    extends Object
    implements MultiExecutionResult

### Field Summary

Fields
`Deque<ExecutionResult>` `cachedExecutionResults`

### Constructor Summary

Constructors
Constructor and Description
`MultiVariableIntExecutionResult(MariaDbStatement statement, int size, int fetchSize, boolean selectPossible)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addResult(ExecutionResult executionResult)`
`void` `addResultSet(MariaSelectResultSet result, boolean moreResultAvailable)` Add a resultSet information.
`void` `addStats(long affectedRows, long insertId, boolean moreResultAvailable)` Add execution statistics.
`void` `addStatsError()`
`void` `addStatsError(boolean moreResultAvailable)` Add resutl information when an Exception occur during batch.
`void` `close()` Close resultset if needed.
`void` `fixStatsError(int sendCommand)` Add missing information when Exception is thrown.
`int[]` `getAffectedRows()` Get update array.
`Deque<ExecutionResult>` `getCachedExecutionResults()`
`int` `getFetchSize()`
`int` `getFirstAffectedRows()`
`long[]` `getInsertIds()` Get insert ids.
`long[]` `getInsertIdsForRewrite(int autoIncrementIncrement)` Generate insert id's array for rewrite operation.
`MariaSelectResultSet` `getResultSet()`
`MariaDbStatement` `getStatement()`
`boolean` `hasMoreResultAvailable()`
`boolean` `hasMoreThanOneAffectedRows()`
`boolean` `isCanHaveCallableResultset()`
`boolean` `isSelectPossible()`
`boolean` `isSingleExecutionResult()`
`void` `setFetchSize(int fetchSize)`
`protected void` `setMoreResultAvailable(boolean moreResultAvailable)`
`int[]` `updateResultsForRewrite(int waitedSize, boolean hasException)` Set resultSet for rewrite queries.
`int[]` `updateResultsMultiple(int waitedSize, boolean hasException)` Set update resultSet right on multiple rewrite.

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

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

### Field Detail

#### cachedExecutionResults

    public Deque<ExecutionResult> cachedExecutionResults

### Constructor Detail

#### MultiVariableIntExecutionResult

    public MultiVariableIntExecutionResult(MariaDbStatement statement,
                                           int size,
                                           int fetchSize,
                                           boolean selectPossible)

Constructor. Creating resultSet data with size according to datas.

Parameters:
  `statement` - current statement
  `size` - initial data size
  `fetchSize` - resultet fetch size
  `selectPossible` - is select command possible

### Method Detail

#### addResultSet

    public void addResultSet(MariaSelectResultSet result,
                             boolean moreResultAvailable)

Add a resultSet information.

Specified by:
  `addResultSet` in interface `ExecutionResult`
Parameters:
  `result` - resultset implementation
  `moreResultAvailable` - is there additional packet

#### addStats

    public void addStats(long affectedRows,
                         long insertId,
                         boolean moreResultAvailable)

Add execution statistics.

Specified by:
  `addStats` in interface `ExecutionResult`
Parameters:
  `affectedRows` - number of affected rows
  `insertId` - primary key
  `moreResultAvailable` - is there additional packet

#### getInsertIds

    public long[] getInsertIds()

Get insert ids.

Specified by:
  `getInsertIds` in interface `ExecutionResult`
Returns:
  insert ids results

#### getAffectedRows

    public int[] getAffectedRows()

Get update array.

Specified by:
  `getAffectedRows` in interface `MultiExecutionResult`
Returns:
  update array.

#### hasMoreThanOneAffectedRows

    public boolean hasMoreThanOneAffectedRows()

Specified by:
  `hasMoreThanOneAffectedRows` in interface `ExecutionResult`

#### getFirstAffectedRows

    public int getFirstAffectedRows()

Specified by:
  `getFirstAffectedRows` in interface `ExecutionResult`
Specified by:
  `getFirstAffectedRows` in interface `MultiExecutionResult`

#### addStatsError

    public void addStatsError(boolean moreResultAvailable)

Add resutl information when an Exception occur during batch.

Specified by:
  `addStatsError` in interface `ExecutionResult`
Parameters:
  `moreResultAvailable` - has more result flag

#### addStatsError

    public void addStatsError()

#### fixStatsError

    public void fixStatsError(int sendCommand)

Add missing information when Exception is thrown.

Specified by:
  `fixStatsError` in interface `ExecutionResult`
Parameters:
  `sendCommand` - send number of command

#### updateResultsForRewrite

    public int[] updateResultsForRewrite(int waitedSize,
                                         boolean hasException)

Set resultSet for rewrite queries. INSERT INTO XX VALUES (YYY) INSERT INTO XX VALUES (ZZZ) is rewritten INSERT INTO XX VALUES (YYY), (ZZZ) so modified row, will all be on the first row, or on a few rows : queries will split to have query size under the max_allowed_size, so data can be on multiple rows

Specified by:
  `updateResultsForRewrite` in interface `MultiExecutionResult`
Parameters:
  `waitedSize` - batchSize
  `hasException` - has exception
Returns:
  affected rows

#### getInsertIdsForRewrite

    public long[] getInsertIdsForRewrite(int autoIncrementIncrement)

Generate insert id's array for rewrite operation. Rewrite operation will return only the first insert ids. Problem is rewrite queries cannot exceed max_allowed_packet size. so when sending many packet, driver must reconstruct the insert ids according to each packet first insert ids and connection AUTO_INCREMENT. //TODO innodb_autoinc_lock_mode if changed to "Interleaved Lock Mode", driver cannot ensure that insert ids values. Id's can be reconstruct using

Parameters:
  `autoIncrementIncrement` - connection AUTO_INCREMENT variable
Returns:
  insert ids array

#### updateResultsMultiple

    public int[] updateResultsMultiple(int waitedSize,
                                       boolean hasException)

Set update resultSet right on multiple rewrite. INSERT XXXX INSERT XXXX is rewritten INSERT XXXX;INSERT XXXX So affected rows and insert Id are separate in as many okPacket.

Specified by:
  `updateResultsMultiple` in interface `MultiExecutionResult`
Parameters:
  `waitedSize` - batchSize
  `hasException` - has exception

#### getResultSet

    public MariaSelectResultSet getResultSet()

Specified by:
  `getResultSet` in interface `ExecutionResult`

#### getStatement

    public MariaDbStatement getStatement()

Specified by:
  `getStatement` in interface `ExecutionResult`

#### hasMoreResultAvailable

    public boolean hasMoreResultAvailable()

Specified by:
  `hasMoreResultAvailable` in interface `ExecutionResult`

#### setMoreResultAvailable

    protected void setMoreResultAvailable(boolean moreResultAvailable)

#### getFetchSize

    public int getFetchSize()

Specified by:
  `getFetchSize` in interface `ExecutionResult`

#### setFetchSize

    public void setFetchSize(int fetchSize)

Specified by:
  `setFetchSize` in interface `ExecutionResult`

#### close

    public void close()
               throws SQLException

Close resultset if needed.

Specified by:
  `close` in interface `ExecutionResult`
Throws:
  `SQLException` - if exception occur during resultset close.

#### isSelectPossible

    public boolean isSelectPossible()

Specified by:
  `isSelectPossible` in interface `ExecutionResult`

#### isCanHaveCallableResultset

    public boolean isCanHaveCallableResultset()

Specified by:
  `isCanHaveCallableResultset` in interface `ExecutionResult`

#### getCachedExecutionResults

    public Deque<ExecutionResult> getCachedExecutionResults()

Specified by:
  `getCachedExecutionResults` in interface `ExecutionResult`

#### addResult

    public void addResult(ExecutionResult executionResult)

#### isSingleExecutionResult

    public boolean isSingleExecutionResult()

Specified by:
  `isSingleExecutionResult` in interface `ExecutionResult`