Top Description Fields Constructors Methods
com.mysql.cj.protocol.a.result

public Class ResultsetRowsCursor

extends AbstractResultsetRows
implements ResultsetRows
Class Inheritance
All Implemented Interfaces
com.mysql.cj.protocol.ResultsetRows, com.mysql.cj.protocol.ProtocolEntity, com.mysql.cj.result.RowList, java.util.Iterator
Imports
java.util.ArrayList, .List, java.util.concurrent.locks.Lock, com.mysql.cj.Messages, .Session, com.mysql.cj.exceptions.ExceptionFactory, com.mysql.cj.protocol.ColumnDefinition, .Resultset.Concurrency, .ResultsetRow, .ResultsetRows, com.mysql.cj.protocol.a.BinaryRowFactory, .NativeMessageBuilder, .NativeProtocol, com.mysql.cj.result.Row, com.mysql.cj.telemetry.TelemetryAttribute, .TelemetryScope, .TelemetrySpan, .TelemetrySpanName

Model for result set data backed by a cursor (see http://dev.mysql.com/doc/refman/5.7/en/cursors.html and SERVER_STATUS_CURSOR_EXISTS flag description on http://dev.mysql.com/doc/internals/en/status-flags.html). Only works for forward-only result sets (but still works with updatable concurrency).

Field Summary

Modifier and TypeField and Description
protected NativeMessageBuilder
private int
currentPositionInEntireResult

Where we are positionaly in the entire result set, used mostly to facilitate easy 'isBeforeFirst()' and 'isFirst()' methods.

private List<Row>
fetchedRows

The cache of rows we have retrieved from the server.

private boolean
firstFetchCompleted

Have we attempted to fetch any rows yet?

private boolean
lastRowFetched

Have we been told from the server that we have seen the last row?

private NativeProtocol
protocol

Communications channel to the server

Inherited from com.mysql.cj.protocol.a.result.AbstractResultsetRows:
BEFORE_START_OF_ROWScurrentPositionInFetchedRowsmetadataownerrowFactorywasEmpty

Constructor Summary

AccessConstructor and Description
public
ResultsetRowsCursor(NativeProtocol
connection to the server.
ioChannel
,
ColumnDefinition
field-level metadata for the results that this cursor covers.
columnDefinition
)

Creates a new cursor-backed row provider.

Method Summary

Modifier and TypeMethod and Description
public void
addRow(Row
the row to add
row
)

Overrides default com.mysql.cj.protocol.ResultsetRows.addRow.

Adds a row.

public void
afterLast()

Overrides default com.mysql.cj.protocol.ResultsetRows.afterLast.

Moves to after last.

public void
beforeFirst()

Overrides default com.mysql.cj.protocol.ResultsetRows.beforeFirst.

Moves to before first.

public void
beforeLast()

Overrides default com.mysql.cj.protocol.ResultsetRows.beforeLast.

Moves to before last.

public void
close()

Overrides default com.mysql.cj.protocol.ResultsetRows.close.

We're done.

private void
public int
getPosition()

Overrides default com.mysql.cj.result.RowList.getPosition.

Returns the current position.

public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public boolean
isAfterLast()

Implements com.mysql.cj.protocol.ResultsetRows.isAfterLast.

Returns true if we got the last element.

public boolean
isBeforeFirst()

Implements com.mysql.cj.protocol.ResultsetRows.isBeforeFirst.

Returns if iteration has not occured yet.

public boolean
isEmpty()

Overrides default com.mysql.cj.protocol.ResultsetRows.isEmpty.

Has no records.

public boolean
isFirst()

Overrides default com.mysql.cj.protocol.ResultsetRows.isFirst.

Are we on the first row of the result set?

public boolean
isLast()

Overrides default com.mysql.cj.protocol.ResultsetRows.isLast.

Are we on the last row of the result set?

public void
moveRowRelative(int
the relative number of rows to move
rows
)

Overrides default com.mysql.cj.protocol.ResultsetRows.moveRowRelative.

Moves the current position relative 'rows' from the current position.

public Row
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
setCurrentRow(int
row to move to
rowNumber
)

Overrides default com.mysql.cj.protocol.ResultsetRows.setCurrentRow.

Moves the current position in the result set to the given row number.

Inherited from com.mysql.cj.protocol.a.result.AbstractResultsetRows:
getMetadatagetOwnersetMetadatasetOwnerwasEmpty

Field Detail

commandBuilderback to summary
protected NativeMessageBuilder commandBuilder
currentPositionInEntireResultback to summary
private int currentPositionInEntireResult

Where we are positionaly in the entire result set, used mostly to facilitate easy 'isBeforeFirst()' and 'isFirst()' methods.

fetchedRowsback to summary
private List<Row> fetchedRows

The cache of rows we have retrieved from the server.

firstFetchCompletedback to summary
private boolean firstFetchCompleted

Have we attempted to fetch any rows yet?

lastRowFetchedback to summary
private boolean lastRowFetched

Have we been told from the server that we have seen the last row?

protocolback to summary
private NativeProtocol protocol

Communications channel to the server

Constructor Detail

ResultsetRowsCursorback to summary
public ResultsetRowsCursor(NativeProtocol ioChannel, ColumnDefinition columnDefinition)

Creates a new cursor-backed row provider.

Parameters
ioChannel:NativeProtocol

connection to the server.

columnDefinition:ColumnDefinition

field-level metadata for the results that this cursor covers.

Method Detail

addRowback to summary
public void addRow(Row row)

Overrides default com.mysql.cj.protocol.ResultsetRows.addRow.

Doc from com.mysql.cj.protocol.ResultsetRows.addRow.

Adds a row.

Parameters
row:Row

the row to add

Annotations
@Override
afterLastback to summary
public void afterLast()

Overrides default com.mysql.cj.protocol.ResultsetRows.afterLast.

Doc from com.mysql.cj.protocol.ResultsetRows.afterLast.

Moves to after last.

Annotations
@Override
beforeFirstback to summary
public void beforeFirst()

Overrides default com.mysql.cj.protocol.ResultsetRows.beforeFirst.

Doc from com.mysql.cj.protocol.ResultsetRows.beforeFirst.

Moves to before first.

Annotations
@Override
beforeLastback to summary
public void beforeLast()

Overrides default com.mysql.cj.protocol.ResultsetRows.beforeLast.

Doc from com.mysql.cj.protocol.ResultsetRows.beforeLast.

Moves to before last.

Annotations
@Override
closeback to summary
public void close()

Overrides default com.mysql.cj.protocol.ResultsetRows.close.

Doc from com.mysql.cj.protocol.ResultsetRows.close.

We're done.

Annotations
@Override
fetchMoreRowsback to summary
private void fetchMoreRows()
getPositionback to summary
public int getPosition()

Overrides default com.mysql.cj.result.RowList.getPosition.

Doc from com.mysql.cj.result.RowList.getPosition.

Returns the current position.

Returns:int

the current row number

Annotations
@Override
hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
isAfterLastback to summary
public boolean isAfterLast()

Implements com.mysql.cj.protocol.ResultsetRows.isAfterLast.

Doc from com.mysql.cj.protocol.ResultsetRows.isAfterLast.

Returns true if we got the last element.

Returns:boolean

true if after last row

Annotations
@Override
isBeforeFirstback to summary
public boolean isBeforeFirst()

Implements com.mysql.cj.protocol.ResultsetRows.isBeforeFirst.

Doc from com.mysql.cj.protocol.ResultsetRows.isBeforeFirst.

Returns if iteration has not occured yet.

Returns:boolean

true if before first row

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Overrides default com.mysql.cj.protocol.ResultsetRows.isEmpty.

Doc from com.mysql.cj.protocol.ResultsetRows.isEmpty.

Has no records.

Returns:boolean

true if no records

Annotations
@Override
isFirstback to summary
public boolean isFirst()

Overrides default com.mysql.cj.protocol.ResultsetRows.isFirst.

Doc from com.mysql.cj.protocol.ResultsetRows.isFirst.

Are we on the first row of the result set?

Returns:boolean

true if on first row

Annotations
@Override
isLastback to summary
public boolean isLast()

Overrides default com.mysql.cj.protocol.ResultsetRows.isLast.

Doc from com.mysql.cj.protocol.ResultsetRows.isLast.

Are we on the last row of the result set?

Returns:boolean

true if on last row

Annotations
@Override
moveRowRelativeback to summary
public void moveRowRelative(int rows)

Overrides default com.mysql.cj.protocol.ResultsetRows.moveRowRelative.

Doc from com.mysql.cj.protocol.ResultsetRows.moveRowRelative.

Moves the current position relative 'rows' from the current position.

Parameters
rows:int

the relative number of rows to move

Annotations
@Override
nextback to summary
public Row next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Row

the next element in the iteration

Annotations
@Override
setCurrentRowback to summary
public void setCurrentRow(int rowNumber)

Overrides default com.mysql.cj.protocol.ResultsetRows.setCurrentRow.

Doc from com.mysql.cj.protocol.ResultsetRows.setCurrentRow.

Moves the current position in the result set to the given row number.

Parameters
rowNumber:int

row to move to

Annotations
@Override